@layerzerolabs/verify-contract 1.1.31 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/package.json +4 -3
package/dist/cli.js
CHANGED
|
@@ -470,7 +470,7 @@ ${JSON.stringify(r)}`),await P3(async()=>{let i=await IV(this.props.apiUrl,r);if
|
|
|
470
470
|
|
|
471
471
|
${JSON.stringify(i)}`),FS(i.result))throw new Error("API Rate limit has been exceeded");return i},3,async(i,s)=>{this.emit("retry",i,s),await uh(2e3);})}async __poll(r){for(;;){this.emit("poll",r);let i=await kV(this.props.apiUrl,r);if(this.logger.verbose(`Received raw polling response from ${this.props.apiUrl}:
|
|
472
472
|
|
|
473
|
-
${JSON.stringify(i)}`),i.status===1)return {alreadyVerified:!1};if(OS(i.result))return {alreadyVerified:!0};if(PV(i.result)){await uh(1e4);continue}if(FS(i.result)){await uh(1e4);continue}throw new Error(`Verification failed with result "${i.result}", status ${i.status} (${i.message})`)}}},LS=(t,e)=>new Yg(t,e),PV=t=>!!(t!=null&&t.match(/Pending/gi)),OS=t=>!!(t!=null&&t.match(/already verified/gi)),FS=t=>!!(t!=null&&t.match(/rate/)),IV=async(t,e)=>{try{let r=await Wg(t,{method:"POST",form:e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return PS.parse(r)}catch(r){throw new Error(`Failed to submit verification request: ${r}`)}},kV=async(t,e)=>{let r=new URL(t);r.searchParams.set("module","contract"),r.searchParams.set("action","checkverifystatus"),r.searchParams.set("guid",e);try{let i=await Wg(r).json();return PS.parse(i)}catch(i){throw new Error(`Failed to check verification status: ${i}`)}},MV=({apiKey:t,address:e,contractName:r,constructorArguments:i,compilerVersion:s,optimizerRuns:n=0,sourceCode:o,evmVersion:a,licenseType:u})=>{let l={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:e,contractname:r,compilerversion:`v${s}`,optimizationUsed:n>0?"1":"0",sourceCode:o};return t!=null&&(l.apikey=t),n!=null&&(l.runs=String(n)),i!=null&&(l.constructorArguements=i),a!=null&&(l.evmversion=a),u!=null&&(l.licenseType=String(u)),l},PS=Ie.object({status:Ie.coerce.number().nullish(),message:Ie.string().nullish(),result:Ie.string().nullish()});var Lu=Kt(Ko());Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()});Ie.record(Ie.string(),Ie.object({content:Ie.string()}));var BV=Ie.array(Ie.record(Ie.string(),Ie.any())),jV=Ie.object({language:Ie.string(),compiler:Ie.object({version:Ie.string()}),settings:Ie.object({compilationTarget:Ie.record(Ie.string(),Ie.string()),evmVersion:Ie.string(),optimizer:Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()})}),sources:Ie.record(Ie.string(),Ie.object({content:Ie.string()}))}),Jg=Ie.object({address:Ie.string(),abi:BV,args:Ie.array(Ie.any()),solcInputHash:Ie.string(),metadata:Ie.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:"custom",message:"Invalid JSON"}),Ie.NEVER}}).pipe(jV),bytecode:Ie.string(),deployedBytecode:Ie.string()});var Zg=t=>{let{compilationTarget:e,...r}=t.settings,i=Object.entries(t.sources).reduce((s,[n,o])=>({...s,[n]:{content:o.content}}),{});return {language:t.language,settings:r,sources:i}};var JS=Kt(kS());var MS="logger/5.7.0";var BS=!1,jS=!1,Ih={debug:1,default:2,info:2,warning:3,error:4,off:5},qS=Ih.default,Qg=null;function qV(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(r){t.push(e);}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var HS=qV(),e_;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF";})(e_||(e_={}));var Kr;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED";})(Kr||(Kr={}));var US="0123456789abcdef",ke=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1});}_log(e,r){let i=e.toLowerCase();Ih[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(qS>Ih[i])&&console.log.apply(console,r);}debug(...e){this._log(t.levels.DEBUG,e);}info(...e){this._log(t.levels.INFO,e);}warn(...e){this._log(t.levels.WARNING,e);}makeError(e,r,i){if(jS)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),i||(i={});let s=[];Object.keys(i).forEach(u=>{let l=i[u];try{if(l instanceof Uint8Array){let h="";for(let c=0;c<l.length;c++)h+=US[l[c]>>4],h+=US[l[c]&15];s.push(u+"=Uint8Array(0x"+h+")");}else s.push(u+"="+JSON.stringify(l));}catch(h){s.push(u+"="+JSON.stringify(i[u].toString()));}}),s.push(`code=${r}`),s.push(`version=${this.version}`);let n=e,o="";switch(r){case Kr.NUMERIC_FAULT:{o="NUMERIC_FAULT";let u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Kr.CALL_EXCEPTION:case Kr.INSUFFICIENT_FUNDS:case Kr.MISSING_NEW:case Kr.NONCE_EXPIRED:case Kr.REPLACEMENT_UNDERPRICED:case Kr.TRANSACTION_REPLACED:case Kr.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),s.length&&(e+=" ("+s.join(", ")+")");let a=new Error(e);return a.reason=n,a.code=r,Object.keys(i).forEach(function(u){a[u]=i[u];}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,s){e||this.throwError(r,i,s);}assertArgument(e,r,i,s){e||this.throwArgumentError(r,i,s);}checkNormalize(e){HS&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:HS});}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}));}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r});}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}static globalLogger(){return Qg||(Qg=new t(MS)),Qg}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),BS){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"});}jS=!!e,BS=!!r;}static setLogLevel(e){let r=Ih[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}qS=r;}static from(e){return new t(e)}};ke.errors=Kr;ke.levels=e_;var VS="bytes/5.7.0";var Li=new ke(VS);function zS(t){return !!t.toHexString}function iu(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return iu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function $S(t){return typeof t=="number"&&t==t&&t%1===0}function kh(t){if(t==null)return !1;if(t.constructor===Uint8Array)return !0;if(typeof t=="string"||!$S(t.length)||t.length<0)return !1;for(let e=0;e<t.length;e++){let r=t[e];if(!$S(r)||r<0||r>=256)return !1}return !0}function Mt(t,e){if(e||(e={}),typeof t=="number"){Li.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),iu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),zS(t)&&(t=t.toHexString()),mr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Li.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let s=0;s<r.length;s+=2)i.push(parseInt(r.substring(s,s+2),16));return iu(new Uint8Array(i))}return kh(t)?iu(new Uint8Array(t)):Li.throwArgumentError("invalid arrayify value","value",t)}function Pi(t){let e=t.map(s=>Mt(s)),r=e.reduce((s,n)=>s+n.length,0),i=new Uint8Array(r);return e.reduce((s,n)=>(i.set(n,s),s+n.length),0),iu(i)}function mr(t,e){return !(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var t_="0123456789abcdef";function Rt(t,e){if(e||(e={}),typeof t=="number"){Li.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=t_[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),zS(t))return t.toHexString();if(mr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Li.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(kh(t)){let r="0x";for(let i=0;i<t.length;i++){let s=t[i];r+=t_[(s&240)>>4]+t_[s&15];}return r}return Li.throwArgumentError("invalid hexlify value","value",t)}function r_(t,e,r){return typeof t!="string"?t=Rt(t):(!mr(t)||t.length%2)&&Li.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function KS(t){let e="0x";return t.forEach(r=>{e+=Rt(r).substring(2);}),e}function Mh(t,e){for(typeof t!="string"?t=Rt(t):mr(t)||Li.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Li.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var GS="bignumber/5.7.0";var Bh=JS.default.BN,Ii=new ke(GS),i_={},WS=9007199254740991;var YS=!1,Lt=class t{constructor(e,r){e!==i_&&Ii.throwError("cannot call constructor directly; use BigNumber.from",ke.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this);}fromTwos(e){return gr(Ke(this).fromTwos(e))}toTwos(e){return gr(Ke(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return gr(Ke(this).add(Ke(e)))}sub(e){return gr(Ke(this).sub(Ke(e)))}div(e){return t.from(e).isZero()&&Mr("division-by-zero","div"),gr(Ke(this).div(Ke(e)))}mul(e){return gr(Ke(this).mul(Ke(e)))}mod(e){let r=Ke(e);return r.isNeg()&&Mr("division-by-zero","mod"),gr(Ke(this).umod(r))}pow(e){let r=Ke(e);return r.isNeg()&&Mr("negative-power","pow"),gr(Ke(this).pow(r))}and(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Mr("unbound-bitwise-result","and"),gr(Ke(this).and(r))}or(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Mr("unbound-bitwise-result","or"),gr(Ke(this).or(r))}xor(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Mr("unbound-bitwise-result","xor"),gr(Ke(this).xor(r))}mask(e){return (this.isNegative()||e<0)&&Mr("negative-width","mask"),gr(Ke(this).maskn(e))}shl(e){return (this.isNegative()||e<0)&&Mr("negative-width","shl"),gr(Ke(this).shln(e))}shr(e){return (this.isNegative()||e<0)&&Mr("negative-width","shr"),gr(Ke(this).shrn(e))}eq(e){return Ke(this).eq(Ke(e))}lt(e){return Ke(this).lt(Ke(e))}lte(e){return Ke(this).lte(Ke(e))}gt(e){return Ke(this).gt(Ke(e))}gte(e){return Ke(this).gte(Ke(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Ke(this).isZero()}toNumber(){try{return Ke(this).toNumber()}catch(e){Mr("overflow","toNumber",this.toString());}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ii.throwError("this platform does not support BigInt",ke.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?YS||(YS=!0,Ii.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ii.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ke.errors.UNEXPECTED_ARGUMENT,{}):Ii.throwError("BigNumber.toString does not accept parameters",ke.errors.UNEXPECTED_ARGUMENT,{})),Ke(this).toString(10)}toHexString(){return this._hex}toJSON(e){return {type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(i_,nu(e)):e.match(/^-?[0-9]+$/)?new t(i_,nu(new Bh(e))):Ii.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Mr("underflow","BigNumber.from",e),(e>=WS||e<=-WS)&&Mr("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(kh(r))return t.from(Rt(r));if(r)if(r.toHexString){let i=r.toHexString();if(typeof i=="string")return t.from(i)}else {let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(mr(i)||i[0]==="-"&&mr(i.substring(1))))return t.from(i)}return Ii.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return !!(e&&e._isBigNumber)}};function nu(t){if(typeof t!="string")return nu(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ii.throwArgumentError("invalid hex","value",t),t=nu(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return "0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function gr(t){return Lt.from(nu(t))}function Ke(t){let e=Lt.from(t).toHexString();return e[0]==="-"?new Bh("-"+e.substring(3),16):new Bh(e.substring(2),16)}function Mr(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),Ii.throwError(t,ke.errors.NUMERIC_FAULT,i)}function n_(t){return new Bh(t,36).toString(16)}var ZS="properties/5.7.0";var XS=new ke(ZS);function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1});}function su(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor;}return null}var UV={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function QS(t){if(t==null||UV[typeof t])return !0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return !1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]];}catch(s){continue}if(!QS(i))return !1}return !0}return XS.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function VV(t){if(QS(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>s_(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&Bt(e,r,s_(i));}return e}return XS.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function s_(t){return VV(t)}var ys=class{constructor(e){for(let r in e)this[r]=s_(e[r]);}};var li="abi/5.7.0";var Ge=new ke(li),vs={},eR={calldata:!0,memory:!0,storage:!0},$V={calldata:!0,memory:!0};function jh(t,e){if(t==="bytes"||t==="string"){if(eR[e])return !0}else if(t==="address"){if(e==="payable")return !0}else if((t.indexOf("[")>=0||t==="tuple")&&$V[e])return !0;return (eR[e]||e==="payable")&&Ge.throwArgumentError("invalid modifier","name",e),!1}function zV(t,e){let r=t;function i(a){Ge.throwArgumentError(`unexpected character at position ${a}`,"param",t);}t=t.replace(/\s/g," ");function s(a){let u={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(u.indexed=!1),u}let n={type:"",name:"",state:{allowType:!0}},o=n;for(let a=0;a<t.length;a++){let u=t[a];switch(u){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||i(a),o.state.allowType=!1,o.type=So(o.type),o.components=[s(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),jh(o.type,o.name)&&(o.name=""),o.type=So(o.type);let l=o;o=o.parent,o||i(a),delete l.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),jh(o.type,o.name)&&(o.name=""),o.type=So(o.type);let h=s(o.parent);o.parent.components.push(h),delete o.parent,o=h;break;case" ":o.state.allowType&&o.type!==""&&(o.type=So(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(e||i(a),o.indexed&&i(a),o.indexed=!0,o.name=""):jh(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||i(a),o.type+=u,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||i(a),o.type+=u,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=u,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=u,delete o.state.allowArray):o.state.readArray?o.type+=u:i(a);}}return o.parent&&Ge.throwArgumentError("unexpected eof","param",t),delete n.state,o.name==="indexed"?(e||i(r.length-7),o.indexed&&i(r.length-7),o.indexed=!0,o.name=""):jh(o.type,o.name)&&(o.name=""),n.type=So(n.type),n}function qh(t,e){for(let r in e)Bt(t,r,e[r]);}var Je=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),KV=new RegExp(/^(.*)\[([0-9]*)\]$/),_r=class t{constructor(e,r){e!==vs&&Ge.throwError("use fromString",ke.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),qh(this,r);let i=this.type.match(KV);i?qh(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):qh(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this);}format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Je.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===Je.full?", ":",")+")"):r+=this.type,e!==Je.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Je.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?t.fromString(e,r):t.fromObject(e)}static fromObject(e){return t.isParamType(e)?e:new t(vs,{name:e.name||null,type:So(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(t.fromObject):null})}static fromString(e,r){function i(s){return t.fromObject({name:s.name,type:s.type,indexed:s.indexed,components:s.components})}return i(zV(e,!!r))}static isParamType(e){return !!(e!=null&&e._isParamType)}};function ou(t,e){return WV(t).map(r=>_r.fromString(r,e))}var xs=class t{constructor(e,r){e!==vs&&Ge.throwError("use a static from method",ke.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),qh(this,r),this._isFragment=!0,Object.freeze(this);}static from(e){return t.isFragment(e)?e:typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFragment(e))return e;switch(e.type){case"function":return Es.fromObject(e);case"event":return Ro.fromObject(e);case"constructor":return bs.fromObject(e);case"error":return Hh.fromObject(e);case"fallback":case"receive":return null}return Ge.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Ro.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Es.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?bs.fromString(e.trim()):e.split(" ")[0]==="error"?Hh.fromString(e.substring(5).trim()):Ge.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return !!(e&&e._isFragment)}},Ro=class t extends xs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Je.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ",e!==Je.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isEventFragment(e))return e;e.type!=="event"&&Ge.throwArgumentError("invalid event object","value",e);let r={name:au(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(_r.fromObject):[],type:"event"};return new t(vs,r)}static fromString(e){let r=e.match(uu);r||Ge.throwArgumentError("invalid event string","value",e);let i=!1;return r[3].split(" ").forEach(s=>{switch(s.trim()){case"anonymous":i=!0;break;case"":break;default:Ge.warn("unknown modifier: "+s);}}),t.fromObject({name:r[1].trim(),anonymous:i,inputs:ou(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function rR(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ge.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ge.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Lt.from(r[1]),r[0]):t}function iR(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r);}});}function nR(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ge.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ge.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ge.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e}var bs=class t extends xs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});e===Je.sighash&&Ge.throwError("cannot format a constructor for sighash",ke.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isConstructorFragment(e))return e;e.type!=="constructor"&&Ge.throwArgumentError("invalid constructor object","value",e);let r=nR(e);r.constant&&Ge.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(_r.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Lt.from(e.gas):null};return new t(vs,i)}static fromString(e){let r={type:"constructor"};e=rR(e,r);let i=e.match(uu);return (!i||i[1].trim()!=="constructor")&&Ge.throwArgumentError("invalid constructor string","value",e),r.inputs=ou(i[2].trim(),!1),iR(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},Es=class t extends bs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e))),outputs:this.outputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Je.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ",e!==Je.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(i=>i.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFunctionFragment(e))return e;e.type!=="function"&&Ge.throwArgumentError("invalid function object","value",e);let r=nR(e),i={type:e.type,name:au(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(_r.fromObject):[],outputs:e.outputs?e.outputs.map(_r.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Lt.from(e.gas):null};return new t(vs,i)}static fromString(e){let r={type:"function"};e=rR(e,r);let i=e.split(" returns ");i.length>2&&Ge.throwArgumentError("invalid function string","value",e);let s=i[0].match(uu);if(s||Ge.throwArgumentError("invalid function signature","value",e),r.name=s[1].trim(),r.name&&au(r.name),r.inputs=ou(s[2],!1),iR(s[3].trim(),r),i.length>1){let n=i[1].match(uu);(n[1].trim()!=""||n[3].trim()!="")&&Ge.throwArgumentError("unexpected tokens","value",e),r.outputs=ou(n[2],!1);}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function tR(t){let e=t.format();return (e==="Error(string)"||e==="Panic(uint256)")&&Ge.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Hh=class t extends xs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Je.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isErrorFragment(e))return e;e.type!=="error"&&Ge.throwArgumentError("invalid error object","value",e);let r={type:e.type,name:au(e.name),inputs:e.inputs?e.inputs.map(_r.fromObject):[]};return tR(new t(vs,r))}static fromString(e){let r={type:"error"},i=e.match(uu);return i||Ge.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&au(r.name),r.inputs=ou(i[2],!1),tR(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function So(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var GV=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function au(t){return (!t||!t.match(GV))&&Ge.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var uu=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function WV(t){t=t.trim();let e=[],r="",i=0;for(let s=0;s<t.length;s++){let n=t[s];n===","&&i===0?(e.push(r),r=""):(r+=n,n==="("?i++:n===")"&&(i--,i===-1&&Ge.throwArgumentError("unbalanced parenthesis","value",t)));}return r&&e.push(r),e}var o_=new ke(li);var Ut=class{constructor(e,r,i,s){this.name=e,this.type=r,this.localName=i,this.dynamic=s;}_throwError(e,r){o_.throwArgumentError(e,this.localName,r);}},Cs=class{constructor(e){Bt(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e);}get data(){return KS(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Pi(e._data))}writeBytes(e){let r=Mt(e),i=r.length%this.wordSize;return i&&(r=Pi([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=Mt(Lt.from(e));return r.length>this.wordSize&&o_.throwError("value out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Pi([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r);}}},Uh=class t{constructor(e,r,i,s){Bt(this,"_data",Mt(e)),Bt(this,"wordSize",r||32),Bt(this,"_coerceFunc",i),Bt(this,"allowLoose",s),this._offset=0;}get data(){return Rt(this._data)}get consumed(){return this._offset}static coerce(e,r){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(e,r,i){let s=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+s>this._data.length&&(this.allowLoose&&i&&this._offset+r<=this._data.length?s=r:o_.throwError("data out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+s})),this._data.slice(this._offset,this._offset+s)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let i=this._peekBytes(0,e,!!r);return this._offset+=i.length,i.slice(0,e)}readValue(){return Lt.from(this.readBytes(this.wordSize))}};var oR=Kt(sR());function Ts(t){return "0x"+oR.default.keccak_256(Mt(t))}var aR="address/5.7.0";var lu=new ke(aR);function uR(t){mr(t,20)||lu.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);let i=Mt(Ts(r));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return "0x"+e.join("")}var YV=9007199254740991;function JV(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var a_={};for(let t=0;t<10;t++)a_[String(t)]=String(t);for(let t=0;t<26;t++)a_[String.fromCharCode(65+t)]=String(10+t);var lR=Math.floor(JV(YV));function ZV(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>a_[i]).join("");for(;e.length>=lR;){let i=e.substring(0,lR);e=parseInt(i,10)%97+e.substring(i.length);}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function cu(t){let e=null;if(typeof t!="string"&&lu.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=uR(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&lu.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==ZV(t)&&lu.throwArgumentError("bad icap checksum","address",t),e=n_(t.substring(4));e.length<40;)e="0"+e;e=uR("0x"+e);}else lu.throwArgumentError("invalid address","address",t);return e}var $h=class extends Ut{constructor(e){super("address","address",e,!1);}defaultValue(){return "0x0000000000000000000000000000000000000000"}encode(e,r){try{r=cu(r);}catch(i){this._throwError(i.message,r);}return e.writeValue(r)}decode(e){return cu(Mh(e.readValue().toHexString(),20))}};var zh=class extends Ut{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e;}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}};var No=new ke(li);function u_(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&typeof r=="object"){let u={};i=e.map(l=>{let h=l.localName;return h||No.throwError("cannot encode object for signature with missing names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]&&No.throwError("cannot encode object for signature with duplicate names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]=!0,r[h]});}else No.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&No.throwArgumentError("types/value length mismatch","tuple",r);let s=new Cs(t.wordSize),n=new Cs(t.wordSize),o=[];e.forEach((u,l)=>{let h=i[l];if(u.dynamic){let c=n.length;u.encode(n,h);let d=s.writeUpdatableValue();o.push(f=>{d(f+c);});}else u.encode(s,h);}),o.forEach(u=>{u(s.length);});let a=t.appendWriter(s);return a+=t.appendWriter(n),a}function l_(t,e){let r=[],i=t.subReader(0);e.forEach(n=>{let o=null;if(n.dynamic){let a=t.readValue(),u=i.subReader(a.toNumber());try{o=n.decode(u);}catch(l){if(l.code===ke.errors.BUFFER_OVERRUN)throw l;o=l,o.baseType=n.name,o.name=n.localName,o.type=n.type;}}else try{o=n.decode(t);}catch(a){if(a.code===ke.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=n.name,o.name=n.localName,o.type=n.type;}o!=null&&r.push(o);});let s=e.reduce((n,o)=>{let a=o.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});e.forEach((n,o)=>{let a=n.localName;if(!a||s[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;let u=r[o];u instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw u}}):r[a]=u;});for(let n=0;n<r.length;n++){let o=r[n];o instanceof Error&&Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}});}return Object.freeze(r)}var Kh=class extends Ut{constructor(e,r,i){let s=e.type+"["+(r>=0?r:"")+"]",n=r===-1||e.dynamic;super("array",s,i,n),this.coder=e,this.length=r;}defaultValue(){let e=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(e);return r}encode(e,r){Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),No.checkArgumentCount(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let n=0;n<r.length;n++)s.push(this.coder);return u_(e,s,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&No.throwError("insufficient data length",ke.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let i=[];for(let s=0;s<r;s++)i.push(new zh(this.coder));return e.coerce(this.name,l_(e,i))}};var Gh=class extends Ut{constructor(e){super("bool","bool",e,!1);}defaultValue(){return !1}encode(e,r){return e.writeValue(r?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}};var hu=class extends Ut{constructor(e,r){super(e,e,r,!0);}defaultValue(){return "0x"}encode(e,r){r=Mt(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Wh=class extends hu{constructor(e){super("bytes",e);}decode(e){return e.coerce(this.name,Rt(super.decode(e)))}};var Yh=class extends Ut{constructor(e,r){let i="bytes"+String(e);super(i,i,r,!1),this.size=e;}defaultValue(){return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let i=Mt(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,Rt(e.readBytes(this.size)))}};var Jh=class extends Ut{constructor(e){super("null","",e,!1);}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}};var c_=Lt.from(-1),h_=Lt.from(0),f_=Lt.from(1);var d_=Lt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Zh=class extends Ut{constructor(e,r,i){let s=(r?"int":"uint")+e*8;super(s,s,i,!1),this.size=e,this.signed=r;}defaultValue(){return 0}encode(e,r){let i=Lt.from(r),s=d_.mask(e.wordSize*8);if(this.signed){let n=s.mask(this.size*8-1);(i.gt(n)||i.lt(n.add(f_).mul(c_)))&&this._throwError("value out-of-bounds",r);}else (i.lt(h_)||i.gt(s.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let r=e.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),e.coerce(this.name,r)}};var cR="strings/5.7.0";var hR=new ke(cR),fu;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD";})(fu||(fu={}));var yr;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation";})(yr||(yr={}));function XV(t,e,r,i,s){return hR.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function fR(t,e,r,i,s){if(t===yr.BAD_PREFIX||t===yr.UNEXPECTED_CONTINUE){let n=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)n++;return n}return t===yr.OVERRUN?r.length-e-1:0}function QV(t,e,r,i,s){return t===yr.OVERLONG?(i.push(s),0):(i.push(65533),fR(t,e,r))}var dR=Object.freeze({error:XV,ignore:fR,replace:QV});function e$(t,e){e==null&&(e=dR.error),t=Mt(t);let r=[],i=0;for(;i<t.length;){let s=t[i++];if(!(s>>7)){r.push(s);continue}let n=null,o=null;if((s&224)===192)n=1,o=127;else if((s&240)===224)n=2,o=2047;else if((s&248)===240)n=3,o=65535;else {(s&192)===128?i+=e(yr.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(yr.BAD_PREFIX,i-1,t,r);continue}if(i-1+n>=t.length){i+=e(yr.OVERRUN,i-1,t,r);continue}let a=s&(1<<8-n-1)-1;for(let u=0;u<n;u++){let l=t[i];if((l&192)!=128){i+=e(yr.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|l&63,i++;}if(a!==null){if(a>1114111){i+=e(yr.OUT_OF_RANGE,i-1-n,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(yr.UTF16_SURROGATE,i-1-n,t,r,a);continue}if(a<=o){i+=e(yr.OVERLONG,i-1-n,t,r,a);continue}r.push(a);}}return r}function du(t,e=fu.current){e!=fu.current&&(hR.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(s&63|128);else if((s&64512)==55296){i++;let n=t.charCodeAt(i);if(i>=t.length||(n&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((s&1023)<<10)+(n&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128);}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);}return Mt(r)}function t$(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function p_(t,e){return t$(e$(t,e))}var Xh=class extends hu{constructor(e){super("string",e);}defaultValue(){return ""}encode(e,r){return super.encode(e,du(r))}decode(e){return p_(super.decode(e))}};var As=class extends Ut{constructor(e,r){let i=!1,s=[];e.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type);});let n="tuple("+s.join(",")+")";super("tuple",n,r,i),this.coders=e;}defaultValue(){let e=[];this.coders.forEach(i=>{e.push(i.defaultValue());});let r=this.coders.reduce((i,s)=>{let n=s.localName;return n&&(i[n]||(i[n]=0),i[n]++),i},{});return this.coders.forEach((i,s)=>{let n=i.localName;!n||r[n]!==1||(n==="length"&&(n="_length"),e[n]==null&&(e[n]=e[s]));}),Object.freeze(e)}encode(e,r){return u_(e,this.coders,r)}decode(e){return e.coerce(this.name,l_(e,this.coders))}};var Qh=new ke(li),r$=new RegExp(/^bytes([0-9]*)$/),i$=new RegExp(/^(u?int)([0-9]*)$/),m_=class{constructor(e){Bt(this,"coerceFunc",e||null);}_getCoder(e){switch(e.baseType){case"address":return new $h(e.name);case"bool":return new Gh(e.name);case"string":return new Xh(e.name);case"bytes":return new Wh(e.name);case"array":return new Kh(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new As((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new Jh(e.name)}let r=e.type.match(i$);if(r){let i=parseInt(r[2]||"256");return (i===0||i>256||i%8!==0)&&Qh.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Zh(i/8,r[1]==="int",e.name)}if(r=e.type.match(r$),r){let i=parseInt(r[1]);return (i===0||i>32)&&Qh.throwArgumentError("invalid bytes length","param",e),new Yh(i,e.name)}return Qh.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Uh(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Cs(this._getWordSize())}getDefaultValue(e){let r=e.map(s=>this._getCoder(_r.from(s)));return new As(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Qh.throwError("types/values length mismatch",ke.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});let i=e.map(o=>this._getCoder(_r.from(o))),s=new As(i,"_"),n=this._getWriter();return s.encode(n,r),n.data}decode(e,r,i){let s=e.map(o=>this._getCoder(_r.from(o)));return new As(s,"_").decode(this._getReader(Mt(r),i))}},pR=new m_;function Oo(t){return Ts(du(t))}var Pt=new ke(li);var ef=class extends ys{},tf=class extends ys{},g_=class extends ys{},pu=class extends ys{static isIndexed(e){return !!(e&&e._isIndexed)}},n$={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function mR(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var mu=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Bt(this,"fragments",r.map(i=>xs.from(i)).filter(i=>i!=null)),Bt(this,"_abiCoder",su(new.target,"getAbiCoder")()),Bt(this,"functions",{}),Bt(this,"errors",{}),Bt(this,"events",{}),Bt(this,"structs",{}),this.fragments.forEach(i=>{let s=null;switch(i.type){case"constructor":if(this.deploy){Pt.warn("duplicate definition - constructor");return}Bt(this,"deploy",i);return;case"function":s=this.functions;break;case"event":s=this.events;break;case"error":s=this.errors;break;default:return}let n=i.format();if(s[n]){Pt.warn("duplicate definition - "+n);return}s[n]=i;}),this.deploy||Bt(this,"deploy",bs.from({payable:!1,type:"constructor"})),Bt(this,"_isInterface",!0);}format(e){e||(e=Je.full),e===Je.sighash&&Pt.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===Je.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return pR}static getAddress(e){return cu(e)}static getSighash(e){return r_(Oo(e.format()),0,4)}static getEventTopic(e){return Oo(e.format())}getFunction(e){if(mr(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];Pt.throwArgumentError("no matching function","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.functions).filter(n=>n.split("(")[0]===i);return s.length===0?Pt.throwArgumentError("no matching function","name",i):s.length>1&&Pt.throwArgumentError("multiple matching functions","name",i),this.functions[s[0]]}let r=this.functions[Es.fromString(e).format()];return r||Pt.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(mr(e)){let i=e.toLowerCase();for(let s in this.events)if(i===this.getEventTopic(s))return this.events[s];Pt.throwArgumentError("no matching event","topichash",i);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.events).filter(n=>n.split("(")[0]===i);return s.length===0?Pt.throwArgumentError("no matching event","name",i):s.length>1&&Pt.throwArgumentError("multiple matching events","name",i),this.events[s[0]]}let r=this.events[Ro.fromString(e).format()];return r||Pt.throwArgumentError("no matching event","signature",e),r}getError(e){if(mr(e)){let i=su(this.constructor,"getSighash");for(let s in this.errors){let n=this.errors[s];if(e===i(n))return this.errors[s]}Pt.throwArgumentError("no matching error","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.errors).filter(n=>n.split("(")[0]===i);return s.length===0?Pt.throwArgumentError("no matching error","name",i):s.length>1&&Pt.throwArgumentError("multiple matching errors","name",i),this.errors[s[0]]}let r=this.errors[Es.fromString(e).format()];return r||Pt.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e);}catch(r){try{e=this.getError(e);}catch(i){throw r}}return su(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),su(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));let i=Mt(r);return Rt(i.slice(0,4))!==this.getSighash(e)&&Pt.throwArgumentError(`data signature does not match error ${e.name}.`,"data",Rt(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),Rt(Pi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=Mt(r);return Rt(i.slice(0,4))!==this.getSighash(e)&&Pt.throwArgumentError(`data signature does not match function ${e.name}.`,"data",Rt(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),Rt(Pi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=Mt(r),s=null,n="",o=null,a=null,u=null;switch(i.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,i)}catch(l){}break;case 4:{let l=Rt(i.slice(0,4)),h=n$[l];if(h)o=this._abiCoder.decode(h.inputs,i.slice(4)),a=h.name,u=h.signature,h.reason&&(s=o[0]),a==="Error"?n=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(n=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{let c=this.getError(l);o=this._abiCoder.decode(c.inputs,i.slice(4)),a=c.name,u=c.format();}catch(c){}break}}return Pt.throwError("call revert exception"+n,ke.errors.CALL_EXCEPTION,{method:e.format(),data:Rt(r),errorArgs:o,errorName:a,errorSignature:u,reason:s})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),Rt(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Pt.throwError("too many arguments for "+e.format(),ke.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let i=[];e.anonymous||i.push(this.getEventTopic(e));let s=(n,o)=>n.type==="string"?Oo(o):n.type==="bytes"?Ts(Rt(o)):(n.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),n.type.match(/^u?int/)&&(o=Lt.from(o).toHexString()),n.type==="address"&&this._abiCoder.encode(["address"],[o]),Mh(Rt(o),32));for(r.forEach((n,o)=>{let a=e.inputs[o];if(!a.indexed){n!=null&&Pt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,n);return}n==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?Pt.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,n):Array.isArray(n)?i.push(n.map(u=>s(a,u))):i.push(s(a,n));});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));let i=[],s=[],n=[];return e.anonymous||i.push(this.getEventTopic(e)),r.length!==e.inputs.length&&Pt.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{let u=r[a];if(o.indexed)if(o.type==="string")i.push(Oo(u));else if(o.type==="bytes")i.push(Ts(u));else {if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");i.push(this._abiCoder.encode([o.type],[u]));}else s.push(o),n.push(u);}),{data:this._abiCoder.encode(s,n),topics:i}}decodeEventLog(e,r,i){if(typeof e=="string"&&(e=this.getEvent(e)),i!=null&&!e.anonymous){let d=this.getEventTopic(e);(!mr(i[0],32)||i[0].toLowerCase()!==d)&&Pt.throwError("fragment/topic mismatch",ke.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:i[0]}),i=i.slice(1);}let s=[],n=[],o=[];e.inputs.forEach((d,f)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(s.push(_r.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(s.push(d),o.push(!1)):(n.push(d),o.push(!1));});let a=i!=null?this._abiCoder.decode(s,Pi(i)):null,u=this._abiCoder.decode(n,r,!0),l=[],h=0,c=0;e.inputs.forEach((d,f)=>{if(d.indexed)if(a==null)l[f]=new pu({_isIndexed:!0,hash:null});else if(o[f])l[f]=new pu({_isIndexed:!0,hash:a[c++]});else try{l[f]=a[c++];}catch(m){l[f]=m;}else try{l[f]=u[h++];}catch(m){l[f]=m;}if(d.name&&l[d.name]==null){let m=l[f];m instanceof Error?Object.defineProperty(l,d.name,{enumerable:!0,get:()=>{throw mR(`property ${JSON.stringify(d.name)}`,m)}}):l[d.name]=m;}});for(let d=0;d<l.length;d++){let f=l[d];f instanceof Error&&Object.defineProperty(l,d,{enumerable:!0,get:()=>{throw mR(`index ${d}`,f)}});}return Object.freeze(l)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new tf({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Lt.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return !r||r.anonymous?null:new ef({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=Rt(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new g_({args:this._abiCoder.decode(i.inputs,"0x"+r.substring(10)),errorFragment:i,name:i.name,signature:i.format(),sighash:this.getSighash(i)}):null}static isInterface(e){return !!(e&&e._isInterface)}};var Pf=Kt(t4()),g1=(t,e)=>e==null||e.length===0?void 0:new mu(t).encodeDeploy(e).slice(2),i4=t=>{try{let e=Pf.parse(t),r;return Pf.visit(e,{FunctionDefinition:s=>{s.isConstructor&&(r=s);}}),r4__default.default(r!=null,"Could not find constructor definition"),[{type:"constructor",inputs:r.parameters.map(({typeName:s},n)=>(r4__default.default(s!=null,`Missing a type definition for constructor parameter at position ${n}`),{type:n4(s)}))}]}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}},n4=t=>{switch(t.type){case"ElementaryTypeName":return t.name;case"ArrayTypeName":return `${n4(t.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${t.type}`)}};var _1=t=>{var e;return {deployments:(e=t==null?void 0:t.deployments)!=null?e:TK__default.default.resolve(process.cwd(),"deployments")}},s4=t=>{if(t==null)return ()=>!0;switch(typeof t){case"boolean":return ()=>t;case"string":return e=>e===t;case"function":return t;case"object":if(Array.isArray(t)){let e=new Set(t);return r=>e.has(r)}if(t instanceof RegExp)return e=>t.test(e);throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`);default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`)}};var a4=t=>{try{return fs$1.lstatSync(t).isDirectory()}catch(e){return !1}},u4=t=>{try{return fs$1.lstatSync(t).isFile()}catch(e){return !1}};var h4=async(t,e)=>{let r=Cd(e,t.networks),i=_1(t.paths),s=bd(e),n=d4(e),o=p4(s),a=t.contracts.flatMap(l=>{var Z;let{address:h,network:c,contractName:d,deployment:f}=l;e.info(`Collecting information for contract ${d} on network ${c}`);let m=r[c];if(m==null)return e.info(`No network configured for contract ${d} on network ${c}`),[];let g=`${TK.basename(f,".json")}.json`,v=TK.resolve(i.deployments,c,g);if(!u4(v))return e.error(Jt.error`Deployment file ${v} does not exist or is not a file`),[];let x=ge(v),_=Jg.safeParse(x);if(!_.success)return e.error(Jt.error`No network configured for contract ${d} on network ${c}`),[];let E=_.data,b=TK.basename(d,".sol"),w=E.metadata.sources[d];if(w==null)return e.error(Jt.error`Missing source for contract ${d} for network ${c} in ${g}`),[];let D=Ad(w.content),N=l.constructorArguments==null?void 0:typeof l.constructorArguments=="string"?l.constructorArguments:g1(i4(w.content),l.constructorArguments),F=Zg(E.metadata),U={apiUrl:m.apiUrl,apiKey:m.apiKey,address:h,contractName:`${d}:${b}`,constructorArguments:N,licenseType:D,compilerVersion:E.metadata.compiler.version,sourceCode:JSON.stringify(F),evmVersion:E.metadata.settings.evmVersion,optimizerRuns:(Z=E.metadata.settings.optimizer)==null?void 0:Z.runs};return s({Contract:d,Network:c,Address:U.address,License:U.licenseType,Arguments:l.constructorArguments?JSON.stringify(l.constructorArguments):void 0,Sources:Object.keys(E.metadata.sources),"Scan URL":U.apiUrl,"Scan API Key":U.apiKey?xd(U.apiKey):void 0}),[{networkName:c,networkConfig:m,submitProps:U}]});if(a.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let u=await Promise.all(n(a));return u.forEach(o),u},f4=async(t,e)=>{let r=s4(t.filter),i=Cd(e,t.networks),s=_1(t.paths),n=bd(e),o=d4(e),a=p4(n);if(!a4(s.deployments))throw new Error(`Path ${s.deployments} is not a directory`);let u=new Set(fs$1.readdirSync(s.deployments)),l=Object.entries(i);e.debug("Verifying deployments for following networks:"),l.forEach(([d,f])=>{e.debug(` - ${d} (API URL ${f.apiUrl})`);});let h=l.flatMap(([d,f])=>{if(e.info(`Collecting deployments for ${d}...`),!u.has(d))return e.warn(`Could not find deployment for network ${d} in ${s.deployments}`),[];let m=TK.resolve(s.deployments,d);return fs$1.readdirSync(m).filter(v=>v.endsWith(".json")).flatMap(v=>{e.info(`Inspecting deployment file ${v} on network ${d}`);let x=TK.resolve(m,v),_=ge(x),E=Jg.safeParse(_);if(!E.success)throw new Error(`Error parsing deployment file ${v} on network ${d}: ${E.error}`);let b=E.data,w=b.metadata.settings.compilationTarget;return Object.entries(w).flatMap(([D,N])=>{var y;if(!r(N,D,d))return e.debug(`Not verifying ${N} in ${v} on network ${d}`),[];let U=b.metadata.sources[D];if(U==null)return e.error(Jt.error`Could not find source for ${N} (${D})`),[];let Z=Ad(U.content),re=g1(b.abi,b.args),ae=Zg(b.metadata),k={apiUrl:f.apiUrl,apiKey:f.apiKey,address:b.address,contractName:`${D}:${N}`,constructorArguments:re,licenseType:Z,compilerVersion:b.metadata.compiler.version,sourceCode:JSON.stringify(ae),evmVersion:b.metadata.settings.evmVersion,optimizerRuns:(y=b.metadata.settings.optimizer)==null?void 0:y.runs};return n({Contract:N,Network:d,Address:b.address,License:k.licenseType,Arguments:JSON.stringify(b.args),Sources:Object.keys(b.metadata.sources),"Scan URL":k.apiUrl,"Scan API Key":k.apiKey?xd(k.apiKey):void 0}),{submitProps:k,networkName:d,networkConfig:f}})})});if(h.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let c=await Promise.all(o(h));return c.forEach(a),c},d4=t=>e=>e.map(async(r,i)=>{let{submitProps:s}=r,n=Jt.palette[i%Jt.palette.length],o=`[${i+1}/${e.length}]`,a=Lu.default.bold(s.contractName),u=Lu.default.bold(r.networkName);t.info(n`Verifying contract ${a} for network ${u} ${o}`);try{let l=LS(s,t);l.on("poll",c=>{t.info(n`Polling for verification status of ${a} for network ${u} (GUID ${c}) ${o}`);}),l.on("retry",(c,d)=>{t.verbose(`Received an error: ${c}`),t.info(n`Retrying failed verification attempt of ${a} for network ${u} (attempt ${d+1}) ${o}`);});let h=await l.verify();return {artifact:r,result:h}}catch(l){return t.error(Jt.error`Problem verifying contract ${a} for network ${u} ${o}: ${l} `),{artifact:r,error:l}}}),p4=t=>({artifact:e,response:r,error:i})=>{let s=Lu.default.bold(e.submitProps.contractName),n=Lu.default.bold(e.networkName),o=e.networkConfig.browserUrl?B1(e.networkConfig.browserUrl,e.submitProps.address):void 0;t({Contract:s,Network:n,Result:i==null,"Was verified":r==null?void 0:r.alreadyVerified,"Contract URL":o,Error:i?Jt.error(i):void 0});};var m4="1.1.31";var g4=new Pn("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info"),_4=new Pn("-d,--deployments <path>","Path to the deployments folder"),y4=new Pn("--dry-run","Do not verify anything, just output the verifications that would be performed"),v4=new Pn("-n,--network <network name>","Network to verify").makeOptionMandatory(),x4=new Pn("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)"),b4=new Pn("-k,--api-key <key>","Scan API Key"),wK=new Mu("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',t=>{if(t.startsWith("0x"))return t.slice(2);try{let e=JSON.parse(t);if(!Array.isArray(e))throw new Error(`Constructor arguments must be an array, got ${e}`);return e}catch(e){throw new I1(`Malformed constructor arguments specified: ${e}`)}}).action(async t=>{let e=Ym(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},contracts:[{network:t.network,address:t.address,contractName:t.name,deployment:t.deployment,constructorArguments:t.arguments}]};try{await h4(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}}),DK=new Mu("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",t=>t!=null&&t.trim()?t.split(",").map(e=>e.trim()):void 0).action(async t=>{let e=Ym(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},filter:t.contracts};try{await f4(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}});new Mu("@layerzerolabs/verify-contract").version(m4).description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(wK).addCommand(DK,{isDefault:!0}).parseAsync();
|
|
473
|
+
${JSON.stringify(i)}`),i.status===1)return {alreadyVerified:!1};if(OS(i.result))return {alreadyVerified:!0};if(PV(i.result)){await uh(1e4);continue}if(FS(i.result)){await uh(1e4);continue}throw new Error(`Verification failed with result "${i.result}", status ${i.status} (${i.message})`)}}},LS=(t,e)=>new Yg(t,e),PV=t=>!!(t!=null&&t.match(/Pending/gi)),OS=t=>!!(t!=null&&t.match(/already verified/gi)),FS=t=>!!(t!=null&&t.match(/rate/)),IV=async(t,e)=>{try{let r=await Wg(t,{method:"POST",form:e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return PS.parse(r)}catch(r){throw new Error(`Failed to submit verification request: ${r}`)}},kV=async(t,e)=>{let r=new URL(t);r.searchParams.set("module","contract"),r.searchParams.set("action","checkverifystatus"),r.searchParams.set("guid",e);try{let i=await Wg(r).json();return PS.parse(i)}catch(i){throw new Error(`Failed to check verification status: ${i}`)}},MV=({apiKey:t,address:e,contractName:r,constructorArguments:i,compilerVersion:s,optimizerRuns:n=0,sourceCode:o,evmVersion:a,licenseType:u})=>{let l={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:e,contractname:r,compilerversion:`v${s}`,optimizationUsed:n>0?"1":"0",sourceCode:o};return t!=null&&(l.apikey=t),n!=null&&(l.runs=String(n)),i!=null&&(l.constructorArguements=i),a!=null&&(l.evmversion=a),u!=null&&(l.licenseType=String(u)),l},PS=Ie.object({status:Ie.coerce.number().nullish(),message:Ie.string().nullish(),result:Ie.string().nullish()});var Lu=Kt(Ko());Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()});Ie.record(Ie.string(),Ie.object({content:Ie.string()}));var BV=Ie.array(Ie.record(Ie.string(),Ie.any())),jV=Ie.object({language:Ie.string(),compiler:Ie.object({version:Ie.string()}),settings:Ie.object({compilationTarget:Ie.record(Ie.string(),Ie.string()),evmVersion:Ie.string(),optimizer:Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()})}),sources:Ie.record(Ie.string(),Ie.object({content:Ie.string()}))}),Jg=Ie.object({address:Ie.string(),abi:BV,args:Ie.array(Ie.any()),solcInputHash:Ie.string(),metadata:Ie.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:"custom",message:"Invalid JSON"}),Ie.NEVER}}).pipe(jV),bytecode:Ie.string(),deployedBytecode:Ie.string()});var Zg=t=>{let{compilationTarget:e,...r}=t.settings,i=Object.entries(t.sources).reduce((s,[n,o])=>({...s,[n]:{content:o.content}}),{});return {language:t.language,settings:r,sources:i}};var JS=Kt(kS());var MS="logger/5.7.0";var BS=!1,jS=!1,Ih={debug:1,default:2,info:2,warning:3,error:4,off:5},qS=Ih.default,Qg=null;function qV(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(r){t.push(e);}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var HS=qV(),e_;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF";})(e_||(e_={}));var Kr;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED";})(Kr||(Kr={}));var US="0123456789abcdef",ke=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1});}_log(e,r){let i=e.toLowerCase();Ih[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(qS>Ih[i])&&console.log.apply(console,r);}debug(...e){this._log(t.levels.DEBUG,e);}info(...e){this._log(t.levels.INFO,e);}warn(...e){this._log(t.levels.WARNING,e);}makeError(e,r,i){if(jS)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),i||(i={});let s=[];Object.keys(i).forEach(u=>{let l=i[u];try{if(l instanceof Uint8Array){let h="";for(let c=0;c<l.length;c++)h+=US[l[c]>>4],h+=US[l[c]&15];s.push(u+"=Uint8Array(0x"+h+")");}else s.push(u+"="+JSON.stringify(l));}catch(h){s.push(u+"="+JSON.stringify(i[u].toString()));}}),s.push(`code=${r}`),s.push(`version=${this.version}`);let n=e,o="";switch(r){case Kr.NUMERIC_FAULT:{o="NUMERIC_FAULT";let u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Kr.CALL_EXCEPTION:case Kr.INSUFFICIENT_FUNDS:case Kr.MISSING_NEW:case Kr.NONCE_EXPIRED:case Kr.REPLACEMENT_UNDERPRICED:case Kr.TRANSACTION_REPLACED:case Kr.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),s.length&&(e+=" ("+s.join(", ")+")");let a=new Error(e);return a.reason=n,a.code=r,Object.keys(i).forEach(function(u){a[u]=i[u];}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,s){e||this.throwError(r,i,s);}assertArgument(e,r,i,s){e||this.throwArgumentError(r,i,s);}checkNormalize(e){HS&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:HS});}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}));}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r});}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}static globalLogger(){return Qg||(Qg=new t(MS)),Qg}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),BS){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"});}jS=!!e,BS=!!r;}static setLogLevel(e){let r=Ih[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}qS=r;}static from(e){return new t(e)}};ke.errors=Kr;ke.levels=e_;var VS="bytes/5.7.0";var Li=new ke(VS);function zS(t){return !!t.toHexString}function iu(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return iu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function $S(t){return typeof t=="number"&&t==t&&t%1===0}function kh(t){if(t==null)return !1;if(t.constructor===Uint8Array)return !0;if(typeof t=="string"||!$S(t.length)||t.length<0)return !1;for(let e=0;e<t.length;e++){let r=t[e];if(!$S(r)||r<0||r>=256)return !1}return !0}function Mt(t,e){if(e||(e={}),typeof t=="number"){Li.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),iu(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),zS(t)&&(t=t.toHexString()),mr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Li.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let s=0;s<r.length;s+=2)i.push(parseInt(r.substring(s,s+2),16));return iu(new Uint8Array(i))}return kh(t)?iu(new Uint8Array(t)):Li.throwArgumentError("invalid arrayify value","value",t)}function Pi(t){let e=t.map(s=>Mt(s)),r=e.reduce((s,n)=>s+n.length,0),i=new Uint8Array(r);return e.reduce((s,n)=>(i.set(n,s),s+n.length),0),iu(i)}function mr(t,e){return !(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var t_="0123456789abcdef";function Rt(t,e){if(e||(e={}),typeof t=="number"){Li.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=t_[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),zS(t))return t.toHexString();if(mr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Li.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(kh(t)){let r="0x";for(let i=0;i<t.length;i++){let s=t[i];r+=t_[(s&240)>>4]+t_[s&15];}return r}return Li.throwArgumentError("invalid hexlify value","value",t)}function r_(t,e,r){return typeof t!="string"?t=Rt(t):(!mr(t)||t.length%2)&&Li.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function KS(t){let e="0x";return t.forEach(r=>{e+=Rt(r).substring(2);}),e}function Mh(t,e){for(typeof t!="string"?t=Rt(t):mr(t)||Li.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Li.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var GS="bignumber/5.7.0";var Bh=JS.default.BN,Ii=new ke(GS),i_={},WS=9007199254740991;var YS=!1,Lt=class t{constructor(e,r){e!==i_&&Ii.throwError("cannot call constructor directly; use BigNumber.from",ke.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this);}fromTwos(e){return gr(Ke(this).fromTwos(e))}toTwos(e){return gr(Ke(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return gr(Ke(this).add(Ke(e)))}sub(e){return gr(Ke(this).sub(Ke(e)))}div(e){return t.from(e).isZero()&&Mr("division-by-zero","div"),gr(Ke(this).div(Ke(e)))}mul(e){return gr(Ke(this).mul(Ke(e)))}mod(e){let r=Ke(e);return r.isNeg()&&Mr("division-by-zero","mod"),gr(Ke(this).umod(r))}pow(e){let r=Ke(e);return r.isNeg()&&Mr("negative-power","pow"),gr(Ke(this).pow(r))}and(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Mr("unbound-bitwise-result","and"),gr(Ke(this).and(r))}or(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Mr("unbound-bitwise-result","or"),gr(Ke(this).or(r))}xor(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Mr("unbound-bitwise-result","xor"),gr(Ke(this).xor(r))}mask(e){return (this.isNegative()||e<0)&&Mr("negative-width","mask"),gr(Ke(this).maskn(e))}shl(e){return (this.isNegative()||e<0)&&Mr("negative-width","shl"),gr(Ke(this).shln(e))}shr(e){return (this.isNegative()||e<0)&&Mr("negative-width","shr"),gr(Ke(this).shrn(e))}eq(e){return Ke(this).eq(Ke(e))}lt(e){return Ke(this).lt(Ke(e))}lte(e){return Ke(this).lte(Ke(e))}gt(e){return Ke(this).gt(Ke(e))}gte(e){return Ke(this).gte(Ke(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Ke(this).isZero()}toNumber(){try{return Ke(this).toNumber()}catch(e){Mr("overflow","toNumber",this.toString());}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ii.throwError("this platform does not support BigInt",ke.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?YS||(YS=!0,Ii.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ii.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ke.errors.UNEXPECTED_ARGUMENT,{}):Ii.throwError("BigNumber.toString does not accept parameters",ke.errors.UNEXPECTED_ARGUMENT,{})),Ke(this).toString(10)}toHexString(){return this._hex}toJSON(e){return {type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(i_,nu(e)):e.match(/^-?[0-9]+$/)?new t(i_,nu(new Bh(e))):Ii.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Mr("underflow","BigNumber.from",e),(e>=WS||e<=-WS)&&Mr("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(kh(r))return t.from(Rt(r));if(r)if(r.toHexString){let i=r.toHexString();if(typeof i=="string")return t.from(i)}else {let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(mr(i)||i[0]==="-"&&mr(i.substring(1))))return t.from(i)}return Ii.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return !!(e&&e._isBigNumber)}};function nu(t){if(typeof t!="string")return nu(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ii.throwArgumentError("invalid hex","value",t),t=nu(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return "0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function gr(t){return Lt.from(nu(t))}function Ke(t){let e=Lt.from(t).toHexString();return e[0]==="-"?new Bh("-"+e.substring(3),16):new Bh(e.substring(2),16)}function Mr(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),Ii.throwError(t,ke.errors.NUMERIC_FAULT,i)}function n_(t){return new Bh(t,36).toString(16)}var ZS="properties/5.7.0";var XS=new ke(ZS);function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1});}function su(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor;}return null}var UV={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function QS(t){if(t==null||UV[typeof t])return !0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return !1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]];}catch(s){continue}if(!QS(i))return !1}return !0}return XS.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function VV(t){if(QS(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>s_(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&Bt(e,r,s_(i));}return e}return XS.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function s_(t){return VV(t)}var ys=class{constructor(e){for(let r in e)this[r]=s_(e[r]);}};var li="abi/5.7.0";var Ge=new ke(li),vs={},eR={calldata:!0,memory:!0,storage:!0},$V={calldata:!0,memory:!0};function jh(t,e){if(t==="bytes"||t==="string"){if(eR[e])return !0}else if(t==="address"){if(e==="payable")return !0}else if((t.indexOf("[")>=0||t==="tuple")&&$V[e])return !0;return (eR[e]||e==="payable")&&Ge.throwArgumentError("invalid modifier","name",e),!1}function zV(t,e){let r=t;function i(a){Ge.throwArgumentError(`unexpected character at position ${a}`,"param",t);}t=t.replace(/\s/g," ");function s(a){let u={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(u.indexed=!1),u}let n={type:"",name:"",state:{allowType:!0}},o=n;for(let a=0;a<t.length;a++){let u=t[a];switch(u){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||i(a),o.state.allowType=!1,o.type=So(o.type),o.components=[s(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),jh(o.type,o.name)&&(o.name=""),o.type=So(o.type);let l=o;o=o.parent,o||i(a),delete l.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),jh(o.type,o.name)&&(o.name=""),o.type=So(o.type);let h=s(o.parent);o.parent.components.push(h),delete o.parent,o=h;break;case" ":o.state.allowType&&o.type!==""&&(o.type=So(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(e||i(a),o.indexed&&i(a),o.indexed=!0,o.name=""):jh(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||i(a),o.type+=u,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||i(a),o.type+=u,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=u,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=u,delete o.state.allowArray):o.state.readArray?o.type+=u:i(a);}}return o.parent&&Ge.throwArgumentError("unexpected eof","param",t),delete n.state,o.name==="indexed"?(e||i(r.length-7),o.indexed&&i(r.length-7),o.indexed=!0,o.name=""):jh(o.type,o.name)&&(o.name=""),n.type=So(n.type),n}function qh(t,e){for(let r in e)Bt(t,r,e[r]);}var Je=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),KV=new RegExp(/^(.*)\[([0-9]*)\]$/),_r=class t{constructor(e,r){e!==vs&&Ge.throwError("use fromString",ke.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),qh(this,r);let i=this.type.match(KV);i?qh(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):qh(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this);}format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Je.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===Je.full?", ":",")+")"):r+=this.type,e!==Je.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Je.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?t.fromString(e,r):t.fromObject(e)}static fromObject(e){return t.isParamType(e)?e:new t(vs,{name:e.name||null,type:So(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(t.fromObject):null})}static fromString(e,r){function i(s){return t.fromObject({name:s.name,type:s.type,indexed:s.indexed,components:s.components})}return i(zV(e,!!r))}static isParamType(e){return !!(e!=null&&e._isParamType)}};function ou(t,e){return WV(t).map(r=>_r.fromString(r,e))}var xs=class t{constructor(e,r){e!==vs&&Ge.throwError("use a static from method",ke.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),qh(this,r),this._isFragment=!0,Object.freeze(this);}static from(e){return t.isFragment(e)?e:typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFragment(e))return e;switch(e.type){case"function":return Es.fromObject(e);case"event":return Ro.fromObject(e);case"constructor":return bs.fromObject(e);case"error":return Hh.fromObject(e);case"fallback":case"receive":return null}return Ge.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Ro.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Es.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?bs.fromString(e.trim()):e.split(" ")[0]==="error"?Hh.fromString(e.substring(5).trim()):Ge.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return !!(e&&e._isFragment)}},Ro=class t extends xs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Je.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ",e!==Je.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isEventFragment(e))return e;e.type!=="event"&&Ge.throwArgumentError("invalid event object","value",e);let r={name:au(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(_r.fromObject):[],type:"event"};return new t(vs,r)}static fromString(e){let r=e.match(uu);r||Ge.throwArgumentError("invalid event string","value",e);let i=!1;return r[3].split(" ").forEach(s=>{switch(s.trim()){case"anonymous":i=!0;break;case"":break;default:Ge.warn("unknown modifier: "+s);}}),t.fromObject({name:r[1].trim(),anonymous:i,inputs:ou(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function rR(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ge.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ge.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Lt.from(r[1]),r[0]):t}function iR(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r);}});}function nR(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ge.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ge.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ge.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e}var bs=class t extends xs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});e===Je.sighash&&Ge.throwError("cannot format a constructor for sighash",ke.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isConstructorFragment(e))return e;e.type!=="constructor"&&Ge.throwArgumentError("invalid constructor object","value",e);let r=nR(e);r.constant&&Ge.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(_r.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Lt.from(e.gas):null};return new t(vs,i)}static fromString(e){let r={type:"constructor"};e=rR(e,r);let i=e.match(uu);return (!i||i[1].trim()!=="constructor")&&Ge.throwArgumentError("invalid constructor string","value",e),r.inputs=ou(i[2].trim(),!1),iR(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},Es=class t extends bs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e))),outputs:this.outputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Je.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ",e!==Je.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(i=>i.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFunctionFragment(e))return e;e.type!=="function"&&Ge.throwArgumentError("invalid function object","value",e);let r=nR(e),i={type:e.type,name:au(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(_r.fromObject):[],outputs:e.outputs?e.outputs.map(_r.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Lt.from(e.gas):null};return new t(vs,i)}static fromString(e){let r={type:"function"};e=rR(e,r);let i=e.split(" returns ");i.length>2&&Ge.throwArgumentError("invalid function string","value",e);let s=i[0].match(uu);if(s||Ge.throwArgumentError("invalid function signature","value",e),r.name=s[1].trim(),r.name&&au(r.name),r.inputs=ou(s[2],!1),iR(s[3].trim(),r),i.length>1){let n=i[1].match(uu);(n[1].trim()!=""||n[3].trim()!="")&&Ge.throwArgumentError("unexpected tokens","value",e),r.outputs=ou(n[2],!1);}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function tR(t){let e=t.format();return (e==="Error(string)"||e==="Panic(uint256)")&&Ge.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Hh=class t extends xs{format(e){if(e||(e=Je.sighash),Je[e]||Ge.throwArgumentError("invalid format type","format",e),e===Je.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Je.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Je.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isErrorFragment(e))return e;e.type!=="error"&&Ge.throwArgumentError("invalid error object","value",e);let r={type:e.type,name:au(e.name),inputs:e.inputs?e.inputs.map(_r.fromObject):[]};return tR(new t(vs,r))}static fromString(e){let r={type:"error"},i=e.match(uu);return i||Ge.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&au(r.name),r.inputs=ou(i[2],!1),tR(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function So(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var GV=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function au(t){return (!t||!t.match(GV))&&Ge.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var uu=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function WV(t){t=t.trim();let e=[],r="",i=0;for(let s=0;s<t.length;s++){let n=t[s];n===","&&i===0?(e.push(r),r=""):(r+=n,n==="("?i++:n===")"&&(i--,i===-1&&Ge.throwArgumentError("unbalanced parenthesis","value",t)));}return r&&e.push(r),e}var o_=new ke(li);var Ut=class{constructor(e,r,i,s){this.name=e,this.type=r,this.localName=i,this.dynamic=s;}_throwError(e,r){o_.throwArgumentError(e,this.localName,r);}},Cs=class{constructor(e){Bt(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e);}get data(){return KS(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Pi(e._data))}writeBytes(e){let r=Mt(e),i=r.length%this.wordSize;return i&&(r=Pi([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=Mt(Lt.from(e));return r.length>this.wordSize&&o_.throwError("value out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Pi([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r);}}},Uh=class t{constructor(e,r,i,s){Bt(this,"_data",Mt(e)),Bt(this,"wordSize",r||32),Bt(this,"_coerceFunc",i),Bt(this,"allowLoose",s),this._offset=0;}get data(){return Rt(this._data)}get consumed(){return this._offset}static coerce(e,r){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(e,r,i){let s=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+s>this._data.length&&(this.allowLoose&&i&&this._offset+r<=this._data.length?s=r:o_.throwError("data out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+s})),this._data.slice(this._offset,this._offset+s)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let i=this._peekBytes(0,e,!!r);return this._offset+=i.length,i.slice(0,e)}readValue(){return Lt.from(this.readBytes(this.wordSize))}};var oR=Kt(sR());function Ts(t){return "0x"+oR.default.keccak_256(Mt(t))}var aR="address/5.7.0";var lu=new ke(aR);function uR(t){mr(t,20)||lu.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);let i=Mt(Ts(r));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return "0x"+e.join("")}var YV=9007199254740991;function JV(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var a_={};for(let t=0;t<10;t++)a_[String(t)]=String(t);for(let t=0;t<26;t++)a_[String.fromCharCode(65+t)]=String(10+t);var lR=Math.floor(JV(YV));function ZV(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>a_[i]).join("");for(;e.length>=lR;){let i=e.substring(0,lR);e=parseInt(i,10)%97+e.substring(i.length);}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function cu(t){let e=null;if(typeof t!="string"&&lu.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=uR(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&lu.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==ZV(t)&&lu.throwArgumentError("bad icap checksum","address",t),e=n_(t.substring(4));e.length<40;)e="0"+e;e=uR("0x"+e);}else lu.throwArgumentError("invalid address","address",t);return e}var $h=class extends Ut{constructor(e){super("address","address",e,!1);}defaultValue(){return "0x0000000000000000000000000000000000000000"}encode(e,r){try{r=cu(r);}catch(i){this._throwError(i.message,r);}return e.writeValue(r)}decode(e){return cu(Mh(e.readValue().toHexString(),20))}};var zh=class extends Ut{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e;}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}};var No=new ke(li);function u_(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&typeof r=="object"){let u={};i=e.map(l=>{let h=l.localName;return h||No.throwError("cannot encode object for signature with missing names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]&&No.throwError("cannot encode object for signature with duplicate names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]=!0,r[h]});}else No.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&No.throwArgumentError("types/value length mismatch","tuple",r);let s=new Cs(t.wordSize),n=new Cs(t.wordSize),o=[];e.forEach((u,l)=>{let h=i[l];if(u.dynamic){let c=n.length;u.encode(n,h);let d=s.writeUpdatableValue();o.push(f=>{d(f+c);});}else u.encode(s,h);}),o.forEach(u=>{u(s.length);});let a=t.appendWriter(s);return a+=t.appendWriter(n),a}function l_(t,e){let r=[],i=t.subReader(0);e.forEach(n=>{let o=null;if(n.dynamic){let a=t.readValue(),u=i.subReader(a.toNumber());try{o=n.decode(u);}catch(l){if(l.code===ke.errors.BUFFER_OVERRUN)throw l;o=l,o.baseType=n.name,o.name=n.localName,o.type=n.type;}}else try{o=n.decode(t);}catch(a){if(a.code===ke.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=n.name,o.name=n.localName,o.type=n.type;}o!=null&&r.push(o);});let s=e.reduce((n,o)=>{let a=o.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});e.forEach((n,o)=>{let a=n.localName;if(!a||s[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;let u=r[o];u instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw u}}):r[a]=u;});for(let n=0;n<r.length;n++){let o=r[n];o instanceof Error&&Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}});}return Object.freeze(r)}var Kh=class extends Ut{constructor(e,r,i){let s=e.type+"["+(r>=0?r:"")+"]",n=r===-1||e.dynamic;super("array",s,i,n),this.coder=e,this.length=r;}defaultValue(){let e=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(e);return r}encode(e,r){Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),No.checkArgumentCount(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let n=0;n<r.length;n++)s.push(this.coder);return u_(e,s,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&No.throwError("insufficient data length",ke.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let i=[];for(let s=0;s<r;s++)i.push(new zh(this.coder));return e.coerce(this.name,l_(e,i))}};var Gh=class extends Ut{constructor(e){super("bool","bool",e,!1);}defaultValue(){return !1}encode(e,r){return e.writeValue(r?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}};var hu=class extends Ut{constructor(e,r){super(e,e,r,!0);}defaultValue(){return "0x"}encode(e,r){r=Mt(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Wh=class extends hu{constructor(e){super("bytes",e);}decode(e){return e.coerce(this.name,Rt(super.decode(e)))}};var Yh=class extends Ut{constructor(e,r){let i="bytes"+String(e);super(i,i,r,!1),this.size=e;}defaultValue(){return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let i=Mt(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,Rt(e.readBytes(this.size)))}};var Jh=class extends Ut{constructor(e){super("null","",e,!1);}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}};var c_=Lt.from(-1),h_=Lt.from(0),f_=Lt.from(1);var d_=Lt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Zh=class extends Ut{constructor(e,r,i){let s=(r?"int":"uint")+e*8;super(s,s,i,!1),this.size=e,this.signed=r;}defaultValue(){return 0}encode(e,r){let i=Lt.from(r),s=d_.mask(e.wordSize*8);if(this.signed){let n=s.mask(this.size*8-1);(i.gt(n)||i.lt(n.add(f_).mul(c_)))&&this._throwError("value out-of-bounds",r);}else (i.lt(h_)||i.gt(s.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let r=e.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),e.coerce(this.name,r)}};var cR="strings/5.7.0";var hR=new ke(cR),fu;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD";})(fu||(fu={}));var yr;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation";})(yr||(yr={}));function XV(t,e,r,i,s){return hR.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function fR(t,e,r,i,s){if(t===yr.BAD_PREFIX||t===yr.UNEXPECTED_CONTINUE){let n=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)n++;return n}return t===yr.OVERRUN?r.length-e-1:0}function QV(t,e,r,i,s){return t===yr.OVERLONG?(i.push(s),0):(i.push(65533),fR(t,e,r))}var dR=Object.freeze({error:XV,ignore:fR,replace:QV});function e$(t,e){e==null&&(e=dR.error),t=Mt(t);let r=[],i=0;for(;i<t.length;){let s=t[i++];if(!(s>>7)){r.push(s);continue}let n=null,o=null;if((s&224)===192)n=1,o=127;else if((s&240)===224)n=2,o=2047;else if((s&248)===240)n=3,o=65535;else {(s&192)===128?i+=e(yr.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(yr.BAD_PREFIX,i-1,t,r);continue}if(i-1+n>=t.length){i+=e(yr.OVERRUN,i-1,t,r);continue}let a=s&(1<<8-n-1)-1;for(let u=0;u<n;u++){let l=t[i];if((l&192)!=128){i+=e(yr.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|l&63,i++;}if(a!==null){if(a>1114111){i+=e(yr.OUT_OF_RANGE,i-1-n,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(yr.UTF16_SURROGATE,i-1-n,t,r,a);continue}if(a<=o){i+=e(yr.OVERLONG,i-1-n,t,r,a);continue}r.push(a);}}return r}function du(t,e=fu.current){e!=fu.current&&(hR.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(s&63|128);else if((s&64512)==55296){i++;let n=t.charCodeAt(i);if(i>=t.length||(n&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((s&1023)<<10)+(n&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128);}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);}return Mt(r)}function t$(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function p_(t,e){return t$(e$(t,e))}var Xh=class extends hu{constructor(e){super("string",e);}defaultValue(){return ""}encode(e,r){return super.encode(e,du(r))}decode(e){return p_(super.decode(e))}};var As=class extends Ut{constructor(e,r){let i=!1,s=[];e.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type);});let n="tuple("+s.join(",")+")";super("tuple",n,r,i),this.coders=e;}defaultValue(){let e=[];this.coders.forEach(i=>{e.push(i.defaultValue());});let r=this.coders.reduce((i,s)=>{let n=s.localName;return n&&(i[n]||(i[n]=0),i[n]++),i},{});return this.coders.forEach((i,s)=>{let n=i.localName;!n||r[n]!==1||(n==="length"&&(n="_length"),e[n]==null&&(e[n]=e[s]));}),Object.freeze(e)}encode(e,r){return u_(e,this.coders,r)}decode(e){return e.coerce(this.name,l_(e,this.coders))}};var Qh=new ke(li),r$=new RegExp(/^bytes([0-9]*)$/),i$=new RegExp(/^(u?int)([0-9]*)$/),m_=class{constructor(e){Bt(this,"coerceFunc",e||null);}_getCoder(e){switch(e.baseType){case"address":return new $h(e.name);case"bool":return new Gh(e.name);case"string":return new Xh(e.name);case"bytes":return new Wh(e.name);case"array":return new Kh(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new As((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new Jh(e.name)}let r=e.type.match(i$);if(r){let i=parseInt(r[2]||"256");return (i===0||i>256||i%8!==0)&&Qh.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Zh(i/8,r[1]==="int",e.name)}if(r=e.type.match(r$),r){let i=parseInt(r[1]);return (i===0||i>32)&&Qh.throwArgumentError("invalid bytes length","param",e),new Yh(i,e.name)}return Qh.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Uh(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Cs(this._getWordSize())}getDefaultValue(e){let r=e.map(s=>this._getCoder(_r.from(s)));return new As(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Qh.throwError("types/values length mismatch",ke.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});let i=e.map(o=>this._getCoder(_r.from(o))),s=new As(i,"_"),n=this._getWriter();return s.encode(n,r),n.data}decode(e,r,i){let s=e.map(o=>this._getCoder(_r.from(o)));return new As(s,"_").decode(this._getReader(Mt(r),i))}},pR=new m_;function Oo(t){return Ts(du(t))}var Pt=new ke(li);var ef=class extends ys{},tf=class extends ys{},g_=class extends ys{},pu=class extends ys{static isIndexed(e){return !!(e&&e._isIndexed)}},n$={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function mR(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var mu=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Bt(this,"fragments",r.map(i=>xs.from(i)).filter(i=>i!=null)),Bt(this,"_abiCoder",su(new.target,"getAbiCoder")()),Bt(this,"functions",{}),Bt(this,"errors",{}),Bt(this,"events",{}),Bt(this,"structs",{}),this.fragments.forEach(i=>{let s=null;switch(i.type){case"constructor":if(this.deploy){Pt.warn("duplicate definition - constructor");return}Bt(this,"deploy",i);return;case"function":s=this.functions;break;case"event":s=this.events;break;case"error":s=this.errors;break;default:return}let n=i.format();if(s[n]){Pt.warn("duplicate definition - "+n);return}s[n]=i;}),this.deploy||Bt(this,"deploy",bs.from({payable:!1,type:"constructor"})),Bt(this,"_isInterface",!0);}format(e){e||(e=Je.full),e===Je.sighash&&Pt.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===Je.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return pR}static getAddress(e){return cu(e)}static getSighash(e){return r_(Oo(e.format()),0,4)}static getEventTopic(e){return Oo(e.format())}getFunction(e){if(mr(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];Pt.throwArgumentError("no matching function","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.functions).filter(n=>n.split("(")[0]===i);return s.length===0?Pt.throwArgumentError("no matching function","name",i):s.length>1&&Pt.throwArgumentError("multiple matching functions","name",i),this.functions[s[0]]}let r=this.functions[Es.fromString(e).format()];return r||Pt.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(mr(e)){let i=e.toLowerCase();for(let s in this.events)if(i===this.getEventTopic(s))return this.events[s];Pt.throwArgumentError("no matching event","topichash",i);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.events).filter(n=>n.split("(")[0]===i);return s.length===0?Pt.throwArgumentError("no matching event","name",i):s.length>1&&Pt.throwArgumentError("multiple matching events","name",i),this.events[s[0]]}let r=this.events[Ro.fromString(e).format()];return r||Pt.throwArgumentError("no matching event","signature",e),r}getError(e){if(mr(e)){let i=su(this.constructor,"getSighash");for(let s in this.errors){let n=this.errors[s];if(e===i(n))return this.errors[s]}Pt.throwArgumentError("no matching error","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.errors).filter(n=>n.split("(")[0]===i);return s.length===0?Pt.throwArgumentError("no matching error","name",i):s.length>1&&Pt.throwArgumentError("multiple matching errors","name",i),this.errors[s[0]]}let r=this.errors[Es.fromString(e).format()];return r||Pt.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e);}catch(r){try{e=this.getError(e);}catch(i){throw r}}return su(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),su(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));let i=Mt(r);return Rt(i.slice(0,4))!==this.getSighash(e)&&Pt.throwArgumentError(`data signature does not match error ${e.name}.`,"data",Rt(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),Rt(Pi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=Mt(r);return Rt(i.slice(0,4))!==this.getSighash(e)&&Pt.throwArgumentError(`data signature does not match function ${e.name}.`,"data",Rt(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),Rt(Pi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=Mt(r),s=null,n="",o=null,a=null,u=null;switch(i.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,i)}catch(l){}break;case 4:{let l=Rt(i.slice(0,4)),h=n$[l];if(h)o=this._abiCoder.decode(h.inputs,i.slice(4)),a=h.name,u=h.signature,h.reason&&(s=o[0]),a==="Error"?n=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(n=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{let c=this.getError(l);o=this._abiCoder.decode(c.inputs,i.slice(4)),a=c.name,u=c.format();}catch(c){}break}}return Pt.throwError("call revert exception"+n,ke.errors.CALL_EXCEPTION,{method:e.format(),data:Rt(r),errorArgs:o,errorName:a,errorSignature:u,reason:s})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),Rt(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Pt.throwError("too many arguments for "+e.format(),ke.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let i=[];e.anonymous||i.push(this.getEventTopic(e));let s=(n,o)=>n.type==="string"?Oo(o):n.type==="bytes"?Ts(Rt(o)):(n.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),n.type.match(/^u?int/)&&(o=Lt.from(o).toHexString()),n.type==="address"&&this._abiCoder.encode(["address"],[o]),Mh(Rt(o),32));for(r.forEach((n,o)=>{let a=e.inputs[o];if(!a.indexed){n!=null&&Pt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,n);return}n==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?Pt.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,n):Array.isArray(n)?i.push(n.map(u=>s(a,u))):i.push(s(a,n));});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));let i=[],s=[],n=[];return e.anonymous||i.push(this.getEventTopic(e)),r.length!==e.inputs.length&&Pt.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{let u=r[a];if(o.indexed)if(o.type==="string")i.push(Oo(u));else if(o.type==="bytes")i.push(Ts(u));else {if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");i.push(this._abiCoder.encode([o.type],[u]));}else s.push(o),n.push(u);}),{data:this._abiCoder.encode(s,n),topics:i}}decodeEventLog(e,r,i){if(typeof e=="string"&&(e=this.getEvent(e)),i!=null&&!e.anonymous){let d=this.getEventTopic(e);(!mr(i[0],32)||i[0].toLowerCase()!==d)&&Pt.throwError("fragment/topic mismatch",ke.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:i[0]}),i=i.slice(1);}let s=[],n=[],o=[];e.inputs.forEach((d,f)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(s.push(_r.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(s.push(d),o.push(!1)):(n.push(d),o.push(!1));});let a=i!=null?this._abiCoder.decode(s,Pi(i)):null,u=this._abiCoder.decode(n,r,!0),l=[],h=0,c=0;e.inputs.forEach((d,f)=>{if(d.indexed)if(a==null)l[f]=new pu({_isIndexed:!0,hash:null});else if(o[f])l[f]=new pu({_isIndexed:!0,hash:a[c++]});else try{l[f]=a[c++];}catch(m){l[f]=m;}else try{l[f]=u[h++];}catch(m){l[f]=m;}if(d.name&&l[d.name]==null){let m=l[f];m instanceof Error?Object.defineProperty(l,d.name,{enumerable:!0,get:()=>{throw mR(`property ${JSON.stringify(d.name)}`,m)}}):l[d.name]=m;}});for(let d=0;d<l.length;d++){let f=l[d];f instanceof Error&&Object.defineProperty(l,d,{enumerable:!0,get:()=>{throw mR(`index ${d}`,f)}});}return Object.freeze(l)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new tf({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Lt.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return !r||r.anonymous?null:new ef({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=Rt(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new g_({args:this._abiCoder.decode(i.inputs,"0x"+r.substring(10)),errorFragment:i,name:i.name,signature:i.format(),sighash:this.getSighash(i)}):null}static isInterface(e){return !!(e&&e._isInterface)}};var Pf=Kt(t4()),g1=(t,e)=>e==null||e.length===0?void 0:new mu(t).encodeDeploy(e).slice(2),i4=t=>{try{let e=Pf.parse(t),r;return Pf.visit(e,{FunctionDefinition:s=>{s.isConstructor&&(r=s);}}),r4__default.default(r!=null,"Could not find constructor definition"),[{type:"constructor",inputs:r.parameters.map(({typeName:s},n)=>(r4__default.default(s!=null,`Missing a type definition for constructor parameter at position ${n}`),{type:n4(s)}))}]}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}},n4=t=>{switch(t.type){case"ElementaryTypeName":return t.name;case"ArrayTypeName":return `${n4(t.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${t.type}`)}};var _1=t=>{var e;return {deployments:(e=t==null?void 0:t.deployments)!=null?e:TK__default.default.resolve(process.cwd(),"deployments")}},s4=t=>{if(t==null)return ()=>!0;switch(typeof t){case"boolean":return ()=>t;case"string":return e=>e===t;case"function":return t;case"object":if(Array.isArray(t)){let e=new Set(t);return r=>e.has(r)}if(t instanceof RegExp)return e=>t.test(e);throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`);default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`)}};var a4=t=>{try{return fs$1.lstatSync(t).isDirectory()}catch(e){return !1}},u4=t=>{try{return fs$1.lstatSync(t).isFile()}catch(e){return !1}};var h4=async(t,e)=>{let r=Cd(e,t.networks),i=_1(t.paths),s=bd(e),n=d4(e),o=p4(s),a=t.contracts.flatMap(l=>{var Z;let{address:h,network:c,contractName:d,deployment:f}=l;e.info(`Collecting information for contract ${d} on network ${c}`);let m=r[c];if(m==null)return e.info(`No network configured for contract ${d} on network ${c}`),[];let g=`${TK.basename(f,".json")}.json`,v=TK.resolve(i.deployments,c,g);if(!u4(v))return e.error(Jt.error`Deployment file ${v} does not exist or is not a file`),[];let x=ge(v),_=Jg.safeParse(x);if(!_.success)return e.error(Jt.error`No network configured for contract ${d} on network ${c}`),[];let E=_.data,b=TK.basename(d,".sol"),w=E.metadata.sources[d];if(w==null)return e.error(Jt.error`Missing source for contract ${d} for network ${c} in ${g}`),[];let D=Ad(w.content),N=l.constructorArguments==null?void 0:typeof l.constructorArguments=="string"?l.constructorArguments:g1(i4(w.content),l.constructorArguments),F=Zg(E.metadata),U={apiUrl:m.apiUrl,apiKey:m.apiKey,address:h,contractName:`${d}:${b}`,constructorArguments:N,licenseType:D,compilerVersion:E.metadata.compiler.version,sourceCode:JSON.stringify(F),evmVersion:E.metadata.settings.evmVersion,optimizerRuns:(Z=E.metadata.settings.optimizer)==null?void 0:Z.runs};return s({Contract:d,Network:c,Address:U.address,License:U.licenseType,Arguments:l.constructorArguments?JSON.stringify(l.constructorArguments):void 0,Sources:Object.keys(E.metadata.sources),"Scan URL":U.apiUrl,"Scan API Key":U.apiKey?xd(U.apiKey):void 0}),[{networkName:c,networkConfig:m,submitProps:U}]});if(a.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let u=await Promise.all(n(a));return u.forEach(o),u},f4=async(t,e)=>{let r=s4(t.filter),i=Cd(e,t.networks),s=_1(t.paths),n=bd(e),o=d4(e),a=p4(n);if(!a4(s.deployments))throw new Error(`Path ${s.deployments} is not a directory`);let u=new Set(fs$1.readdirSync(s.deployments)),l=Object.entries(i);e.debug("Verifying deployments for following networks:"),l.forEach(([d,f])=>{e.debug(` - ${d} (API URL ${f.apiUrl})`);});let h=l.flatMap(([d,f])=>{if(e.info(`Collecting deployments for ${d}...`),!u.has(d))return e.warn(`Could not find deployment for network ${d} in ${s.deployments}`),[];let m=TK.resolve(s.deployments,d);return fs$1.readdirSync(m).filter(v=>v.endsWith(".json")).flatMap(v=>{e.info(`Inspecting deployment file ${v} on network ${d}`);let x=TK.resolve(m,v),_=ge(x),E=Jg.safeParse(_);if(!E.success)throw new Error(`Error parsing deployment file ${v} on network ${d}: ${E.error}`);let b=E.data,w=b.metadata.settings.compilationTarget;return Object.entries(w).flatMap(([D,N])=>{var y;if(!r(N,D,d))return e.debug(`Not verifying ${N} in ${v} on network ${d}`),[];let U=b.metadata.sources[D];if(U==null)return e.error(Jt.error`Could not find source for ${N} (${D})`),[];let Z=Ad(U.content),re=g1(b.abi,b.args),ae=Zg(b.metadata),k={apiUrl:f.apiUrl,apiKey:f.apiKey,address:b.address,contractName:`${D}:${N}`,constructorArguments:re,licenseType:Z,compilerVersion:b.metadata.compiler.version,sourceCode:JSON.stringify(ae),evmVersion:b.metadata.settings.evmVersion,optimizerRuns:(y=b.metadata.settings.optimizer)==null?void 0:y.runs};return n({Contract:N,Network:d,Address:b.address,License:k.licenseType,Arguments:JSON.stringify(b.args),Sources:Object.keys(b.metadata.sources),"Scan URL":k.apiUrl,"Scan API Key":k.apiKey?xd(k.apiKey):void 0}),{submitProps:k,networkName:d,networkConfig:f}})})});if(h.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let c=await Promise.all(o(h));return c.forEach(a),c},d4=t=>e=>e.map(async(r,i)=>{let{submitProps:s}=r,n=Jt.palette[i%Jt.palette.length],o=`[${i+1}/${e.length}]`,a=Lu.default.bold(s.contractName),u=Lu.default.bold(r.networkName);t.info(n`Verifying contract ${a} for network ${u} ${o}`);try{let l=LS(s,t);l.on("poll",c=>{t.info(n`Polling for verification status of ${a} for network ${u} (GUID ${c}) ${o}`);}),l.on("retry",(c,d)=>{t.verbose(`Received an error: ${c}`),t.info(n`Retrying failed verification attempt of ${a} for network ${u} (attempt ${d+1}) ${o}`);});let h=await l.verify();return {artifact:r,result:h}}catch(l){return t.error(Jt.error`Problem verifying contract ${a} for network ${u} ${o}: ${l} `),{artifact:r,error:l}}}),p4=t=>({artifact:e,response:r,error:i})=>{let s=Lu.default.bold(e.submitProps.contractName),n=Lu.default.bold(e.networkName),o=e.networkConfig.browserUrl?B1(e.networkConfig.browserUrl,e.submitProps.address):void 0;t({Contract:s,Network:n,Result:i==null,"Was verified":r==null?void 0:r.alreadyVerified,"Contract URL":o,Error:i?Jt.error(i):void 0});};var m4="1.1.33";var g4=new Pn("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info"),_4=new Pn("-d,--deployments <path>","Path to the deployments folder"),y4=new Pn("--dry-run","Do not verify anything, just output the verifications that would be performed"),v4=new Pn("-n,--network <network name>","Network to verify").makeOptionMandatory(),x4=new Pn("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)"),b4=new Pn("-k,--api-key <key>","Scan API Key"),wK=new Mu("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',t=>{if(t.startsWith("0x"))return t.slice(2);try{let e=JSON.parse(t);if(!Array.isArray(e))throw new Error(`Constructor arguments must be an array, got ${e}`);return e}catch(e){throw new I1(`Malformed constructor arguments specified: ${e}`)}}).action(async t=>{let e=Ym(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},contracts:[{network:t.network,address:t.address,contractName:t.name,deployment:t.deployment,constructorArguments:t.arguments}]};try{await h4(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}}),DK=new Mu("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",t=>t!=null&&t.trim()?t.split(",").map(e=>e.trim()):void 0).action(async t=>{let e=Ym(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},filter:t.contracts};try{await f4(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}});new Mu("@layerzerolabs/verify-contract").version(m4).description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(wK).addCommand(DK,{isDefault:!0}).parseAsync();
|
|
474
474
|
/*! Bundled license information:
|
|
475
475
|
|
|
476
476
|
safe-buffer/index.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/verify-contract",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.33",
|
|
4
4
|
"description": "Verify Solidity contracts on supported block explorers",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/LayerZero-Labs/devtools/issues"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@ethersproject/abi": "^5.7.0",
|
|
24
|
-
"@layerzerolabs/io-devtools": "~0.1.
|
|
24
|
+
"@layerzerolabs/io-devtools": "~0.1.16",
|
|
25
25
|
"@solidity-parser/parser": "^0.16.1",
|
|
26
26
|
"@swc/core": "^1.4.0",
|
|
27
27
|
"@swc/jest": "^0.2.36",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"lint": "$npm_execpath eslint '**/*.{js,ts,json}'",
|
|
48
48
|
"lint:fix": "eslint --fix '**/*.{js,ts,json}'",
|
|
49
49
|
"start": "node ./cli.js",
|
|
50
|
-
"test": "jest"
|
|
50
|
+
"test": "$npm_execpath test:jest",
|
|
51
|
+
"test:jest": "jest"
|
|
51
52
|
}
|
|
52
53
|
}
|