@layerzerolabs/verify-contract 1.1.25 → 1.1.27
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 +2 -2
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -434,7 +434,7 @@ Instructions:
|
|
|
434
434
|
Filtered results for: ${this.inputValue?this.inputValue:ki.gray("Enter something to filter")}
|
|
435
435
|
`}renderOption(e,r,i){let s;return r.disabled?s=e===i?ki.gray().underline(r.title):ki.strikethrough().gray(r.title):s=e===i?ki.cyan().underline(r.title):r.title,(r.selected?ki.green(jo.radioOn):jo.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ki.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(ki.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(hK.hide),super.render();let e=[JN.symbol(this.done,this.aborted),ki.bold(this.msg),JN.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ki.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=YN(e,this.out.columns);}};ZN.exports=m1;});var i4=$((jle,r4)=>{var QN=Ft(),dK=Pi(),{style:e4,clear:pK}=Yr(),{erase:mK,cursor:t4}=Pt(),g1=class extends dK{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render();}reset(){this.value=this.initialValue,this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
436
436
|
`),this.close();}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
437
|
-
`),this.close();}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(t4.hide):this.out.write(pK(this.outputText,this.out.columns)),super.render(),this.outputText=[e4.symbol(this.done,this.aborted),QN.bold(this.msg),e4.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:QN.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(mK.line+t4.to(0)+this.outputText));}};r4.exports=g1;});var s4=$((qle,n4)=>{n4.exports={TextPrompt:rN(),SelectPrompt:oN(),TogglePrompt:cN(),DatePrompt:kN(),NumberPrompt:qN(),MultiselectPrompt:h1(),AutocompletePrompt:WN(),AutocompleteMultiselectPrompt:XN(),ConfirmPrompt:i4()};});var a4=$(o4=>{var xr=o4,gK=s4(),Pf=t=>t;function di(t,e,r={}){return new Promise((i,s)=>{let n=new gK[t](e),o=r.onAbort||Pf,a=r.onSubmit||Pf,u=r.onExit||Pf;n.on("state",e.onState||Pf),n.on("submit",l=>i(a(l))),n.on("exit",l=>i(u(l))),n.on("abort",l=>s(o(l)));})}xr.text=t=>di("TextPrompt",t);xr.password=t=>(t.style="password",xr.text(t));xr.invisible=t=>(t.style="invisible",xr.text(t));xr.number=t=>di("NumberPrompt",t);xr.date=t=>di("DatePrompt",t);xr.confirm=t=>di("ConfirmPrompt",t);xr.list=t=>{let e=t.separator||",";return di("TextPrompt",t,{onSubmit:r=>r.split(e).map(i=>i.trim())})};xr.toggle=t=>di("TogglePrompt",t);xr.select=t=>di("SelectPrompt",t);xr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(i=>i.selected).map(i=>i.value);return di("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};xr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(i=>i.selected).map(i=>i.value);return di("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var _K=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));xr.autocomplete=t=>(t.suggest=t.suggest||_K,t.choices=[].concat(t.choices||[]),di("AutocompletePrompt",t));});var c4=$((Ule,l4)=>{var _1=a4(),yK=["suggest","format","onState","validate","onRender","type"],u4=()=>{};async function wn(t=[],{onSubmit:e=u4,onCancel:r=u4}={}){let i={},s=wn._override||{};t=[].concat(t);let n,o,a,u,l,h,c=async(d,f,m=!1)=>{if(!(!m&&d.validate&&d.validate(f)!==!0))return d.format?await d.format(f,i):f};for(o of t)if({name:u,type:l}=o,typeof l=="function"&&(l=await l(n,{...i},o),o.type=l),!!l){for(let d in o){if(yK.includes(d))continue;let f=o[d];o[d]=typeof f=="function"?await f(n,{...i},h):f;}if(h=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:l}=o,_1[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(s[o.name]!==void 0&&(n=await c(o,s[o.name]),n!==void 0)){i[u]=n;continue}try{n=wn._injected?vK(wn._injected,o.initial):await _1[l](o),i[u]=n=await c(o,n,!0),a=await e(o,n,i);}catch(d){a=!await r(o,i);}if(a)return i}return i}function vK(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function xK(t){wn._injected=(wn._injected||[]).concat(t);}function bK(t){wn._override=Object.assign({},t);}l4.exports=Object.assign(wn,{prompt:wn,prompts:_1,inject:xK,override:bK});});var f4=$((Vle,h4)=>{function EK(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return !1;if(t[e]>r[e])return !0}return !1}h4.exports=EK("8.6.0")?kR():c4();});var P1=Kt(L1(),1),{program:IK,createCommand:kK,createArgument:MK,createOption:BK,CommanderError:jK,InvalidArgumentError:qK,InvalidOptionArgumentError:I1,Command:Mu,Argument:HK,Option:Pn,Help:UK}=P1.default;var k1=t=>W4.get(t),M1=t=>{try{let e=new URL(t);return !e.hostname.startsWith("api.")&&!e.hostname.startsWith("api-")?void 0:(e.hostname=e.hostname.replace(/^api[.-]/,""),e.pathname="/",e.toString())}catch(e){return}},B1=(t,e)=>{try{let r=new URL(t);return r.pathname=`/address/${e}`,r.toString()}catch(r){return}},W4=new Map([["amoy","https://amoy.polygonscan.com/api"],["amoy-mainnet","https://amoy.polygonscan.com/api"],["arbitrum","https://api.arbiscan.io/api"],["arbitrum-goerli","https://api-goerli.arbiscan.io/api"],["arbitrum-mainnet","https://api.arbiscan.io/api"],["avalanche","https://api.snowtrace.io/api"],["avalanche-mainnet","https://api.snowtrace.io/api"],["avalanche-testnet","https://api-testnet.snowtrace.io/api"],["base","https://api.basescan.org/api"],["base-goerli","https://api-goerli.basescan.org/api"],["base-mainnet","https://api.basescan.org/api"],["blast","https://api.blastscan.io/api"],["blast-mainnet","https://api.blastscan.io/api"],["bsc","https://api.bscscan.com/api"],["bsc-mainnet","https://api.bscscan.com/api"],["bsc-testnet","https://api-testnet.bscscan.com/api"],["ethereum","https://api.etherscan.io/api"],["ethereum-goerli","https://api-goerli.etherscan.io/api"],["ethereum-mainnet","https://api.etherscan.io/api"],["etherlink","https://explorer.etherlink.com/api"],["etherlink-mainnet","https://explorer.etherlink.com/api"],["fantom","https://api.ftmscan.com/api"],["fantom-mainnet","https://api.ftmscan.com/api"],["fantom-testnet","https://api-testnet.ftmscan.com/api"],["flare","https://api.routescan.io/v2/network/mainnet/evm/14/etherscan"],["flare-mainnet","https://api.routescan.io/v2/network/mainnet/evm/14/etherscan"],["fraxtal","https://api.fraxscan.com/api"],["fraxtal-mainnet","https://api.fraxscan.com/api"],["fuji","https://api-testnet.snowtrace.io/api"],["fuji-mainnet","https://api-testnet.snowtrace.io/api"],["gnosis","https://api.gnosisscan.io/api"],["gnosis-mainnet","https://api.gnosisscan.io/api"],["goerli","https://api-goerli.etherscan.io/api"],["goerli-mainnet","https://api-goerli.etherscan.io/api"],["gravity","https://explorer.gravity.xyz/api"],["gravity-mainnet","https://explorer.gravity.xyz/api"],["kava","https://kavascan.com/api"],["kava-mainnet","https://kavascan.com/api"],["kava-testnet","https://testnet.kavascan.com/api"],["klaytn","https://api-cypress.klaytnscope.com/api"],["klaytn-mainnet","https://api-cypress.klaytnscope.com/api"],["klaytn-testnet","https://api-baobab.klaytnscope.com/api"],["linea","https://api.lineascan.build/api"],["linea-mainnet","https://api.lineascan.build/api"],["mantle","https://explorer.mantle.xyz/api"],["mantle-mainnet","https://explorer.mantle.xyz/api"],["manta","https://pacific-explorer.manta.network/api"],["manta-mainnet","https://pacific-explorer.manta.network/api"],["metis","https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan"],["metis-mainnet","https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan"],["mode","https://explorer.mode.network/api"],["mode-mainnet","https://explorer.mode.network/api"],["moonbeam","https://api-moonbeam.moonscan.io/api"],["moonbeam-mainnet","https://api-moonbeam.moonscan.io/api"],["moonbeam-testnet","https://api-moonbase.moonscan.io/api"],["optimism","https://api-optimistic.etherscan.io/api"],["optimism-goerli","https://api-goerli-optimistic.etherscan.io/api"],["optimism-mainnet","https://api-optimistic.etherscan.io/api"],["polygon","https://api.polygonscan.com/api"],["polygon-mainnet","https://api.polygonscan.com/api"],["rarible","https://mainnet.explorer.rarichain.org/api"],["rarible-mainnet","https://mainnet.explorer.rarichain.org/api"],["scroll","https://api.scrollscan.com/api"],["scroll-mainnet","https://api.scrollscan.com/api"],["xchain","https://xchain-explorer.idex.io/api"],["xchain-mainnet","https://xchain-explorer.idex.io/api"],["xlayer","https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER"],["xlayer-mainnet","https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER"],["zkconsensys","https://api.lineascan.build/api"],["zkconsensys-mainnet","https://api.lineascan.build/api"],["zkpolygon","https://api-zkevm.polygonscan.com/api"],["zkpolygon-mainnet","https://api-zkevm.polygonscan.com/api"]]);var br=Kt(Ko()),Jt={default:br.default.white,error:br.default.red,success:br.default.green,palette:[br.default.magenta,br.default.cyan,br.default.yellow,br.default.blue,br.default.magentaBright,br.default.cyanBright,br.default.blueBright]},xd=t=>{let e=Math.min(Math.max(0,t.length-2),4),r=t.length-e,i=t.slice(0,e),s=Array.from({length:r}).fill("*").join("");return `${i}${s}`},bd=(t,e=" ")=>r=>{t.info(""),Object.entries(r).forEach(([i,s])=>{Array.isArray(s)?(t.info(`${i}:`),s.forEach(n=>{t.info(`${e} - ${br.default.bold(my(n))}`);})):t.info(`${i}:${e}${br.default.bold(my(s))}`);});},my=t=>{if(t==null)return "-";switch(typeof t){case"boolean":return t?vO:xO;default:return String(t)}},vO=Jt.success`✓`,xO=Jt.error`⚠`;var Ed=Kt(Ko()),Cd=(t,e)=>Object.entries(e!=null?e:{}).reduce((r,[i,s])=>{if(s==null)return r;let n=s.apiUrl||EO(i)||k1(i);GE__default.default(n,Jt.error`Missing scan API URL for network ${Jt.default(i)}
|
|
437
|
+
`),this.close();}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(t4.hide):this.out.write(pK(this.outputText,this.out.columns)),super.render(),this.outputText=[e4.symbol(this.done,this.aborted),QN.bold(this.msg),e4.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:QN.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(mK.line+t4.to(0)+this.outputText));}};r4.exports=g1;});var s4=$((qle,n4)=>{n4.exports={TextPrompt:rN(),SelectPrompt:oN(),TogglePrompt:cN(),DatePrompt:kN(),NumberPrompt:qN(),MultiselectPrompt:h1(),AutocompletePrompt:WN(),AutocompleteMultiselectPrompt:XN(),ConfirmPrompt:i4()};});var a4=$(o4=>{var xr=o4,gK=s4(),Pf=t=>t;function di(t,e,r={}){return new Promise((i,s)=>{let n=new gK[t](e),o=r.onAbort||Pf,a=r.onSubmit||Pf,u=r.onExit||Pf;n.on("state",e.onState||Pf),n.on("submit",l=>i(a(l))),n.on("exit",l=>i(u(l))),n.on("abort",l=>s(o(l)));})}xr.text=t=>di("TextPrompt",t);xr.password=t=>(t.style="password",xr.text(t));xr.invisible=t=>(t.style="invisible",xr.text(t));xr.number=t=>di("NumberPrompt",t);xr.date=t=>di("DatePrompt",t);xr.confirm=t=>di("ConfirmPrompt",t);xr.list=t=>{let e=t.separator||",";return di("TextPrompt",t,{onSubmit:r=>r.split(e).map(i=>i.trim())})};xr.toggle=t=>di("TogglePrompt",t);xr.select=t=>di("SelectPrompt",t);xr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(i=>i.selected).map(i=>i.value);return di("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};xr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(i=>i.selected).map(i=>i.value);return di("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var _K=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));xr.autocomplete=t=>(t.suggest=t.suggest||_K,t.choices=[].concat(t.choices||[]),di("AutocompletePrompt",t));});var c4=$((Ule,l4)=>{var _1=a4(),yK=["suggest","format","onState","validate","onRender","type"],u4=()=>{};async function wn(t=[],{onSubmit:e=u4,onCancel:r=u4}={}){let i={},s=wn._override||{};t=[].concat(t);let n,o,a,u,l,h,c=async(d,f,m=!1)=>{if(!(!m&&d.validate&&d.validate(f)!==!0))return d.format?await d.format(f,i):f};for(o of t)if({name:u,type:l}=o,typeof l=="function"&&(l=await l(n,{...i},o),o.type=l),!!l){for(let d in o){if(yK.includes(d))continue;let f=o[d];o[d]=typeof f=="function"?await f(n,{...i},h):f;}if(h=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:l}=o,_1[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(s[o.name]!==void 0&&(n=await c(o,s[o.name]),n!==void 0)){i[u]=n;continue}try{n=wn._injected?vK(wn._injected,o.initial):await _1[l](o),i[u]=n=await c(o,n,!0),a=await e(o,n,i);}catch(d){a=!await r(o,i);}if(a)return i}return i}function vK(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function xK(t){wn._injected=(wn._injected||[]).concat(t);}function bK(t){wn._override=Object.assign({},t);}l4.exports=Object.assign(wn,{prompt:wn,prompts:_1,inject:xK,override:bK});});var f4=$((Vle,h4)=>{function EK(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return !1;if(t[e]>r[e])return !0}return !1}h4.exports=EK("8.6.0")?kR():c4();});var P1=Kt(L1(),1),{program:IK,createCommand:kK,createArgument:MK,createOption:BK,CommanderError:jK,InvalidArgumentError:qK,InvalidOptionArgumentError:I1,Command:Mu,Argument:HK,Option:Pn,Help:UK}=P1.default;var k1=t=>W4.get(t),M1=t=>{try{let e=new URL(t);return !e.hostname.startsWith("api.")&&!e.hostname.startsWith("api-")?void 0:(e.hostname=e.hostname.replace(/^api[.-]/,""),e.pathname="/",e.toString())}catch(e){return}},B1=(t,e)=>{try{let r=new URL(t);return r.pathname=`/address/${e}`,r.toString()}catch(r){return}},W4=new Map([["amoy","https://amoy.polygonscan.com/api"],["amoy-mainnet","https://amoy.polygonscan.com/api"],["arbitrum","https://api.arbiscan.io/api"],["arbitrum-goerli","https://api-goerli.arbiscan.io/api"],["arbitrum-mainnet","https://api.arbiscan.io/api"],["astar","https://astar.blockscout.com/api"],["astar-mainnet","https://astar.blockscout.com/api"],["aurora","https://explorer.mainnet.aurora.dev/api"],["aurora-mainnet","https://explorer.mainnet.aurora.dev/api"],["avalanche","https://api.snowtrace.io/api"],["avalanche-mainnet","https://api.snowtrace.io/api"],["avalanche-testnet","https://api-testnet.snowtrace.io/api"],["base","https://api.basescan.org/api"],["base-goerli","https://api-goerli.basescan.org/api"],["base-mainnet","https://api.basescan.org/api"],["blast","https://api.blastscan.io/api"],["blast-mainnet","https://api.blastscan.io/api"],["bsc","https://api.bscscan.com/api"],["bsc-mainnet","https://api.bscscan.com/api"],["bsc-testnet","https://api-testnet.bscscan.com/api"],["ebi","https://explorer.ebi.xyz/api"],["ebi-mainnet","https://explorer.ebi.xyz/api"],["ethereum","https://api.etherscan.io/api"],["ethereum-goerli","https://api-goerli.etherscan.io/api"],["ethereum-mainnet","https://api.etherscan.io/api"],["etherlink","https://explorer.etherlink.com/api"],["etherlink-mainnet","https://explorer.etherlink.com/api"],["fantom","https://api.ftmscan.com/api"],["fantom-mainnet","https://api.ftmscan.com/api"],["fantom-testnet","https://api-testnet.ftmscan.com/api"],["flare","https://api.routescan.io/v2/network/mainnet/evm/14/etherscan"],["flare-mainnet","https://api.routescan.io/v2/network/mainnet/evm/14/etherscan"],["fraxtal","https://api.fraxscan.com/api"],["fraxtal-mainnet","https://api.fraxscan.com/api"],["fuji","https://api-testnet.snowtrace.io/api"],["fuji-mainnet","https://api-testnet.snowtrace.io/api"],["gnosis","https://api.gnosisscan.io/api"],["gnosis-mainnet","https://api.gnosisscan.io/api"],["goerli","https://api-goerli.etherscan.io/api"],["goerli-mainnet","https://api-goerli.etherscan.io/api"],["gravity","https://explorer.gravity.xyz/api"],["gravity-mainnet","https://explorer.gravity.xyz/api"],["iota","https://explorer.evm.iota.org/api"],["iota-mainnet","https://explorer.evm.iota.org/api"],["kava","https://kavascan.com/api"],["kava-mainnet","https://kavascan.com/api"],["kava-testnet","https://testnet.kavascan.com/api"],["klaytn","https://api-cypress.klaytnscope.com/api"],["klaytn-mainnet","https://api-cypress.klaytnscope.com/api"],["klaytn-testnet","https://api-baobab.klaytnscope.com/api"],["linea","https://api.lineascan.build/api"],["linea-mainnet","https://api.lineascan.build/api"],["mantle","https://explorer.mantle.xyz/api"],["mantle-mainnet","https://explorer.mantle.xyz/api"],["manta","https://pacific-explorer.manta.network/api"],["manta-mainnet","https://pacific-explorer.manta.network/api"],["metis","https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan"],["metis-mainnet","https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan"],["mode","https://explorer.mode.network/api"],["mode-mainnet","https://explorer.mode.network/api"],["moonbeam","https://api-moonbeam.moonscan.io/api"],["moonbeam-mainnet","https://api-moonbeam.moonscan.io/api"],["moonbeam-testnet","https://api-moonbase.moonscan.io/api"],["moonriver","https://api-moonriver.moonscan.io/api"],["moonriver-mainnet","https://api-moonriver.moonscan.io/api"],["optimism","https://api-optimistic.etherscan.io/api"],["optimism-goerli","https://api-goerli-optimistic.etherscan.io/api"],["optimism-mainnet","https://api-optimistic.etherscan.io/api"],["polygon","https://api.polygonscan.com/api"],["polygon-mainnet","https://api.polygonscan.com/api"],["rarible","https://mainnet.explorer.rarichain.org/api"],["rarible-mainnet","https://mainnet.explorer.rarichain.org/api"],["scroll","https://api.scrollscan.com/api"],["scroll-mainnet","https://api.scrollscan.com/api"],["sei","https://seitrace.com/pacific-1/api"],["sei-mainnet","https://seitrace.com/pacific-1/api"],["taiko","https://api.taikoscan.io/api"],["taiko-mainnet","https://api.taikoscan.io/api"],["xchain","https://xchain-explorer.idex.io/api"],["xchain-mainnet","https://xchain-explorer.idex.io/api"],["xlayer","https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER"],["xlayer-mainnet","https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER"],["zkatana","https://astar-zkevm.explorer.startale.com/api"],["zkatana-mainnet","https://astar-zkevm.explorer.startale.com/api"],["zkconsensys","https://api.lineascan.build/api"],["zkconsensys-mainnet","https://api.lineascan.build/api"],["zkpolygon","https://api-zkevm.polygonscan.com/api"],["zkpolygon-mainnet","https://api-zkevm.polygonscan.com/api"]]);var br=Kt(Ko()),Jt={default:br.default.white,error:br.default.red,success:br.default.green,palette:[br.default.magenta,br.default.cyan,br.default.yellow,br.default.blue,br.default.magentaBright,br.default.cyanBright,br.default.blueBright]},xd=t=>{let e=Math.min(Math.max(0,t.length-2),4),r=t.length-e,i=t.slice(0,e),s=Array.from({length:r}).fill("*").join("");return `${i}${s}`},bd=(t,e=" ")=>r=>{t.info(""),Object.entries(r).forEach(([i,s])=>{Array.isArray(s)?(t.info(`${i}:`),s.forEach(n=>{t.info(`${e} - ${br.default.bold(my(n))}`);})):t.info(`${i}:${e}${br.default.bold(my(s))}`);});},my=t=>{if(t==null)return "-";switch(typeof t){case"boolean":return t?vO:xO;default:return String(t)}},vO=Jt.success`✓`,xO=Jt.error`⚠`;var Ed=Kt(Ko()),Cd=(t,e)=>Object.entries(e!=null?e:{}).reduce((r,[i,s])=>{if(s==null)return r;let n=s.apiUrl||EO(i)||k1(i);GE__default.default(n,Jt.error`Missing scan API URL for network ${Jt.default(i)}
|
|
438
438
|
|
|
439
439
|
Please provide the API URL:
|
|
440
440
|
|
|
@@ -470,7 +470,7 @@ ${JSON.stringify(r)}`),await Ay(async()=>{let i=await jP(this.props.apiUrl,r);if
|
|
|
470
470
|
|
|
471
471
|
${JSON.stringify(i)}`),Cx(i.result))throw new Error("API Rate limit has been exceeded");return i},3,async(i,s)=>{this.emit("retry",i,s),await Xu(2e3);})}async __poll(r){for(;;){this.emit("poll",r);let i=await qP(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(Ex(i.result))return {alreadyVerified:!0};if(BP(i.result)){await Xu(1e4);continue}if(Cx(i.result)){await Xu(1e4);continue}throw new Error(`Verification failed with result "${i.result}", status ${i.status} (${i.message})`)}}},Tx=(t,e)=>new N0(t,e),BP=t=>!!(t!=null&&t.match(/Pending/gi)),Ex=t=>!!(t!=null&&t.match(/already verified/gi)),Cx=t=>!!(t!=null&&t.match(/rate/)),jP=async(t,e)=>{try{let r=await R0(t,{method:"POST",form:e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return Ax.parse(r)}catch(r){throw new Error(`Failed to submit verification request: ${r}`)}},qP=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 R0(r).json();return Ax.parse(i)}catch(i){throw new Error(`Failed to check verification status: ${i}`)}},HP=({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},Ax=Ie.object({status:Ie.coerce.number().nullish(),message:Ie.string().nullish(),result:Ie.string().nullish()});var Wa=Kt(Ko());Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()});Ie.record(Ie.string(),Ie.object({content:Ie.string()}));var UP=Ie.array(Ie.record(Ie.string(),Ie.any())),VP=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()}))}),O0=Ie.object({address:Ie.string(),abi:UP,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(VP),bytecode:Ie.string(),deployedBytecode:Ie.string()});var F0=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 Hx=Kt(Dx());var Sx="logger/5.7.0";var Rx=!1,Nx=!1,Al={debug:1,default:2,info:2,warning:3,error:4,off:5},Ox=Al.default,P0=null;function $P(){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 Fx=$P(),I0;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF";})(I0||(I0={}));var Hr;(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";})(Hr||(Hr={}));var Lx="0123456789abcdef",ke=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1});}_log(e,r){let i=e.toLowerCase();Al[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>Al[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(Nx)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+=Lx[l[c]>>4],h+=Lx[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 Hr.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 Hr.CALL_EXCEPTION:case Hr.INSUFFICIENT_FUNDS:case Hr.MISSING_NEW:case Hr.NONCE_EXPIRED:case Hr.REPLACEMENT_UNDERPRICED:case Hr.TRANSACTION_REPLACED:case Hr.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){Fx&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Fx});}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 P0||(P0=new t(Sx)),P0}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"});}Nx=!!e,Rx=!!r;}static setLogLevel(e){let r=Al[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}Ox=r;}static from(e){return new t(e)}};ke.errors=Hr;ke.levels=I0;var Px="bytes/5.7.0";var xi=new ke(Px);function kx(t){return !!t.toHexString}function ya(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return ya(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ix(t){return typeof t=="number"&&t==t&&t%1===0}function wl(t){if(t==null)return !1;if(t.constructor===Uint8Array)return !0;if(typeof t=="string"||!Ix(t.length)||t.length<0)return !1;for(let e=0;e<t.length;e++){let r=t[e];if(!Ix(r)||r<0||r>=256)return !1}return !0}function It(t,e){if(e||(e={}),typeof t=="number"){xi.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),ya(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),hr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":xi.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 ya(new Uint8Array(i))}return wl(t)?ya(new Uint8Array(t)):xi.throwArgumentError("invalid arrayify value","value",t)}function bi(t){let e=t.map(s=>It(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),ya(i)}function hr(t,e){return !(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var k0="0123456789abcdef";function St(t,e){if(e||(e={}),typeof t=="number"){xi.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=k0[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),kx(t))return t.toHexString();if(hr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":xi.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wl(t)){let r="0x";for(let i=0;i<t.length;i++){let s=t[i];r+=k0[(s&240)>>4]+k0[s&15];}return r}return xi.throwArgumentError("invalid hexlify value","value",t)}function M0(t,e,r){return typeof t!="string"?t=St(t):(!hr(t)||t.length%2)&&xi.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Mx(t){let e="0x";return t.forEach(r=>{e+=St(r).substring(2);}),e}function Dl(t,e){for(typeof t!="string"?t=St(t):hr(t)||xi.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&xi.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Bx="bignumber/5.7.0";var Sl=Hx.default.BN,Ei=new ke(Bx),B0={},jx=9007199254740991;var qx=!1,Nt=class t{constructor(e,r){e!==B0&&Ei.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 fr(Ke(this).fromTwos(e))}toTwos(e){return fr(Ke(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return fr(Ke(this).add(Ke(e)))}sub(e){return fr(Ke(this).sub(Ke(e)))}div(e){return t.from(e).isZero()&&Ir("division-by-zero","div"),fr(Ke(this).div(Ke(e)))}mul(e){return fr(Ke(this).mul(Ke(e)))}mod(e){let r=Ke(e);return r.isNeg()&&Ir("division-by-zero","mod"),fr(Ke(this).umod(r))}pow(e){let r=Ke(e);return r.isNeg()&&Ir("negative-power","pow"),fr(Ke(this).pow(r))}and(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","and"),fr(Ke(this).and(r))}or(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","or"),fr(Ke(this).or(r))}xor(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","xor"),fr(Ke(this).xor(r))}mask(e){return (this.isNegative()||e<0)&&Ir("negative-width","mask"),fr(Ke(this).maskn(e))}shl(e){return (this.isNegative()||e<0)&&Ir("negative-width","shl"),fr(Ke(this).shln(e))}shr(e){return (this.isNegative()||e<0)&&Ir("negative-width","shr"),fr(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){Ir("overflow","toNumber",this.toString());}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ei.throwError("this platform does not support BigInt",ke.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?qx||(qx=!0,Ei.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ei.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ke.errors.UNEXPECTED_ARGUMENT,{}):Ei.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(B0,va(e)):e.match(/^-?[0-9]+$/)?new t(B0,va(new Sl(e))):Ei.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ir("underflow","BigNumber.from",e),(e>=jx||e<=-jx)&&Ir("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(wl(r))return t.from(St(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"&&(hr(i)||i[0]==="-"&&hr(i.substring(1))))return t.from(i)}return Ei.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return !!(e&&e._isBigNumber)}};function va(t){if(typeof t!="string")return va(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ei.throwArgumentError("invalid hex","value",t),t=va(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 fr(t){return Nt.from(va(t))}function Ke(t){let e=Nt.from(t).toHexString();return e[0]==="-"?new Sl("-"+e.substring(3),16):new Sl(e.substring(2),16)}function Ir(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),Ei.throwError(t,ke.errors.NUMERIC_FAULT,i)}function j0(t){return new Sl(t,36).toString(16)}var Ux="properties/5.7.0";var Vx=new ke(Ux);function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1});}function xa(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 KP={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function $x(t){if(t==null||KP[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(!$x(i))return !1}return !0}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function GP(t){if($x(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>q0(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&Bt(e,r,q0(i));}return e}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function q0(t){return GP(t)}var Qn=class{constructor(e){for(let r in e)this[r]=q0(e[r]);}};var Zr="abi/5.7.0";var Ge=new ke(Zr),es={},zx={calldata:!0,memory:!0,storage:!0},WP={calldata:!0,memory:!0};function Rl(t,e){if(t==="bytes"||t==="string"){if(zx[e])return !0}else if(t==="address"){if(e==="payable")return !0}else if((t.indexOf("[")>=0||t==="tuple")&&WP[e])return !0;return (zx[e]||e==="payable")&&Ge.throwArgumentError("invalid modifier","name",e),!1}function YP(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=to(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=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(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=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(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=to(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=""):Rl(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=""):Rl(o.type,o.name)&&(o.name=""),n.type=to(n.type),n}function Nl(t,e){for(let r in e)Bt(t,r,e[r]);}var Ye=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),JP=new RegExp(/^(.*)\[([0-9]*)\]$/),dr=class t{constructor(e,r){e!==es&&Ge.throwError("use fromString",ke.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Nl(this,r);let i=this.type.match(JP);i?Nl(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):Nl(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this);}format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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!==Ye.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===Ye.full?", ":",")+")"):r+=this.type,e!==Ye.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Ye.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(es,{name:e.name||null,type:to(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(YP(e,!!r))}static isParamType(e){return !!(e!=null&&e._isParamType)}};function ba(t,e){return XP(t).map(r=>dr.fromString(r,e))}var ts=class t{constructor(e,r){e!==es&&Ge.throwError("use a static from method",ke.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Nl(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 is.fromObject(e);case"event":return ro.fromObject(e);case"constructor":return rs.fromObject(e);case"error":return Ol.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"?is.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?rs.fromString(e.trim()):e.split(" ")[0]==="error"?Ol.fromString(e.substring(5).trim()):Ge.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return !!(e&&e._isFragment)}},ro=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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!==Ye.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.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:Ea(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(dr.fromObject):[],type:"event"};return new t(es,r)}static fromString(e){let r=e.match(Ca);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:ba(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function Gx(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=Nt.from(r[1]),r[0]):t}function Wx(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 Yx(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 rs=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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===Ye.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===Ye.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=Yx(e);r.constant&&Ge.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"constructor"};e=Gx(e,r);let i=e.match(Ca);return (!i||i[1].trim()!=="constructor")&&Ge.throwArgumentError("invalid constructor string","value",e),r.inputs=ba(i[2].trim(),!1),Wx(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},is=class t extends rs{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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!==Ye.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.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=Yx(e),i={type:e.type,name:Ea(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(dr.fromObject):[],outputs:e.outputs?e.outputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"function"};e=Gx(e,r);let i=e.split(" returns ");i.length>2&&Ge.throwArgumentError("invalid function string","value",e);let s=i[0].match(Ca);if(s||Ge.throwArgumentError("invalid function signature","value",e),r.name=s[1].trim(),r.name&&Ea(r.name),r.inputs=ba(s[2],!1),Wx(s[3].trim(),r),i.length>1){let n=i[1].match(Ca);(n[1].trim()!=""||n[3].trim()!="")&&Ge.throwArgumentError("unexpected tokens","value",e),r.outputs=ba(n[2],!1);}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function Kx(t){let e=t.format();return (e==="Error(string)"||e==="Panic(uint256)")&&Ge.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Ol=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.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:Ea(e.name),inputs:e.inputs?e.inputs.map(dr.fromObject):[]};return Kx(new t(es,r))}static fromString(e){let r={type:"error"},i=e.match(Ca);return i||Ge.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&Ea(r.name),r.inputs=ba(i[2],!1),Kx(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function to(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var ZP=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ea(t){return (!t||!t.match(ZP))&&Ge.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var Ca=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function XP(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 H0=new ke(Zr);var Ht=class{constructor(e,r,i,s){this.name=e,this.type=r,this.localName=i,this.dynamic=s;}_throwError(e,r){H0.throwArgumentError(e,this.localName,r);}},ns=class{constructor(e){Bt(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e);}get data(){return Mx(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(bi(e._data))}writeBytes(e){let r=It(e),i=r.length%this.wordSize;return i&&(r=bi([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=It(Nt.from(e));return r.length>this.wordSize&&H0.throwError("value out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=bi([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);}}},Fl=class t{constructor(e,r,i,s){Bt(this,"_data",It(e)),Bt(this,"wordSize",r||32),Bt(this,"_coerceFunc",i),Bt(this,"allowLoose",s),this._offset=0;}get data(){return St(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:H0.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 Nt.from(this.readBytes(this.wordSize))}};var Zx=Kt(Jx());function ss(t){return "0x"+Zx.default.keccak_256(It(t))}var Xx="address/5.7.0";var Ta=new ke(Xx);function Qx(t){hr(t,20)||Ta.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=It(ss(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 QP=9007199254740991;function e7(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var U0={};for(let t=0;t<10;t++)U0[String(t)]=String(t);for(let t=0;t<26;t++)U0[String.fromCharCode(65+t)]=String(10+t);var eb=Math.floor(e7(QP));function t7(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>U0[i]).join("");for(;e.length>=eb;){let i=e.substring(0,eb);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 Aa(t){let e=null;if(typeof t!="string"&&Ta.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ta.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)!==t7(t)&&Ta.throwArgumentError("bad icap checksum","address",t),e=j0(t.substring(4));e.length<40;)e="0"+e;e=Qx("0x"+e);}else Ta.throwArgumentError("invalid address","address",t);return e}var Pl=class extends Ht{constructor(e){super("address","address",e,!1);}defaultValue(){return "0x0000000000000000000000000000000000000000"}encode(e,r){try{r=Aa(r);}catch(i){this._throwError(i.message,r);}return e.writeValue(r)}decode(e){return Aa(Dl(e.readValue().toHexString(),20))}};var Il=class extends Ht{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 io=new ke(Zr);function V0(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||io.throwError("cannot encode object for signature with missing names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]&&io.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 io.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&io.throwArgumentError("types/value length mismatch","tuple",r);let s=new ns(t.wordSize),n=new ns(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 $0(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 kl=class extends Ht{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)),io.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 V0(e,s,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&io.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 Il(this.coder));return e.coerce(this.name,$0(e,i))}};var Ml=class extends Ht{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 wa=class extends Ht{constructor(e,r){super(e,e,r,!0);}defaultValue(){return "0x"}encode(e,r){r=It(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Bl=class extends wa{constructor(e){super("bytes",e);}decode(e){return e.coerce(this.name,St(super.decode(e)))}};var jl=class extends Ht{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=It(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,St(e.readBytes(this.size)))}};var ql=class extends Ht{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 z0=Nt.from(-1),K0=Nt.from(0),G0=Nt.from(1);var W0=Nt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Hl=class extends Ht{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=Nt.from(r),s=W0.mask(e.wordSize*8);if(this.signed){let n=s.mask(this.size*8-1);(i.gt(n)||i.lt(n.add(G0).mul(z0)))&&this._throwError("value out-of-bounds",r);}else (i.lt(K0)||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 tb="strings/5.7.0";var rb=new ke(tb),Da;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD";})(Da||(Da={}));var pr;(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";})(pr||(pr={}));function r7(t,e,r,i,s){return rb.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function ib(t,e,r,i,s){if(t===pr.BAD_PREFIX||t===pr.UNEXPECTED_CONTINUE){let n=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)n++;return n}return t===pr.OVERRUN?r.length-e-1:0}function i7(t,e,r,i,s){return t===pr.OVERLONG?(i.push(s),0):(i.push(65533),ib(t,e,r))}var nb=Object.freeze({error:r7,ignore:ib,replace:i7});function n7(t,e){e==null&&(e=nb.error),t=It(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(pr.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(pr.BAD_PREFIX,i-1,t,r);continue}if(i-1+n>=t.length){i+=e(pr.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(pr.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|l&63,i++;}if(a!==null){if(a>1114111){i+=e(pr.OUT_OF_RANGE,i-1-n,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(pr.UTF16_SURROGATE,i-1-n,t,r,a);continue}if(a<=o){i+=e(pr.OVERLONG,i-1-n,t,r,a);continue}r.push(a);}}return r}function Sa(t,e=Da.current){e!=Da.current&&(rb.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 It(r)}function s7(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Y0(t,e){return s7(n7(t,e))}var Ul=class extends wa{constructor(e){super("string",e);}defaultValue(){return ""}encode(e,r){return super.encode(e,Sa(r))}decode(e){return Y0(super.decode(e))}};var os=class extends Ht{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 V0(e,this.coders,r)}decode(e){return e.coerce(this.name,$0(e,this.coders))}};var Vl=new ke(Zr),o7=new RegExp(/^bytes([0-9]*)$/),a7=new RegExp(/^(u?int)([0-9]*)$/),J0=class{constructor(e){Bt(this,"coerceFunc",e||null);}_getCoder(e){switch(e.baseType){case"address":return new Pl(e.name);case"bool":return new Ml(e.name);case"string":return new Ul(e.name);case"bytes":return new Bl(e.name);case"array":return new kl(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new os((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new ql(e.name)}let r=e.type.match(a7);if(r){let i=parseInt(r[2]||"256");return (i===0||i>256||i%8!==0)&&Vl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Hl(i/8,r[1]==="int",e.name)}if(r=e.type.match(o7),r){let i=parseInt(r[1]);return (i===0||i>32)&&Vl.throwArgumentError("invalid bytes length","param",e),new jl(i,e.name)}return Vl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Fl(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new ns(this._getWordSize())}getDefaultValue(e){let r=e.map(s=>this._getCoder(dr.from(s)));return new os(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Vl.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(dr.from(o))),s=new os(i,"_"),n=this._getWriter();return s.encode(n,r),n.data}decode(e,r,i){let s=e.map(o=>this._getCoder(dr.from(o)));return new os(s,"_").decode(this._getReader(It(r),i))}},sb=new J0;function no(t){return ss(Sa(t))}var Ot=new ke(Zr);var $l=class extends Qn{},zl=class extends Qn{},Z0=class extends Qn{},Ra=class extends Qn{static isIndexed(e){return !!(e&&e._isIndexed)}},u7={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function ob(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var Na=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Bt(this,"fragments",r.map(i=>ts.from(i)).filter(i=>i!=null)),Bt(this,"_abiCoder",xa(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){Ot.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]){Ot.warn("duplicate definition - "+n);return}s[n]=i;}),this.deploy||Bt(this,"deploy",rs.from({payable:!1,type:"constructor"})),Bt(this,"_isInterface",!0);}format(e){e||(e=Ye.full),e===Ye.sighash&&Ot.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===Ye.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return sb}static getAddress(e){return Aa(e)}static getSighash(e){return M0(no(e.format()),0,4)}static getEventTopic(e){return no(e.format())}getFunction(e){if(hr(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];Ot.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?Ot.throwArgumentError("no matching function","name",i):s.length>1&&Ot.throwArgumentError("multiple matching functions","name",i),this.functions[s[0]]}let r=this.functions[is.fromString(e).format()];return r||Ot.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(hr(e)){let i=e.toLowerCase();for(let s in this.events)if(i===this.getEventTopic(s))return this.events[s];Ot.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?Ot.throwArgumentError("no matching event","name",i):s.length>1&&Ot.throwArgumentError("multiple matching events","name",i),this.events[s[0]]}let r=this.events[ro.fromString(e).format()];return r||Ot.throwArgumentError("no matching event","signature",e),r}getError(e){if(hr(e)){let i=xa(this.constructor,"getSighash");for(let s in this.errors){let n=this.errors[s];if(e===i(n))return this.errors[s]}Ot.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?Ot.throwArgumentError("no matching error","name",i):s.length>1&&Ot.throwArgumentError("multiple matching errors","name",i),this.errors[s[0]]}let r=this.errors[is.fromString(e).format()];return r||Ot.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 xa(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),xa(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=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match error ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match function ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(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=St(i.slice(0,4)),h=u7[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 Ot.throwError("call revert exception"+n,ke.errors.CALL_EXCEPTION,{method:e.format(),data:St(r),errorArgs:o,errorName:a,errorSignature:u,reason:s})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Ot.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"?no(o):n.type==="bytes"?ss(St(o)):(n.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),n.type.match(/^u?int/)&&(o=Nt.from(o).toHexString()),n.type==="address"&&this._abiCoder.encode(["address"],[o]),Dl(St(o),32));for(r.forEach((n,o)=>{let a=e.inputs[o];if(!a.indexed){n!=null&&Ot.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"?Ot.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&&Ot.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(no(u));else if(o.type==="bytes")i.push(ss(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);(!hr(i[0],32)||i[0].toLowerCase()!==d)&&Ot.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(dr.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,bi(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 Ra({_isIndexed:!0,hash:null});else if(o[f])l[f]=new Ra({_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 ob(`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 ob(`index ${d}`,f)}});}return Object.freeze(l)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new zl({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Nt.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return !r||r.anonymous?null:new $l({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=St(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new Z0({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 Cc=Kt(KE()),Zp=(t,e)=>e==null||e.length===0?void 0:new Na(t).encodeDeploy(e).slice(2),WE=t=>{try{let e=Cc.parse(t),r;return Cc.visit(e,{FunctionDefinition:s=>{s.isConstructor&&(r=s);}}),GE__default.default(r!=null,"Could not find constructor definition"),[{type:"constructor",inputs:r.parameters.map(({typeName:s},n)=>(GE__default.default(s!=null,`Missing a type definition for constructor parameter at position ${n}`),{type:YE(s)}))}]}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}},YE=t=>{switch(t.type){case"ElementaryTypeName":return t.name;case"ArrayTypeName":return `${YE(t.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${t.type}`)}};var Xp=t=>{var e;return {deployments:(e=t==null?void 0:t.deployments)!=null?e:SI__default.default.resolve(process.cwd(),"deployments")}},JE=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 XE=t=>{try{return fs.lstatSync(t).isDirectory()}catch(e){return !1}},QE=t=>{try{return fs.lstatSync(t).isFile()}catch(e){return !1}};var r2=async(t,e)=>{let r=Cd(e,t.networks),i=Xp(t.paths),s=bd(e),n=n2(e),o=s2(s),a=t.contracts.flatMap(l=>{var te;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=`${SI.basename(f,".json")}.json`,v=SI.resolve(i.deployments,c,g);if(!QE(v))return e.error(Jt.error`Deployment file ${v} does not exist or is not a file`),[];let x=ge(v),_=O0.safeParse(x);if(!_.success)return e.error(Jt.error`No network configured for contract ${d} on network ${c}`),[];let E=_.data,b=SI.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=WE(w.content),F=Zp(N,l.constructorArguments),V=F0(E.metadata),Z={apiUrl:m.apiUrl,apiKey:m.apiKey,address:h,contractName:`${d}:${b}`,constructorArguments:F,licenseType:D,compilerVersion:E.metadata.compiler.version,sourceCode:JSON.stringify(V),evmVersion:E.metadata.settings.evmVersion,optimizerRuns:(te=E.metadata.settings.optimizer)==null?void 0:te.runs};return s({Contract:d,Network:c,Address:Z.address,License:Z.licenseType,Arguments:l.constructorArguments?JSON.stringify(l.constructorArguments):void 0,Sources:Object.keys(E.metadata.sources),"Scan URL":Z.apiUrl,"Scan API Key":Z.apiKey?xd(Z.apiKey):void 0}),[{networkName:c,networkConfig:m,submitProps:Z}]});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},i2=async(t,e)=>{let r=JE(t.filter),i=Cd(e,t.networks),s=Xp(t.paths),n=bd(e),o=n2(e),a=s2(n);if(!XE(s.deployments))throw new Error(`Path ${s.deployments} is not a directory`);let u=new Set(fs.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=SI.resolve(s.deployments,d);return fs.readdirSync(m).filter(v=>v.endsWith(".json")).flatMap(v=>{e.info(`Inspecting deployment file ${v} on network ${d}`);let x=SI.resolve(m,v),_=ge(x),E=O0.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 V=b.metadata.sources[D];if(V==null)return e.error(Jt.error`Could not find source for ${N} (${D})`),[];let Z=Ad(V.content),te=Zp(b.abi,b.args),ae=F0(b.metadata),k={apiUrl:f.apiUrl,apiKey:f.apiKey,address:b.address,contractName:`${D}:${N}`,constructorArguments:te,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},n2=t=>e=>e.map(async(r,i)=>{let{submitProps:s}=r,n=Jt.palette[i%Jt.palette.length],o=`[${i+1}/${e.length}]`,a=Wa.default.bold(s.contractName),u=Wa.default.bold(r.networkName);t.info(n`Verifying contract ${a} for network ${u} ${o}`);try{let l=Tx(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}}}),s2=t=>({artifact:e,response:r,error:i})=>{let s=Wa.default.bold(e.submitProps.contractName),n=Wa.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 Os=Kt(f3(),1);Kt(kD(),1);var qo=Kt(Ko(),1);Kt(f4(),1);var p4=(t=>(t.error="error",t.warn="warn",t.info="info",t.http="http",t.verbose="verbose",t.debug="debug",t.silly="silly",t))(p4||{});Ie.nativeEnum(p4);var TK="info";var y1=(t=TK,e=Os.format.cli())=>(0, Os.createLogger)({level:t,format:e,transports:[new Os.transports.Console]});(0, Os.format)((t,{label:e})=>({...t,message:`${e?`[${e}] `:""}${t.message}`}));({TRUE:qo.default.rgb(0,153,0),FALSE:qo.default.rgb(255,0,0),NOT_APPLICABLE:qo.default.rgb(255,128,0),DEFAULT_KEY:qo.default.rgb(255,255,255),DEFAULT_VALUE:qo.default.rgb(167,125,255)});var m4="1.1.25";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=>{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=y1(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 r2(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=y1(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},filter:t.contracts};try{await i2(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(Ex(i.result))return {alreadyVerified:!0};if(BP(i.result)){await Xu(1e4);continue}if(Cx(i.result)){await Xu(1e4);continue}throw new Error(`Verification failed with result "${i.result}", status ${i.status} (${i.message})`)}}},Tx=(t,e)=>new N0(t,e),BP=t=>!!(t!=null&&t.match(/Pending/gi)),Ex=t=>!!(t!=null&&t.match(/already verified/gi)),Cx=t=>!!(t!=null&&t.match(/rate/)),jP=async(t,e)=>{try{let r=await R0(t,{method:"POST",form:e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return Ax.parse(r)}catch(r){throw new Error(`Failed to submit verification request: ${r}`)}},qP=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 R0(r).json();return Ax.parse(i)}catch(i){throw new Error(`Failed to check verification status: ${i}`)}},HP=({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},Ax=Ie.object({status:Ie.coerce.number().nullish(),message:Ie.string().nullish(),result:Ie.string().nullish()});var Wa=Kt(Ko());Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()});Ie.record(Ie.string(),Ie.object({content:Ie.string()}));var UP=Ie.array(Ie.record(Ie.string(),Ie.any())),VP=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()}))}),O0=Ie.object({address:Ie.string(),abi:UP,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(VP),bytecode:Ie.string(),deployedBytecode:Ie.string()});var F0=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 Hx=Kt(Dx());var Sx="logger/5.7.0";var Rx=!1,Nx=!1,Al={debug:1,default:2,info:2,warning:3,error:4,off:5},Ox=Al.default,P0=null;function $P(){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 Fx=$P(),I0;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF";})(I0||(I0={}));var Hr;(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";})(Hr||(Hr={}));var Lx="0123456789abcdef",ke=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1});}_log(e,r){let i=e.toLowerCase();Al[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>Al[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(Nx)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+=Lx[l[c]>>4],h+=Lx[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 Hr.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 Hr.CALL_EXCEPTION:case Hr.INSUFFICIENT_FUNDS:case Hr.MISSING_NEW:case Hr.NONCE_EXPIRED:case Hr.REPLACEMENT_UNDERPRICED:case Hr.TRANSACTION_REPLACED:case Hr.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){Fx&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Fx});}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 P0||(P0=new t(Sx)),P0}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"});}Nx=!!e,Rx=!!r;}static setLogLevel(e){let r=Al[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}Ox=r;}static from(e){return new t(e)}};ke.errors=Hr;ke.levels=I0;var Px="bytes/5.7.0";var xi=new ke(Px);function kx(t){return !!t.toHexString}function ya(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return ya(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ix(t){return typeof t=="number"&&t==t&&t%1===0}function wl(t){if(t==null)return !1;if(t.constructor===Uint8Array)return !0;if(typeof t=="string"||!Ix(t.length)||t.length<0)return !1;for(let e=0;e<t.length;e++){let r=t[e];if(!Ix(r)||r<0||r>=256)return !1}return !0}function It(t,e){if(e||(e={}),typeof t=="number"){xi.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),ya(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),hr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":xi.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 ya(new Uint8Array(i))}return wl(t)?ya(new Uint8Array(t)):xi.throwArgumentError("invalid arrayify value","value",t)}function bi(t){let e=t.map(s=>It(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),ya(i)}function hr(t,e){return !(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var k0="0123456789abcdef";function St(t,e){if(e||(e={}),typeof t=="number"){xi.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=k0[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),kx(t))return t.toHexString();if(hr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":xi.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wl(t)){let r="0x";for(let i=0;i<t.length;i++){let s=t[i];r+=k0[(s&240)>>4]+k0[s&15];}return r}return xi.throwArgumentError("invalid hexlify value","value",t)}function M0(t,e,r){return typeof t!="string"?t=St(t):(!hr(t)||t.length%2)&&xi.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Mx(t){let e="0x";return t.forEach(r=>{e+=St(r).substring(2);}),e}function Dl(t,e){for(typeof t!="string"?t=St(t):hr(t)||xi.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&xi.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Bx="bignumber/5.7.0";var Sl=Hx.default.BN,Ei=new ke(Bx),B0={},jx=9007199254740991;var qx=!1,Nt=class t{constructor(e,r){e!==B0&&Ei.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 fr(Ke(this).fromTwos(e))}toTwos(e){return fr(Ke(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return fr(Ke(this).add(Ke(e)))}sub(e){return fr(Ke(this).sub(Ke(e)))}div(e){return t.from(e).isZero()&&Ir("division-by-zero","div"),fr(Ke(this).div(Ke(e)))}mul(e){return fr(Ke(this).mul(Ke(e)))}mod(e){let r=Ke(e);return r.isNeg()&&Ir("division-by-zero","mod"),fr(Ke(this).umod(r))}pow(e){let r=Ke(e);return r.isNeg()&&Ir("negative-power","pow"),fr(Ke(this).pow(r))}and(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","and"),fr(Ke(this).and(r))}or(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","or"),fr(Ke(this).or(r))}xor(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","xor"),fr(Ke(this).xor(r))}mask(e){return (this.isNegative()||e<0)&&Ir("negative-width","mask"),fr(Ke(this).maskn(e))}shl(e){return (this.isNegative()||e<0)&&Ir("negative-width","shl"),fr(Ke(this).shln(e))}shr(e){return (this.isNegative()||e<0)&&Ir("negative-width","shr"),fr(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){Ir("overflow","toNumber",this.toString());}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ei.throwError("this platform does not support BigInt",ke.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?qx||(qx=!0,Ei.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ei.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ke.errors.UNEXPECTED_ARGUMENT,{}):Ei.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(B0,va(e)):e.match(/^-?[0-9]+$/)?new t(B0,va(new Sl(e))):Ei.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ir("underflow","BigNumber.from",e),(e>=jx||e<=-jx)&&Ir("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(wl(r))return t.from(St(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"&&(hr(i)||i[0]==="-"&&hr(i.substring(1))))return t.from(i)}return Ei.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return !!(e&&e._isBigNumber)}};function va(t){if(typeof t!="string")return va(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ei.throwArgumentError("invalid hex","value",t),t=va(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 fr(t){return Nt.from(va(t))}function Ke(t){let e=Nt.from(t).toHexString();return e[0]==="-"?new Sl("-"+e.substring(3),16):new Sl(e.substring(2),16)}function Ir(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),Ei.throwError(t,ke.errors.NUMERIC_FAULT,i)}function j0(t){return new Sl(t,36).toString(16)}var Ux="properties/5.7.0";var Vx=new ke(Ux);function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1});}function xa(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 KP={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function $x(t){if(t==null||KP[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(!$x(i))return !1}return !0}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function GP(t){if($x(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>q0(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&Bt(e,r,q0(i));}return e}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function q0(t){return GP(t)}var Qn=class{constructor(e){for(let r in e)this[r]=q0(e[r]);}};var Zr="abi/5.7.0";var Ge=new ke(Zr),es={},zx={calldata:!0,memory:!0,storage:!0},WP={calldata:!0,memory:!0};function Rl(t,e){if(t==="bytes"||t==="string"){if(zx[e])return !0}else if(t==="address"){if(e==="payable")return !0}else if((t.indexOf("[")>=0||t==="tuple")&&WP[e])return !0;return (zx[e]||e==="payable")&&Ge.throwArgumentError("invalid modifier","name",e),!1}function YP(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=to(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=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(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=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(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=to(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=""):Rl(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=""):Rl(o.type,o.name)&&(o.name=""),n.type=to(n.type),n}function Nl(t,e){for(let r in e)Bt(t,r,e[r]);}var Ye=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),JP=new RegExp(/^(.*)\[([0-9]*)\]$/),dr=class t{constructor(e,r){e!==es&&Ge.throwError("use fromString",ke.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Nl(this,r);let i=this.type.match(JP);i?Nl(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):Nl(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this);}format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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!==Ye.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===Ye.full?", ":",")+")"):r+=this.type,e!==Ye.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Ye.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(es,{name:e.name||null,type:to(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(YP(e,!!r))}static isParamType(e){return !!(e!=null&&e._isParamType)}};function ba(t,e){return XP(t).map(r=>dr.fromString(r,e))}var ts=class t{constructor(e,r){e!==es&&Ge.throwError("use a static from method",ke.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Nl(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 is.fromObject(e);case"event":return ro.fromObject(e);case"constructor":return rs.fromObject(e);case"error":return Ol.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"?is.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?rs.fromString(e.trim()):e.split(" ")[0]==="error"?Ol.fromString(e.substring(5).trim()):Ge.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return !!(e&&e._isFragment)}},ro=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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!==Ye.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.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:Ea(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(dr.fromObject):[],type:"event"};return new t(es,r)}static fromString(e){let r=e.match(Ca);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:ba(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function Gx(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=Nt.from(r[1]),r[0]):t}function Wx(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 Yx(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 rs=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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===Ye.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===Ye.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=Yx(e);r.constant&&Ge.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"constructor"};e=Gx(e,r);let i=e.match(Ca);return (!i||i[1].trim()!=="constructor")&&Ge.throwArgumentError("invalid constructor string","value",e),r.inputs=ba(i[2].trim(),!1),Wx(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},is=class t extends rs{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.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!==Ye.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.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=Yx(e),i={type:e.type,name:Ea(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(dr.fromObject):[],outputs:e.outputs?e.outputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"function"};e=Gx(e,r);let i=e.split(" returns ");i.length>2&&Ge.throwArgumentError("invalid function string","value",e);let s=i[0].match(Ca);if(s||Ge.throwArgumentError("invalid function signature","value",e),r.name=s[1].trim(),r.name&&Ea(r.name),r.inputs=ba(s[2],!1),Wx(s[3].trim(),r),i.length>1){let n=i[1].match(Ca);(n[1].trim()!=""||n[3].trim()!="")&&Ge.throwArgumentError("unexpected tokens","value",e),r.outputs=ba(n[2],!1);}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function Kx(t){let e=t.format();return (e==="Error(string)"||e==="Panic(uint256)")&&Ge.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Ol=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.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:Ea(e.name),inputs:e.inputs?e.inputs.map(dr.fromObject):[]};return Kx(new t(es,r))}static fromString(e){let r={type:"error"},i=e.match(Ca);return i||Ge.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&Ea(r.name),r.inputs=ba(i[2],!1),Kx(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function to(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var ZP=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ea(t){return (!t||!t.match(ZP))&&Ge.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var Ca=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function XP(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 H0=new ke(Zr);var Ht=class{constructor(e,r,i,s){this.name=e,this.type=r,this.localName=i,this.dynamic=s;}_throwError(e,r){H0.throwArgumentError(e,this.localName,r);}},ns=class{constructor(e){Bt(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e);}get data(){return Mx(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(bi(e._data))}writeBytes(e){let r=It(e),i=r.length%this.wordSize;return i&&(r=bi([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=It(Nt.from(e));return r.length>this.wordSize&&H0.throwError("value out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=bi([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);}}},Fl=class t{constructor(e,r,i,s){Bt(this,"_data",It(e)),Bt(this,"wordSize",r||32),Bt(this,"_coerceFunc",i),Bt(this,"allowLoose",s),this._offset=0;}get data(){return St(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:H0.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 Nt.from(this.readBytes(this.wordSize))}};var Zx=Kt(Jx());function ss(t){return "0x"+Zx.default.keccak_256(It(t))}var Xx="address/5.7.0";var Ta=new ke(Xx);function Qx(t){hr(t,20)||Ta.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=It(ss(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 QP=9007199254740991;function e7(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var U0={};for(let t=0;t<10;t++)U0[String(t)]=String(t);for(let t=0;t<26;t++)U0[String.fromCharCode(65+t)]=String(10+t);var eb=Math.floor(e7(QP));function t7(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>U0[i]).join("");for(;e.length>=eb;){let i=e.substring(0,eb);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 Aa(t){let e=null;if(typeof t!="string"&&Ta.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ta.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)!==t7(t)&&Ta.throwArgumentError("bad icap checksum","address",t),e=j0(t.substring(4));e.length<40;)e="0"+e;e=Qx("0x"+e);}else Ta.throwArgumentError("invalid address","address",t);return e}var Pl=class extends Ht{constructor(e){super("address","address",e,!1);}defaultValue(){return "0x0000000000000000000000000000000000000000"}encode(e,r){try{r=Aa(r);}catch(i){this._throwError(i.message,r);}return e.writeValue(r)}decode(e){return Aa(Dl(e.readValue().toHexString(),20))}};var Il=class extends Ht{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 io=new ke(Zr);function V0(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||io.throwError("cannot encode object for signature with missing names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]&&io.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 io.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&io.throwArgumentError("types/value length mismatch","tuple",r);let s=new ns(t.wordSize),n=new ns(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 $0(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 kl=class extends Ht{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)),io.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 V0(e,s,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&io.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 Il(this.coder));return e.coerce(this.name,$0(e,i))}};var Ml=class extends Ht{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 wa=class extends Ht{constructor(e,r){super(e,e,r,!0);}defaultValue(){return "0x"}encode(e,r){r=It(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Bl=class extends wa{constructor(e){super("bytes",e);}decode(e){return e.coerce(this.name,St(super.decode(e)))}};var jl=class extends Ht{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=It(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,St(e.readBytes(this.size)))}};var ql=class extends Ht{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 z0=Nt.from(-1),K0=Nt.from(0),G0=Nt.from(1);var W0=Nt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Hl=class extends Ht{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=Nt.from(r),s=W0.mask(e.wordSize*8);if(this.signed){let n=s.mask(this.size*8-1);(i.gt(n)||i.lt(n.add(G0).mul(z0)))&&this._throwError("value out-of-bounds",r);}else (i.lt(K0)||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 tb="strings/5.7.0";var rb=new ke(tb),Da;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD";})(Da||(Da={}));var pr;(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";})(pr||(pr={}));function r7(t,e,r,i,s){return rb.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function ib(t,e,r,i,s){if(t===pr.BAD_PREFIX||t===pr.UNEXPECTED_CONTINUE){let n=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)n++;return n}return t===pr.OVERRUN?r.length-e-1:0}function i7(t,e,r,i,s){return t===pr.OVERLONG?(i.push(s),0):(i.push(65533),ib(t,e,r))}var nb=Object.freeze({error:r7,ignore:ib,replace:i7});function n7(t,e){e==null&&(e=nb.error),t=It(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(pr.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(pr.BAD_PREFIX,i-1,t,r);continue}if(i-1+n>=t.length){i+=e(pr.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(pr.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|l&63,i++;}if(a!==null){if(a>1114111){i+=e(pr.OUT_OF_RANGE,i-1-n,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(pr.UTF16_SURROGATE,i-1-n,t,r,a);continue}if(a<=o){i+=e(pr.OVERLONG,i-1-n,t,r,a);continue}r.push(a);}}return r}function Sa(t,e=Da.current){e!=Da.current&&(rb.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 It(r)}function s7(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Y0(t,e){return s7(n7(t,e))}var Ul=class extends wa{constructor(e){super("string",e);}defaultValue(){return ""}encode(e,r){return super.encode(e,Sa(r))}decode(e){return Y0(super.decode(e))}};var os=class extends Ht{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 V0(e,this.coders,r)}decode(e){return e.coerce(this.name,$0(e,this.coders))}};var Vl=new ke(Zr),o7=new RegExp(/^bytes([0-9]*)$/),a7=new RegExp(/^(u?int)([0-9]*)$/),J0=class{constructor(e){Bt(this,"coerceFunc",e||null);}_getCoder(e){switch(e.baseType){case"address":return new Pl(e.name);case"bool":return new Ml(e.name);case"string":return new Ul(e.name);case"bytes":return new Bl(e.name);case"array":return new kl(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new os((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new ql(e.name)}let r=e.type.match(a7);if(r){let i=parseInt(r[2]||"256");return (i===0||i>256||i%8!==0)&&Vl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Hl(i/8,r[1]==="int",e.name)}if(r=e.type.match(o7),r){let i=parseInt(r[1]);return (i===0||i>32)&&Vl.throwArgumentError("invalid bytes length","param",e),new jl(i,e.name)}return Vl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Fl(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new ns(this._getWordSize())}getDefaultValue(e){let r=e.map(s=>this._getCoder(dr.from(s)));return new os(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Vl.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(dr.from(o))),s=new os(i,"_"),n=this._getWriter();return s.encode(n,r),n.data}decode(e,r,i){let s=e.map(o=>this._getCoder(dr.from(o)));return new os(s,"_").decode(this._getReader(It(r),i))}},sb=new J0;function no(t){return ss(Sa(t))}var Ot=new ke(Zr);var $l=class extends Qn{},zl=class extends Qn{},Z0=class extends Qn{},Ra=class extends Qn{static isIndexed(e){return !!(e&&e._isIndexed)}},u7={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function ob(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var Na=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Bt(this,"fragments",r.map(i=>ts.from(i)).filter(i=>i!=null)),Bt(this,"_abiCoder",xa(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){Ot.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]){Ot.warn("duplicate definition - "+n);return}s[n]=i;}),this.deploy||Bt(this,"deploy",rs.from({payable:!1,type:"constructor"})),Bt(this,"_isInterface",!0);}format(e){e||(e=Ye.full),e===Ye.sighash&&Ot.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===Ye.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return sb}static getAddress(e){return Aa(e)}static getSighash(e){return M0(no(e.format()),0,4)}static getEventTopic(e){return no(e.format())}getFunction(e){if(hr(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];Ot.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?Ot.throwArgumentError("no matching function","name",i):s.length>1&&Ot.throwArgumentError("multiple matching functions","name",i),this.functions[s[0]]}let r=this.functions[is.fromString(e).format()];return r||Ot.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(hr(e)){let i=e.toLowerCase();for(let s in this.events)if(i===this.getEventTopic(s))return this.events[s];Ot.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?Ot.throwArgumentError("no matching event","name",i):s.length>1&&Ot.throwArgumentError("multiple matching events","name",i),this.events[s[0]]}let r=this.events[ro.fromString(e).format()];return r||Ot.throwArgumentError("no matching event","signature",e),r}getError(e){if(hr(e)){let i=xa(this.constructor,"getSighash");for(let s in this.errors){let n=this.errors[s];if(e===i(n))return this.errors[s]}Ot.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?Ot.throwArgumentError("no matching error","name",i):s.length>1&&Ot.throwArgumentError("multiple matching errors","name",i),this.errors[s[0]]}let r=this.errors[is.fromString(e).format()];return r||Ot.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 xa(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),xa(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=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match error ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match function ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(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=St(i.slice(0,4)),h=u7[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 Ot.throwError("call revert exception"+n,ke.errors.CALL_EXCEPTION,{method:e.format(),data:St(r),errorArgs:o,errorName:a,errorSignature:u,reason:s})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Ot.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"?no(o):n.type==="bytes"?ss(St(o)):(n.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),n.type.match(/^u?int/)&&(o=Nt.from(o).toHexString()),n.type==="address"&&this._abiCoder.encode(["address"],[o]),Dl(St(o),32));for(r.forEach((n,o)=>{let a=e.inputs[o];if(!a.indexed){n!=null&&Ot.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"?Ot.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&&Ot.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(no(u));else if(o.type==="bytes")i.push(ss(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);(!hr(i[0],32)||i[0].toLowerCase()!==d)&&Ot.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(dr.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,bi(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 Ra({_isIndexed:!0,hash:null});else if(o[f])l[f]=new Ra({_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 ob(`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 ob(`index ${d}`,f)}});}return Object.freeze(l)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new zl({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Nt.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return !r||r.anonymous?null:new $l({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=St(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new Z0({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 Cc=Kt(KE()),Zp=(t,e)=>e==null||e.length===0?void 0:new Na(t).encodeDeploy(e).slice(2),WE=t=>{try{let e=Cc.parse(t),r;return Cc.visit(e,{FunctionDefinition:s=>{s.isConstructor&&(r=s);}}),GE__default.default(r!=null,"Could not find constructor definition"),[{type:"constructor",inputs:r.parameters.map(({typeName:s},n)=>(GE__default.default(s!=null,`Missing a type definition for constructor parameter at position ${n}`),{type:YE(s)}))}]}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}},YE=t=>{switch(t.type){case"ElementaryTypeName":return t.name;case"ArrayTypeName":return `${YE(t.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${t.type}`)}};var Xp=t=>{var e;return {deployments:(e=t==null?void 0:t.deployments)!=null?e:SI__default.default.resolve(process.cwd(),"deployments")}},JE=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 XE=t=>{try{return fs.lstatSync(t).isDirectory()}catch(e){return !1}},QE=t=>{try{return fs.lstatSync(t).isFile()}catch(e){return !1}};var r2=async(t,e)=>{let r=Cd(e,t.networks),i=Xp(t.paths),s=bd(e),n=n2(e),o=s2(s),a=t.contracts.flatMap(l=>{var te;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=`${SI.basename(f,".json")}.json`,v=SI.resolve(i.deployments,c,g);if(!QE(v))return e.error(Jt.error`Deployment file ${v} does not exist or is not a file`),[];let x=ge(v),_=O0.safeParse(x);if(!_.success)return e.error(Jt.error`No network configured for contract ${d} on network ${c}`),[];let E=_.data,b=SI.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=WE(w.content),F=Zp(N,l.constructorArguments),V=F0(E.metadata),Z={apiUrl:m.apiUrl,apiKey:m.apiKey,address:h,contractName:`${d}:${b}`,constructorArguments:F,licenseType:D,compilerVersion:E.metadata.compiler.version,sourceCode:JSON.stringify(V),evmVersion:E.metadata.settings.evmVersion,optimizerRuns:(te=E.metadata.settings.optimizer)==null?void 0:te.runs};return s({Contract:d,Network:c,Address:Z.address,License:Z.licenseType,Arguments:l.constructorArguments?JSON.stringify(l.constructorArguments):void 0,Sources:Object.keys(E.metadata.sources),"Scan URL":Z.apiUrl,"Scan API Key":Z.apiKey?xd(Z.apiKey):void 0}),[{networkName:c,networkConfig:m,submitProps:Z}]});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},i2=async(t,e)=>{let r=JE(t.filter),i=Cd(e,t.networks),s=Xp(t.paths),n=bd(e),o=n2(e),a=s2(n);if(!XE(s.deployments))throw new Error(`Path ${s.deployments} is not a directory`);let u=new Set(fs.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=SI.resolve(s.deployments,d);return fs.readdirSync(m).filter(v=>v.endsWith(".json")).flatMap(v=>{e.info(`Inspecting deployment file ${v} on network ${d}`);let x=SI.resolve(m,v),_=ge(x),E=O0.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 V=b.metadata.sources[D];if(V==null)return e.error(Jt.error`Could not find source for ${N} (${D})`),[];let Z=Ad(V.content),te=Zp(b.abi,b.args),ae=F0(b.metadata),k={apiUrl:f.apiUrl,apiKey:f.apiKey,address:b.address,contractName:`${D}:${N}`,constructorArguments:te,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},n2=t=>e=>e.map(async(r,i)=>{let{submitProps:s}=r,n=Jt.palette[i%Jt.palette.length],o=`[${i+1}/${e.length}]`,a=Wa.default.bold(s.contractName),u=Wa.default.bold(r.networkName);t.info(n`Verifying contract ${a} for network ${u} ${o}`);try{let l=Tx(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}}}),s2=t=>({artifact:e,response:r,error:i})=>{let s=Wa.default.bold(e.submitProps.contractName),n=Wa.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 Os=Kt(f3(),1);Kt(kD(),1);var qo=Kt(Ko(),1);Kt(f4(),1);var p4=(t=>(t.error="error",t.warn="warn",t.info="info",t.http="http",t.verbose="verbose",t.debug="debug",t.silly="silly",t))(p4||{});Ie.nativeEnum(p4);var TK="info";var y1=(t=TK,e=Os.format.cli())=>(0, Os.createLogger)({level:t,format:e,transports:[new Os.transports.Console]});(0, Os.format)((t,{label:e})=>({...t,message:`${e?`[${e}] `:""}${t.message}`}));({TRUE:qo.default.rgb(0,153,0),FALSE:qo.default.rgb(255,0,0),NOT_APPLICABLE:qo.default.rgb(255,128,0),DEFAULT_KEY:qo.default.rgb(255,255,255),DEFAULT_VALUE:qo.default.rgb(167,125,255)});var m4="1.1.27";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=>{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=y1(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 r2(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=y1(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},filter:t.contracts};try{await i2(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
|
js-sha3/src/sha3.js:
|
package/dist/index.js
CHANGED
|
@@ -44542,6 +44542,10 @@ var DEFAULT_SCAN_API_URLS = /* @__PURE__ */ new Map([
|
|
|
44542
44542
|
["arbitrum", "https://api.arbiscan.io/api"],
|
|
44543
44543
|
["arbitrum-goerli", "https://api-goerli.arbiscan.io/api"],
|
|
44544
44544
|
["arbitrum-mainnet", "https://api.arbiscan.io/api"],
|
|
44545
|
+
["astar", "https://astar.blockscout.com/api"],
|
|
44546
|
+
["astar-mainnet", "https://astar.blockscout.com/api"],
|
|
44547
|
+
["aurora", "https://explorer.mainnet.aurora.dev/api"],
|
|
44548
|
+
["aurora-mainnet", "https://explorer.mainnet.aurora.dev/api"],
|
|
44545
44549
|
["avalanche", "https://api.snowtrace.io/api"],
|
|
44546
44550
|
["avalanche-mainnet", "https://api.snowtrace.io/api"],
|
|
44547
44551
|
["avalanche-testnet", "https://api-testnet.snowtrace.io/api"],
|
|
@@ -44553,6 +44557,8 @@ var DEFAULT_SCAN_API_URLS = /* @__PURE__ */ new Map([
|
|
|
44553
44557
|
["bsc", "https://api.bscscan.com/api"],
|
|
44554
44558
|
["bsc-mainnet", "https://api.bscscan.com/api"],
|
|
44555
44559
|
["bsc-testnet", "https://api-testnet.bscscan.com/api"],
|
|
44560
|
+
["ebi", "https://explorer.ebi.xyz/api"],
|
|
44561
|
+
["ebi-mainnet", "https://explorer.ebi.xyz/api"],
|
|
44556
44562
|
["ethereum", "https://api.etherscan.io/api"],
|
|
44557
44563
|
["ethereum-goerli", "https://api-goerli.etherscan.io/api"],
|
|
44558
44564
|
["ethereum-mainnet", "https://api.etherscan.io/api"],
|
|
@@ -44573,6 +44579,8 @@ var DEFAULT_SCAN_API_URLS = /* @__PURE__ */ new Map([
|
|
|
44573
44579
|
["goerli-mainnet", "https://api-goerli.etherscan.io/api"],
|
|
44574
44580
|
["gravity", "https://explorer.gravity.xyz/api"],
|
|
44575
44581
|
["gravity-mainnet", "https://explorer.gravity.xyz/api"],
|
|
44582
|
+
["iota", "https://explorer.evm.iota.org/api"],
|
|
44583
|
+
["iota-mainnet", "https://explorer.evm.iota.org/api"],
|
|
44576
44584
|
["kava", "https://kavascan.com/api"],
|
|
44577
44585
|
["kava-mainnet", "https://kavascan.com/api"],
|
|
44578
44586
|
["kava-testnet", "https://testnet.kavascan.com/api"],
|
|
@@ -44592,6 +44600,8 @@ var DEFAULT_SCAN_API_URLS = /* @__PURE__ */ new Map([
|
|
|
44592
44600
|
["moonbeam", "https://api-moonbeam.moonscan.io/api"],
|
|
44593
44601
|
["moonbeam-mainnet", "https://api-moonbeam.moonscan.io/api"],
|
|
44594
44602
|
["moonbeam-testnet", "https://api-moonbase.moonscan.io/api"],
|
|
44603
|
+
["moonriver", "https://api-moonriver.moonscan.io/api"],
|
|
44604
|
+
["moonriver-mainnet", "https://api-moonriver.moonscan.io/api"],
|
|
44595
44605
|
["optimism", "https://api-optimistic.etherscan.io/api"],
|
|
44596
44606
|
["optimism-goerli", "https://api-goerli-optimistic.etherscan.io/api"],
|
|
44597
44607
|
["optimism-mainnet", "https://api-optimistic.etherscan.io/api"],
|
|
@@ -44601,10 +44611,16 @@ var DEFAULT_SCAN_API_URLS = /* @__PURE__ */ new Map([
|
|
|
44601
44611
|
["rarible-mainnet", "https://mainnet.explorer.rarichain.org/api"],
|
|
44602
44612
|
["scroll", "https://api.scrollscan.com/api"],
|
|
44603
44613
|
["scroll-mainnet", "https://api.scrollscan.com/api"],
|
|
44614
|
+
["sei", "https://seitrace.com/pacific-1/api"],
|
|
44615
|
+
["sei-mainnet", "https://seitrace.com/pacific-1/api"],
|
|
44616
|
+
["taiko", "https://api.taikoscan.io/api"],
|
|
44617
|
+
["taiko-mainnet", "https://api.taikoscan.io/api"],
|
|
44604
44618
|
["xchain", "https://xchain-explorer.idex.io/api"],
|
|
44605
44619
|
["xchain-mainnet", "https://xchain-explorer.idex.io/api"],
|
|
44606
44620
|
["xlayer", "https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER"],
|
|
44607
44621
|
["xlayer-mainnet", "https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER"],
|
|
44622
|
+
["zkatana", "https://astar-zkevm.explorer.startale.com/api"],
|
|
44623
|
+
["zkatana-mainnet", "https://astar-zkevm.explorer.startale.com/api"],
|
|
44608
44624
|
["zkconsensys", "https://api.lineascan.build/api"],
|
|
44609
44625
|
["zkconsensys-mainnet", "https://api.lineascan.build/api"],
|
|
44610
44626
|
["zkpolygon", "https://api-zkevm.polygonscan.com/api"],
|