diff --git a/404.html b/404.html index 1d5cf7b..b3f21e2 100644 --- a/404.html +++ b/404.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + +
diff --git a/assets/discord-akqDA9xj.png b/assets/discord-BqSoMD3G.png similarity index 100% rename from assets/discord-akqDA9xj.png rename to assets/discord-BqSoMD3G.png diff --git a/assets/index-CbnBNvRw.js b/assets/index-CbnBNvRw.js new file mode 100644 index 0000000..e9e807a --- /dev/null +++ b/assets/index-CbnBNvRw.js @@ -0,0 +1,1057 @@ +function vp(e,n){for(var t=0;tConstants are variables that cannot change.
+# @pragma version ^0.4.0
+
+MY_CONSTANT: constant(uint256) = 123
+MIN: constant(uint256) = 1
+MAX: constant(uint256) = 10
+ADDR: constant(address) = 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
+
+@external
+@pure
+def deprecated_constants() -> (address, uint256, bytes32):
+ # 0.3 deprecated constants
+ # return (ZERO_ADDRESS, MAX_UINT256, EMPTY_BYTES32)
+ # 0.4
+ return (empty(address), max_value(uint256), empty(bytes32))
+
+@external
+@pure
+def getMyConstants() -> (uint256, uint256, address):
+ return (MIN, MAX, ADDR)
+
`,Am=({prev:e,next:n})=>v.jsx(D,{version:Om,title:zm,description:Dm,html:bm,prev:e,next:n}),Fm="0.4.0",Mm="Constructor",$m="Constructor in Vyper",Um=`__init__
is a special function that is executed only once when the contract is deployed.
# @pragma version ^0.4.0
+
+owner: public(address)
+name: public(String[10])
+createdAt: public(uint256)
+expiresAt: public(uint256)
+
+@deploy
+def __init__(name: String[10], duration: uint256):
+ # set owner to caller
+ self.owner = msg.sender
+ # set name from input
+ self.name = name
+ self.createdAt = block.timestamp
+ self.expiresAt = block.timestamp + duration
+
`,Vm=({prev:e,next:n})=>v.jsx(D,{version:Fm,title:Mm,description:$m,html:Um,prev:e,next:n}),Bm="0.4.0",Hm="Create New Contract",Wm="Create new contract in Vyper",Qm=`Vyper contracts can deploy new contracts using the function create_forwarder_to
.
create_forwarder_to
is also known as "minimal proxy contract". How it works, we won't explain it here.
Here we will focus on how to use it to deploy new contracts.
+create_forwarder_to
ContractToDeploy
. This is the "master copy." All deployed contracts will execute code from this master copy.deploy()
passing the address of the master copy and any other arguments needed to setup the new contractHere is ContractToDeploy
ContractToDeploy.vy
+# @pragma version ^0.4.0
+
+owner: public(address)
+
+# __init__ is not called when deployed from create_forwarder_to
+@deploy
+def __init__():
+ self.owner = msg.sender
+
+# call once after create_forwarder_to
+@external
+def set_owner(owner: address):
+ assert self.owner == empty(address), "owner != zero address"
+ self.owner = owner
+
+# DANGER: never have selfdestruct in original contract used by create_forwarder_to
+# This function has been deprecated from version 0.3.8 onwards. The underlying
+# opcode will eventually undergo breaking changes, and its use is not recommended.
+@external
+def kill():
+ selfdestruct(msg.sender)
+
Create.vy
+# @pragma version ^0.4.0
+
+interface ContractToDeploy:
+ def set_owner(owner: address): nonpayable
+
+event Log:
+ addr: address
+
+@external
+def deploy(master_copy: address, owner: address):
+ addr: address = create_minimal_proxy_to(master_copy)
+ extcall ContractToDeploy(addr).set_owner(owner)
+ log Log(addr)
+
+@external
+def deploy_test(master_copy: address):
+ addr: address = create_minimal_proxy_to(master_copy)
+ extcall ContractToDeploy(addr).set_owner(self)
+ log Log(addr)
+
`,Km=({prev:e,next:n})=>v.jsx(D,{version:Bm,title:Hm,description:Wm,html:Qm,prev:e,next:n}),Ym="0.4.0",Xm="Default Function",Gm="Default function in Vyper",qm=`A contract can have a default function, executed when a function that does not exist is called. This is the same function as the fallback function in Solidity.
+This function is named __default__
and it is commonly used to receive Ether.
# @pragma version ^0.4.0
+
+event Payment:
+ sender: indexed(address)
+ amount: uint256
+
+@external
+@payable
+def __default__():
+ log Payment(msg.sender, msg.value)
+
`,Zm=({prev:e,next:n})=>v.jsx(D,{version:Ym,title:Xm,description:Gm,html:qm,prev:e,next:n}),Jm="0.4.0",ev="Curve Add and Remove Liquidity",nv="Curve Add and Remove Liquidity",tv=`Add and remove liquidity from Curve pools
+# @pragma version ^0.4.0
+
+from ethereum.ercs import IERC20
+
+interface IStableSwap:
+ def add_liquidity(amounts: uint256[3], min_shares: uint256): nonpayable
+ def remove_liquidity(shares: uint256, min_amounts: uint256[3]): nonpayable
+ def remove_liquidity_one_coin(shares: uint256, i: int128, min_amount: uint256): nonpayable
+ def get_virtual_price() -> uint256: view
+
+DAI: constant(address) = 0x6B175474E89094C44Da98b954EedeAC495271d0F
+USDC: constant(address) = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
+USDT: constant(address) = 0xdAC17F958D2ee523a2206206994597C13D831ec7
+
+POOL: constant(address) = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7
+COINS: constant(address[3]) = [DAI, USDC, USDT]
+
+@internal
+def _safe_transfer(coin: address, to: address, amount: uint256):
+ res: Bytes[32] = raw_call(
+ coin,
+ concat(
+ method_id("transfer(address,uint256)"),
+ convert(to, bytes32),
+ convert(amount, bytes32),
+ ),
+ max_outsize=32,
+ )
+ if len(res) > 0:
+ assert convert(res, bool)
+
+@internal
+def _safe_transfer_from(coin: address, _from: address, to: address, amount: uint256):
+ res: Bytes[32] = raw_call(
+ coin,
+ concat(
+ method_id("transferFrom(address,address,uint256)"),
+ convert(_from, bytes32),
+ convert(to, bytes32),
+ convert(amount, bytes32),
+ ),
+ max_outsize=32,
+ )
+ if len(res) > 0:
+ assert convert(res, bool)
+
+@internal
+def _safe_approve(coin: address, to: address, amount: uint256):
+ res: Bytes[32] = raw_call(
+ coin,
+ concat(
+ method_id("approve(address,uint256)"),
+ convert(to, bytes32),
+ convert(amount, bytes32),
+ ),
+ max_outsize=32,
+ )
+ if len(res) > 0:
+ assert convert(res, bool)
+
+@external
+def add_liquidity(amounts: uint256[3], min_shares: uint256):
+ for i: uint256 in range(3):
+ if amounts[i] > 0:
+ self._safe_transfer_from(COINS[i], msg.sender, self, amounts[i])
+ self._safe_approve(COINS[i], POOL, amounts[i])
+
+ extcall IStableSwap(POOL).add_liquidity(amounts, min_shares)
+
+@external
+@view
+def calc_value_of_shares(shares: uint256) -> uint256:
+ return shares * staticcall IStableSwap(POOL).get_virtual_price() // 10**18
+
+@external
+def remove_liquidity(shares: uint256, min_amounts: uint256[3]):
+ extcall IStableSwap(POOL).remove_liquidity(shares, min_amounts)
+
+ for coin: address in [DAI, USDC, USDT]:
+ bal: uint256 = staticcall IERC20(coin).balanceOf(self)
+ self._safe_transfer(coin, msg.sender, bal)
+
+@external
+def remove_liquidity_one_coin(shares: uint256, i: int128, min_amount: uint256):
+ extcall IStableSwap(POOL).remove_liquidity_one_coin(shares, i, min_amount)
+
+ bal: uint256 = staticcall IERC20(COINS[i]).balanceOf(self)
+ self._safe_transfer(COINS[i], msg.sender, bal)
+
`,sv=({prev:e,next:n})=>v.jsx(D,{version:Jm,title:ev,description:nv,html:tv,prev:e,next:n}),rv="0.4.0",av="Curve Swap",lv="Curve Swap",ov=`Swap tokens on Curve
+# @pragma version ^0.4.0
+
+from ethereum.ercs import IERC20
+
+interface IStableSwap:
+ def exchange(i: int128, j: int128, dx: uint256, min_dy: uint256): nonpayable
+
+DAI: constant(address) = 0x6B175474E89094C44Da98b954EedeAC495271d0F
+USDC: constant(address) = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
+USDT: constant(address) = 0xdAC17F958D2ee523a2206206994597C13D831ec7
+
+POOL: constant(address) = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7
+COINS: constant(address[3]) = [DAI, USDC, USDT]
+
+@internal
+def _safe_transfer(coin: address, to: address, amount: uint256):
+ res: Bytes[32] = raw_call(
+ coin,
+ concat(
+ method_id("transfer(address,uint256)"),
+ convert(to, bytes32),
+ convert(amount, bytes32),
+ ),
+ max_outsize=32,
+ )
+ if len(res) > 0:
+ assert convert(res, bool)
+
+@internal
+def _safe_transfer_from(coin: address, _from: address, to: address, amount: uint256):
+ res: Bytes[32] = raw_call(
+ coin,
+ concat(
+ method_id("transferFrom(address,address,uint256)"),
+ convert(_from, bytes32),
+ convert(to, bytes32),
+ convert(amount, bytes32),
+ ),
+ max_outsize=32,
+ )
+ if len(res) > 0:
+ assert convert(res, bool)
+
+@internal
+def _safe_approve(coin: address, to: address, amount: uint256):
+ res: Bytes[32] = raw_call(
+ coin,
+ concat(
+ method_id("approve(address,uint256)"),
+ convert(to, bytes32),
+ convert(amount, bytes32),
+ ),
+ max_outsize=32,
+ )
+ if len(res) > 0:
+ assert convert(res, bool)
+
+@external
+def swap(i: int128, j: int128, dx: uint256, min_dy: uint256):
+ self._safe_transfer_from(COINS[i], msg.sender, self, dx)
+ self._safe_approve(COINS[i], POOL, dx)
+
+ extcall IStableSwap(POOL).exchange(i, j, dx, min_dy)
+
+ bal: uint256 = staticcall IERC20(COINS[j]).balanceOf(self)
+ self._safe_transfer(COINS[j], msg.sender, bal)
+
`,iv=({prev:e,next:n})=>v.jsx(D,{version:rv,title:av,description:lv,html:ov,prev:e,next:n}),uv="0.4.0",cv="Delegate Call",pv="Delegate call in Vyper",dv=`When contract A
delegates call to contract B
, B
's code will be executed inside contract A
. This will update state variables and Ether balance inside contract A
and not B
.
Delegate call is commonly used to create an upgradable contract.
+Here is the contract that we will delegate call to.
+TestDelegateCall.vy
+# @pragma version ^0.4.0
+
+# State variables must be declared in the same order
+# as contract making the call
+x: public(uint256)
+y: public(uint256)
+
+@external
+def update_x(x: uint256):
+ # when this function is called with delegate call
+ # this will update self.x inside the calling contract
+ self.x = x + 1
+
+
+@external
+def update_y(y: uint256):
+ self.y = y * y
+
DelegateCall.vy
+# @pragma version ^0.4.0
+
+x: public(uint256)
+y: public(uint256)
+
+@external
+def update_x(to: address, x: uint256):
+ raw_call(
+ to,
+ concat(
+ method_id("update_x(uint256)"),
+ convert(x, bytes32)
+ ),
+ is_delegate_call=True
+ )
+
+@external
+def update_y(to: address, y: uint256):
+ raw_call(
+ to,
+ concat(
+ method_id("update_y(uint256)"),
+ convert(y, bytes32)
+ ),
+ is_delegate_call=True
+ )
+
`,fv=({prev:e,next:n})=>v.jsx(D,{version:uv,title:cv,description:pv,html:dv,prev:e,next:n}),hv="0.4.0",mv="Dynamic Arrays",vv="Dynamic arrays in Vyper",yv=`Dynamic arrays are bounded arrays whose length can change. The length of the array cannot exceed the maximum length set where the array is declared.
+# @pragma version ^0.4.0
+
+# Dynamic array of type uint256, max 3 elements
+nums: DynArray[uint256, 3]
+
+@deploy
+def __init__():
+ self.nums.append(11)
+ self.nums.append(22)
+ self.nums.append(33)
+ # This will revert (Appending to array with max 3 elements)
+ # self.nums.append(44)
+
+ # Remove last element
+ self.nums.pop()
+
+ # Delete all elements
+ self.nums = []
+ # Set values
+ self.nums = [1,2,3]
+
+@external
+@pure
+def examples(xs: DynArray[uint256, 5]) -> DynArray[uint256, 8]:
+ ys: DynArray[uint256, 5] = [1,2,3]
+ # Copy xs into ys
+ for x: uint256 in xs:
+ ys.append(x)
+ return ys
+
+@external
+@pure
+def filter(addrs: DynArray[address, 5]) -> DynArray[address, 5]:
+ nonzeros: DynArray[address, 5] = []
+ for addr: address in addrs:
+ if addr != empty(address):
+ nonzeros.append(addr)
+ return nonzeros
+
`,gv=({prev:e,next:n})=>v.jsx(D,{version:hv,title:mv,description:vv,html:yv,prev:e,next:n}),jv="0.4.0",wv="Error",_v="Error in Vyper",xv=`Use assert
and raise
to check inputs and validate state.
When an error occurs, it will halt the entire function call, undoing any changes.
+You will still need to pay gas for the failed transaction.
+# @pragma version ^0.4.0
+
+x: public(uint256)
+owner: public(address)
+
+@deploy
+def __init__():
+ self.owner = msg.sender
+
+@external
+def test_assert(x: uint256):
+ assert x >= 1, "x < 1"
+ # self.x will not be updated if there is an error from line above
+ self.x = x
+
+@external
+def test_raise(x: uint256):
+ # same check as above using "raise"
+ if x <= 1:
+ raise "x < 1"
+ self.x = x
+
+@internal
+def _test_error_bubbles_up(x: uint256):
+ assert x >= 1, "x < 1"
+ self.x = x
+
+@external
+def test_error_bubbles_up(x: uint256):
+ self._test_error_bubbles_up(x)
+ # self.x = 123 will not be executed if there is an error
+ # from function above
+ self.x = 123
+
+@external
+def set_owner(owner: address):
+ assert msg.sender == self.owner, "!owner"
+ assert owner != empty(address), "owner = zero"
+ self.owner = owner
+
`,kv=({prev:e,next:n})=>v.jsx(D,{version:jv,title:wv,description:_v,html:xv,prev:e,next:n}),Sv="0.4.0",Ev="Event",Cv="Event in Vyper",Pv=`Events write logs to the blockchain, commonly used by application to monitor blockchain state and as a cheaper alternative to store data on the blockchain without using state variables.
+Events can be efficiently searched by indexing their arguments. Up to 3 parameters can be indexed.
+# @pragma version ^0.4.0
+
+# up to 3 index
+event Transfer:
+ # enables quick search of all Transfer events where sender is a certain address
+ sender: indexed(address)
+ # enables quick search of all Transfer events where receiver is a certain address
+ receiver: indexed(address)
+ amount: uint256
+
+@external
+def transfer(receiver: address, amount: uint256):
+ # some code ...
+ log Transfer(msg.sender, receiver, amount)
+
+@external
+def mint(amount: uint256):
+ # some code ...
+ log Transfer(empty(address), msg.sender, amount)
+
+@external
+def burn(amount: uint256):
+ # some code ...
+ log Transfer(msg.sender, empty(address), amount)
+
`,Nv=({prev:e,next:n})=>v.jsx(D,{version:Sv,title:Ev,description:Cv,html:Pv,prev:e,next:n}),Tv="0.4.0",Lv="For Loop",Iv="For loop in Vyper",Rv=`There are 2 ways to loop through an array, using range
and directly looping through array elements.
# @pragma version ^0.4.0
+
+@external
+@pure
+def for_loop():
+ # for loop through range
+ # sum from 0 to 9
+ s: uint256 = 0
+ for i: uint256 in range(10):
+ s += i
+
+ # for loop through array elements
+ # find minimum of nums
+ nums: uint256[5] = [4, 5, 1, 9, 0]
+ x: uint256 = max_value(uint256)
+ for num: uint256 in nums:
+ if x < num:
+ x = num
+
+ # continue - skip current iteration
+ # break - exit for loop
+ c: uint256 = 0
+ for i: uint256 in [1, 2, 3, 4, 5]:
+ # skip 2
+ if i == 2:
+ continue
+ # end loop at i = 4
+ if i == 4:
+ break
+ # otherwise increment c by 1
+ c += 1
+ # c = 2 (incremented at i = 1 and 3)
+
+@external
+@pure
+def sum(nums: uint256[10]) -> uint256:
+ s: uint256 = 0
+ for n: uint256 in nums:
+ s += n
+ return s
+
`,Ov=({prev:e,next:n})=>v.jsx(D,{version:Tv,title:Lv,description:Iv,html:Rv,prev:e,next:n}),zv="0.4.0",Dv="Function",bv="Function in Vyper",Av=`# @pragma version ^0.4.0
+
+@external
+@pure
+def multiply(x: uint256, y: uint256) -> uint256:
+ return x * y
+
+@external
+@pure
+def divide(x: uint256, y: uint256) -> uint256:
+ # integer division
+ return x // y
+
+# A funciton that does nothing
+@external
+def doNothing():
+ # pass is useful when you want to compile the contract now,
+ # write the code later
+ pass
+
+# Functions can return multiple outputs
+@external
+@pure
+def multiOut() -> (uint256, bool):
+ return (1, True)
+
+@external
+@pure
+def addAndSub(x: uint256, y: uint256) -> (uint256, uint256):
+ return (x + y, x - y)
+
`,Fv=({prev:e,next:n})=>v.jsx(D,{version:zv,title:Dv,description:bv,html:Av,prev:e,next:n}),Mv="0.4.0",$v="Hash Function",Uv="Hash function in Vyper",Vv=`Vyper supports the same hash function available in Solidity, keccack256
.
# @pragma version ^0.4.0
+
+@external
+@pure
+def get_hash(addr: address, num: uint256, ) -> bytes32:
+ # input of keccak256 can be String, Bytes or bytes32
+ return keccak256(
+ # convert different data into Bytes
+ concat(
+ convert(addr, bytes32),
+ convert(num, bytes32),
+ convert("THIS IS A STRING", Bytes[16])
+ )
+ )
+
+@external
+@pure
+def get_message_hash(str: String[100]) -> bytes32:
+ return keccak256(str)
+
`,Bv=({prev:e,next:n})=>v.jsx(D,{version:Mv,title:$v,description:Uv,html:Vv,prev:e,next:n}),Hv="0.4.0",Wv="Hello World",Qv="Hello world in Vyper",Kv=`@version
specifies the compiler version of Vyper.
# @pragma version ^0.4.0
+
+# Create a string variable that can store maximum 100 characters
+greet: public(String[100])
+
+@deploy
+def __init__():
+ self.greet = "Hello World"
+
`,Yv=({prev:e,next:n})=>v.jsx(D,{version:Hv,title:Wv,description:Qv,html:Kv,prev:e,next:n}),Xv="0.4.0",Gv="If Else Conditional Statement",qv="If else conditional statement in Vyper",Zv=`# @pragma version ^0.4.0
+
+@external
+def if_else(x: uint256) -> uint256:
+ if x <= 10:
+ return 1
+ elif x <= 20:
+ return 2
+ else:
+ return 3
+
+@external
+@pure
+def abs_value(x: uint256, y: uint256) -> uint256:
+ if x >= y:
+ return x - y
+ return y - x
+
`,Jv=({prev:e,next:n})=>v.jsx(D,{version:Xv,title:Gv,description:qv,html:Zv,prev:e,next:n}),ey="0.4.0",ny="Immutable",ty="Immutable in Vyper",sy=`Immutable variables are like constants except value are assigned when the contract is deployed.
+immutable
variables?msg.sender
immutable
?Like constants, immutable
variables save run time gas
# @pragma version ^0.4.0
+
+OWNER: immutable(address)
+MY_IMMUTABLE: immutable(uint256)
+
+@deploy
+def __init__(val: uint256):
+ OWNER = msg.sender
+ MY_IMMUTABLE = val
+
+
+@external
+@view
+def get_my_immutable() -> uint256:
+ return MY_IMMUTABLE
+
`,ry=({prev:e,next:n})=>v.jsx(D,{version:ey,title:ny,description:ty,html:sy,prev:e,next:n}),ay="0.4.0",ly="Interface",oy="Interface in Vyper",iy=`Use interface
to call other smart contracts.
Here is the TestInterface
self.contract that we will call.
TestInterface.vy
+# @pragma version ^0.4.0
+
+owner: public(address)
+eth: public(uint256)
+
+@external
+def set_owner(owner: address):
+ self.owner = owner
+
+@external
+@payable
+def send_eth():
+ self.eth = msg.value
+
+@external
+@payable
+def set_owner_and_send_eth(owner: address):
+ self.owner = owner
+ self.eth = msg.value
+
Interface.vy
+# @pragma version ^0.4.0
+
+interface TestInterface:
+ # get address of owner
+ def owner() -> address: view
+ # set new owner
+ def set_owner(owner: address): nonpayable
+ # send ETH
+ def send_eth(): payable
+ # set owner and send ETH
+ def set_owner_and_send_eth(owner: address): payable
+
+# store contract having the above interface
+test: public(TestInterface)
+
+@deploy
+def __init__(test: address):
+ # store contract instance
+ self.test = TestInterface(test)
+ # if you need to get address from self.test
+ addr: address = self.test.address
+
+@external
+@view
+def get_owner() -> address:
+ return staticcall self.test.owner()
+
+@external
+@view
+def get_owner_from_addr(test: address) -> address:
+ # you can also call functions by passing in the address of the interface
+ return staticcall TestInterface(test).owner()
+
+@external
+def set_owner(owner: address):
+ extcall self.test.set_owner(owner)
+
+@external
+@payable
+def send_eth():
+ extcall self.test.send_eth(value=msg.value)
+
+@external
+@payable
+def set_owner_and_send_eth(owner: address):
+ extcall self.test.set_owner_and_send_eth(owner, value=msg.value)
+
`,uy=({prev:e,next:n})=>v.jsx(D,{version:ay,title:ly,description:oy,html:iy,prev:e,next:n}),cy="0.4.0",py="Internal and External Functions",dy="Internal and external functions in Vyper",fy=`@internal
functions can only be called inside the contract.
@external
functions can only be called from outside the contract.
# @pragma version ^0.4.0
+
+# Internal functions can only be called inside this contract
+@internal
+@pure
+def _add(x: uint256, y: uint256) -> uint256:
+ return x + y
+
+@external
+@view
+def ext_func() -> bool:
+ return True
+
+# External functions can only be called from outside this contract
+@external
+@view
+def avg(x: uint256, y: uint256) -> uint256:
+ # cannot call other external function
+ # self.extFunc()
+
+ # can call internal functions
+ z: uint256 = self._add(x, y)
+
+ return (x + y) // 2
+
+@internal
+@pure
+def _sqr(x: uint256) -> uint256:
+ return x * x
+
+@external
+@view
+def sum_of_squares(x: uint256, y: uint256) -> uint256:
+ return self._sqr(x) + self._sqr(y)
+
`,hy=({prev:e,next:n})=>v.jsx(D,{version:cy,title:py,description:dy,html:fy,prev:e,next:n}),my="0.4.0",vy="Payable",yy="Payable in Vyper",gy=`Functions declared with @payable
can receive Ether.
# @pragma version ^0.4.0
+
+event Deposit:
+ sender: indexed(address)
+ amount: uint256
+
+@external
+@payable
+def deposit():
+ log Deposit(msg.sender, msg.value)
+
+@external
+@view
+def get_balance() -> uint256:
+ # Get balance of Ether stored in this contract
+ return self.balance
+
+owner: public(address)
+
+@external
+@payable
+def pay():
+ assert msg.value > 0, "msg.value = 0"
+ self.owner = msg.sender
+
`,jy=({prev:e,next:n})=>v.jsx(D,{version:my,title:vy,description:yy,html:gy,prev:e,next:n}),wy="0.4.0",_y="Debug with Print",xy="Debug with Print",ky=`Use the built-in function print
to debug smart contracts.
# @pragma version ^0.4.0
+
+@external
+def test_print():
+ x: uint256 = 123
+ # Set hardhat_compat = True when testing with Hardhat
+ print("print something here", x, hardhat_compat=True)
+
`,Sy=({prev:e,next:n})=>v.jsx(D,{version:wy,title:_y,description:xy,html:ky,prev:e,next:n}),Ey="0.4.0",Cy="Private and Public State Variables",Py="Private and public state variables in Vyper",Ny=`Private state variables cannot be accessed from outside the contract.
+Public state variables can be read by anyone, including users and other contracts.
+# @pragma version ^0.4.0
+
+# publis state variable
+owner: public(address)
+# private state variable
+foo: uint256
+bar: public(bool)
+
+@deploy
+def __init__():
+ self.owner = msg.sender
+ self.foo = 123
+ self.bar = True
+
`,Ty=({prev:e,next:n})=>v.jsx(D,{version:Ey,title:Cy,description:Py,html:Ny,prev:e,next:n}),Ly="0.4.0",Iy="Raw Call",Ry="Raw call in Vyper",Oy=`raw_call
is a low level function. It is used to call and send Ether to other functions.
For this example, we will write a contract that calls this contract below.
+TestRawCall.vy
+# @pragma version ^0.4.0
+
+
+sender: public(address)
+
+@external
+def test_add(x: uint256, y: uint256) -> uint256:
+ self.sender = msg.sender
+ return x + y
+
+@external
+def test_sub(x: uint256, y: uint256) -> uint256:
+ self.sender = msg.sender
+ return x - y
+
RawCall.vy
+# @pragma version ^0.4.0
+
+@external
+def test_raw_call(to: address, x: uint256, y: uint256):
+ res: Bytes[32] = raw_call(
+ to, # address to call
+ # data to send in Bytes
+ concat(
+ method_id("test_add(uint256,uint256)"), # function to call
+ convert(x, bytes32), # first input
+ convert(y, bytes32), # secode input
+ ),
+ max_outsize=32, # max size of ouput, default 0
+ gas=100000, # optional, amount of gas to send, default forwards all gas
+ value=0, # optional, amount of ETH to send, default 0
+ )
+ z: uint256 = convert(res, uint256)
+
+@external
+@payable
+def send_eth(to: address):
+ # Example to send ETH
+ # data = b"", empty data
+ # value = msg.value, all of ETH that was sent to this function
+ raw_call(to, b"", value=msg.value)
+
+diff: public(uint256)
+
+@external
+def test_raw_call_sub(to: address, x: uint256, y: uint256):
+ res: Bytes[32] = raw_call(
+ to,
+ concat(
+ method_id("test_sub(uint256,uint256)"),
+ convert(x, bytes32),
+ convert(y, bytes32)
+ ),
+ max_outsize=32,
+ )
+
+ self.diff = convert(res, uint256)
+
`,zy=({prev:e,next:n})=>v.jsx(D,{version:Ly,title:Iy,description:Ry,html:Oy,prev:e,next:n}),Dy="0.4.0",by="Re-Entrancy Lock",Ay="Re-entrancy lock in Vyper",Fy=`Vyper has a handy way to secure your contract from re-entrancy.
+A re-entrancy lock can be created on a function with @nonreentrant("lock")
.
Functions can be locked together by using the same name for the locks.
+# @pragma version ^0.4.0
+
+@external
+@nonreentrant
+def func():
+ # call back msg.sender
+ raw_call(msg.sender, b"", value=0)
+
+
`,My=({prev:e,next:n})=>v.jsx(D,{version:Dy,title:by,description:Ay,html:Fy,prev:e,next:n}),$y="0.4.0",Uy="Data Types - References",Vy="References in Vyper",By=`References types are data types that are passed by their reference, pointer to where the actual data is stored.
+# @pragma version ^0.4.0
+
+struct Person:
+ name: String[100]
+ age: uint256
+
+# Fixed sized list
+nums: public(uint256[10]) # must be bounded
+myMap: public(HashMap[address, uint256])
+person: public(Person)
+
+@deploy
+def __init__():
+ # This updates self.nums[0]
+ self.nums[0] = 123
+ self.nums[9] = 456
+ # Copies self.nums to array in memory.
+ # Does not modify referenced variable (self.nums)
+ arr: uint256[10] = self.nums
+ arr[0] = 123
+
+ # This updates self.myMap
+ self.myMap[msg.sender] = 1
+ self.myMap[msg.sender] = 11
+
+ # This updates self.person
+ self.person.age = 11
+ self.person.name = "Vyper"
+ # Person struct is copied into memory.
+ # Does not modify referenced variable (self.person)
+ p: Person = self.person
+ p.name = "Solidity"
+
`,Hy=({prev:e,next:n})=>v.jsx(D,{version:$y,title:Uy,description:Vy,html:By,prev:e,next:n}),Wy="0.4.0",Qy="Self Destruct",Ky="Self destruct in Vyper",Yy=`selfdestruct
deletes the contract from the blockchain. It takes a single input, an address to send all of Ether stored in the contract.
# @pragma version ^0.4.0
+
+@external
+@payable
+def __default__():
+ pass
+
+@external
+def kill():
+ selfdestruct(msg.sender)
+
`,Xy=({prev:e,next:n})=>v.jsx(D,{version:Wy,title:Qy,description:Ky,html:Yy,prev:e,next:n}),Gy="0.4.0",qy="Send Ether",Zy="Send ETH in Vyper",Jy=`There are two ways to send Ether from a contract, send
and raw_call
. Here we introduce the simpler function to use, send
.
# @pragma version ^0.4.0
+
+# Receive Ether into this contract
+@external
+@payable
+def __default__():
+ pass
+
+@external
+def send_eth(to: address, amount: uint256):
+ # when Ether is sent to a contract it will call
+ # __default__ inside the receiving contract
+ # forwards 2300 gas
+ send(to, amount)
+
+@external
+def send_all(to: address):
+ send(to, self.balance)
+
`,eg=({prev:e,next:n})=>v.jsx(D,{version:Gy,title:qy,description:Zy,html:Jy,prev:e,next:n}),ng="0.4.0",tg="Unsafe Math",sg="Unsafe math in Vyper",rg=`Critical math checks such as overflow, underflow and division by 0 can be skipped using unsafe functions
+# @pragma version ^0.4.0
+
+@external
+def test_add(x: uint256, y: uint256) -> uint256:
+ # 21510 gas
+ # return x + y
+
+ # 21472 gas
+ return unsafe_add(x, y)
+
+@external
+def test_sub(x: uint256, y: uint256) -> uint256:
+ # 21533 gas
+ # return x - y
+
+ # 21495 gas
+ return unsafe_sub(x, y)
+
+@external
+def test_mul(x: uint256, y: uint256) -> uint256:
+ # 21578 gas
+ # return x * y
+
+ # 21520 gas
+ return unsafe_mul(x, y)
+
+@external
+def test_div(x: uint256, y: uint256) -> uint256:
+ # 21578 gas
+ # return x // y
+
+ # 21543 gas
+ return unsafe_div(x, y)
+
`,ag=({prev:e,next:n})=>v.jsx(D,{version:ng,title:tg,description:sg,html:rg,prev:e,next:n}),lg="0.4.0",og="Data Types - Values",ig="Values in Vyper",ug=`Some values available in Vyper
+bool
int128
uint256
decimals
address
bytes32
Bytes
String
# @pragma version ^0.4.0
+
+# Must be compiled with --enable-decimals
+
+b: public(bool)
+i: public(int128) # -2 ** 127 to (2 ** 127 - 1)
+u: public(uint256) # 0 to 2 ** 256 - 1
+dec: public(decimal) # -2 ** 127 to (2 ** 127 - 1), 10 decimal places
+addr: public(address)
+b32: public(bytes32)
+bs: public(Bytes[100])
+s: public(String[100])
+
+@deploy
+def __init__():
+ self.b = False
+ self.i = -1
+ self.u = 123
+ self.dec = 3.14
+ self.addr = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4
+ self.b32 = 0xada1b75f8ae9a65dcc16f95678ac203030505c6b465c8206e26ae84b525cdacb
+ self.bs = b"\\x01"
+ self.s = "Hello Vyper"
+
`,cg=({prev:e,next:n})=>v.jsx(D,{version:lg,title:og,description:ig,html:ug,prev:e,next:n}),pg="0.4.0",dg="Verify Signature",fg="Verify signature in Vyper",hg=`Signing and verifying signature takes 3 steps.
+# @pragma version ^0.4.0
+
+# hash = get_hash("Hello Vyper!")
+# 0x5436c86f18e3d25a10e557ae125450118dd0a481ca22112b1977d55a676e4c91
+@external
+@pure
+def get_hash(str: String[100]) -> bytes32:
+ return keccak256(str)
+
+# get_eth_signed_hash(hash)
+# 0x045b623a8e8fb7b4fcfbd1ae07e7326d55303d7de4085c69b346bd130c1936da
+@external
+@pure
+def get_eth_signed_hash(hash: bytes32) -> bytes32:
+ return keccak256(
+ concat(
+ b'\\x19Ethereum Signed Message:\\n32',
+ hash
+ )
+ )
+
+# account = your account
+# hash = get_hash("Hello Vyper!")
+# signature = await ethereum.request({ method: "personal_sign", params: [account, hash]})
+@external
+@pure
+def recover_signer(eth_signed_hash: bytes32, sig: Bytes[65]) -> address:
+ r: uint256 = convert(slice(sig, 0, 32), uint256)
+ s: uint256 = convert(slice(sig, 32, 32), uint256)
+ v: uint256 = convert(slice(sig, 64, 1), uint256)
+ return ecrecover(eth_signed_hash, v, r, s)
+
+@external
+@pure
+def verify(sig: Bytes[65], str: String[100], _signer: address) -> bool:
+ hash: bytes32 = keccak256(str)
+ eth_signed_hash: bytes32 = keccak256(
+ concat(
+ b'\\x19Ethereum Signed Message:\\n32',
+ hash
+ )
+ )
+ r: uint256 = convert(slice(sig, 0, 32), uint256)
+ s: uint256 = convert(slice(sig, 32, 32), uint256)
+ v: uint256 = convert(slice(sig, 64, 1), uint256)
+ signer: address = ecrecover(eth_signed_hash, v, r, s)
+
+ return _signer == signer
+
`,mg=({prev:e,next:n})=>v.jsx(D,{version:pg,title:dg,description:fg,html:hg,prev:e,next:n}),vg="0.4.0",yg="View and Pure Functions",gg="View and pure functions in Vyper",jg=`Both pure
and view
functions are read only function, they cannot write anything to the blockchain.
pure
functions do not read any state or global variables
view
functions can read state variables, global variables and call internal functions.
# @pragma version ^0.4.0
+
+num: public(uint256)
+
+# Pure functions does not read any state or global variables
+@external
+@pure
+def pureFunc(x: uint256) -> uint256:
+ return x
+
+
+# View functions might read state or global state, or call an internal function
+@external
+@view
+def viewFunc(x: uint256) -> bool:
+ return x > self.num
+
+
+@external
+@pure
+def sum(x: uint256, y: uint256, z: uint256) -> uint256:
+ return x + y + z
+
+
+@external
+@view
+def addNum(x: uint256) -> uint256:
+ return x + self.num
+
`,wg=({prev:e,next:n})=>v.jsx(D,{version:vg,title:yg,description:gg,html:jg,prev:e,next:n}),_g=({size:e,className:n=""})=>v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",width:e,height:e,className:n,children:v.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"})}),xg="_component_efeb7_1",kg="_icon_efeb7_8",Sg="_input_efeb7_12",fa={component:xg,icon:kg,input:Sg},Eg=({value:e,onChange:n})=>{function t(s){n(s.target.value)}return v.jsxs("div",{className:fa.component,children:[v.jsx(_g,{size:18,className:fa.icon}),v.jsx("input",{className:fa.input,placeholder:"Search",value:e,onChange:t})]})};var Cg="Expected a function",Ii=NaN,Pg="[object Symbol]",Ng=/^\s+|\s+$/g,Tg=/^[-+]0x[0-9a-f]+$/i,Lg=/^0b[01]+$/i,Ig=/^0o[0-7]+$/i,Rg=parseInt,Og=typeof fs=="object"&&fs&&fs.Object===Object&&fs,zg=typeof self=="object"&&self&&self.Object===Object&&self,Dg=Og||zg||Function("return this")(),bg=Object.prototype,Ag=bg.toString,Fg=Math.max,Mg=Math.min,ha=function(){return Dg.Date.now()};function $g(e,n,t){var s,r,a,l,o,i,u=0,d=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(Cg);n=Ri(n)||0,pl(t)&&(d=!!t.leading,f="maxWait"in t,a=f?Fg(Ri(t.maxWait)||0,n):a,m="trailing"in t?!!t.trailing:m);function y(x){var C=s,T=r;return s=r=void 0,u=x,l=e.apply(T,C),l}function j(x){return u=x,o=setTimeout(p,n),d?y(x):l}function w(x){var C=x-i,T=x-u,$=n-C;return f?Mg($,a-T):$}function E(x){var C=x-i,T=x-u;return i===void 0||C>=n||C<0||f&&T>=a}function p(){var x=ha();if(E(x))return c(x);o=setTimeout(p,w(x))}function c(x){return o=void 0,m&&s?y(x):(s=r=void 0,l)}function h(){o!==void 0&&clearTimeout(o),u=0,s=i=r=o=void 0}function g(){return o===void 0?l:c(ha())}function k(){var x=ha(),C=E(x);if(s=arguments,r=this,i=x,C){if(o===void 0)return j(i);if(f)return o=setTimeout(p,n),y(i)}return o===void 0&&(o=setTimeout(p,n)),l}return k.cancel=h,k.flush=g,k}function pl(e){var n=typeof e;return!!e&&(n=="object"||n=="function")}function Ug(e){return!!e&&typeof e=="object"}function Vg(e){return typeof e=="symbol"||Ug(e)&&Ag.call(e)==Pg}function Ri(e){if(typeof e=="number")return e;if(Vg(e))return Ii;if(pl(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=pl(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=e.replace(Ng,"");var t=Lg.test(e);return t||Ig.test(e)?Rg(e.slice(2),t?2:8):Tg.test(e)?Ii:+e}var Bg=$g;const Hg=Ai(Bg),Wg={leading:!1,trailing:!0};function Qg(e,n,t){return S.useCallback(Hg(e,n,Wg),t)}function Kg(e,n){let t=e;for(let s=0;sr(ds,Mr)?(N[Q]=ds,N[Sn]=O,Q=Sn):(N[Q]=Mr,N[_n]=O,Q=_n);else if(Snr(ds,O))N[Q]=ds,N[Sn]=O,Q=Sn;else break e}}return L}function r(N,L){var O=N.sortIndex-L.sortIndex;return O!==0?O:N.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var i=[],u=[],d=1,f=null,m=3,v=!1,j=!1,w=!1,E=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(N){for(var L=t(u);L!==null;){if(L.callback===null)s(u);else if(L.startTime<=N)s(u),L.sortIndex=L.expirationTime,n(i,L);else break;L=t(u)}}function g(N){if(w=!1,h(N),!j)if(t(i)!==null)j=!0,Ar(_);else{var L=t(u);L!==null&&Fr(g,L.startTime-N)}}function _(N,L){j=!1,w&&(w=!1,p(T),T=-1),v=!0;var O=m;try{for(h(L),f=t(i);f!==null&&(!(f.expirationTime>L)||N&&!Oe());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,m=f.priorityLevel;var q=Q(f.expirationTime<=L);L=e.unstable_now(),typeof q=="function"?f.callback=q:f===t(i)&&s(i),h(L)}else s(i);f=t(i)}if(f!==null)var ps=!0;else{var _n=t(u);_n!==null&&Fr(g,_n.startTime-L),ps=!1}return ps}finally{f=null,m=O,v=!1}}var k=!1,C=null,T=-1,U=5,I=-1;function Oe(){return!(e.unstable_now()-IN||125Q?(N.sortIndex=O,n(u,N),t(i)===null&&N===t(u)&&(w?(p(T),T=-1):w=!0,Fr(g,O-Q))):(N.sortIndex=q,n(i,N),j||v||(j=!0,Ar(_))),N},e.unstable_shouldYield=Oe,e.unstable_wrapCallback=function(N){var L=m;return function(){var O=m;m=L;try{return N.apply(this,arguments)}finally{m=O}}}})(qi);Zi.exports=qi;var bp=Zi.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ji=S,ke=bp;function x(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t "u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ml=Object.prototype.hasOwnProperty,Vp=/^[: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]*$/,mo={},yo={};function Bp(e){return ml.call(yo,e)?!0:ml.call(mo,e)?!1:Vp.test(e)?yo[e]=!0:(mo[e]=!0,!1)}function Hp(e,n,t,s){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return s?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Wp(e,n,t,s){if(n===null||typeof n>"u"||Hp(e,n,t,s))return!0;if(s)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function de(e,n,t,s,r,l,a){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=l,this.removeEmptyString=a}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];se[n]=new de(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new de(e,2,!1,e,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(e){se[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var ya=/[\-:]([a-z])/g;function va(e){return e[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(e){var n=e.replace(ya,va);se[n]=new de(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(ya,va);se[n]=new de(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(ya,va);se[n]=new de(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function ga(e,n,t,s){var r=se.hasOwnProperty(n)?se[n]:null;(r!==null?r.type!==0:s||!(2 o||r[a]!==l[o]){var i=` -`+r[a].replace(" at new "," at ");return e.displayName&&i.includes(" ")&&(i=i.replace(" ",e.displayName)),i}while(1<=a&&0<=o);break}}}finally{br=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?Nt(e):""}function Qp(e){switch(e.tag){case 5:return Nt(e.type);case 16:return Nt("Lazy");case 13:return Nt("Suspense");case 19:return Nt("SuspenseList");case 0:case 2:case 15:return e=Vr(e.type,!1),e;case 11:return e=Vr(e.type.render,!1),e;case 1:return e=Vr(e.type,!0),e;default:return""}}function jl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Bn:return"Fragment";case Vn:return"Portal";case yl:return"Profiler";case ja:return"StrictMode";case vl:return"Suspense";case gl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case tu:return(e.displayName||"Context")+".Consumer";case nu:return(e._context.displayName||"Context")+".Provider";case wa:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xa:return n=e.displayName||null,n!==null?n:jl(e.type)||"Memo";case tn:n=e._payload,e=e._init;try{return jl(e(n))}catch{}}return null}function Kp(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return jl(n);case 8:return n===ja?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function gn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ru(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Yp(e){var n=ru(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),s=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,l=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return r.call(this)},set:function(a){s=""+a,l.call(this,a)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return s},setValue:function(a){s=""+a},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ys(e){e._valueTracker||(e._valueTracker=Yp(e))}function lu(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),s="";return e&&(s=ru(e)?e.checked?"true":"false":e.value),e=s,e!==t?(n.setValue(e),!0):!1}function Hs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wl(e,n){var t=n.checked;return H({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function go(e,n){var t=n.defaultValue==null?"":n.defaultValue,s=n.checked!=null?n.checked:n.defaultChecked;t=gn(n.value!=null?n.value:t),e._wrapperState={initialChecked:s,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function au(e,n){n=n.checked,n!=null&&ga(e,"checked",n,!1)}function xl(e,n){au(e,n);var t=gn(n.value),s=n.type;if(t!=null)s==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?kl(e,n.type,t):n.hasOwnProperty("defaultValue")&&kl(e,n.type,gn(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function jo(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var s=n.type;if(!(s!=="submit"&&s!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function kl(e,n,t){(n!=="number"||Hs(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var Tt=Array.isArray;function et(e,n,t,s){if(e=e.options,n){n={};for(var r=0;r "+n.valueOf().toString()+"",n=vs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Vt(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var Rt={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},Xp=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){Xp.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function cu(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function pu(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var s=t.indexOf("--")===0,r=cu(t,n[t],s);t==="float"&&(t="cssFloat"),s?e.setProperty(t,r):e[t]=r}}var Gp=H({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 El(e,n){if(n){if(Gp[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(x(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(x(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(x(61))}if(n.style!=null&&typeof n.style!="object")throw Error(x(62))}}function Cl(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){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 Pl=null;function ka(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Nl=null,nt=null,tt=null;function ko(e){if(e=us(e)){if(typeof Nl!="function")throw Error(x(280));var n=e.stateNode;n&&(n=xr(n),Nl(e.stateNode,e.type,n))}}function du(e){nt?tt?tt.push(e):tt=[e]:nt=e}function fu(){if(nt){var e=nt,n=tt;if(tt=nt=null,ko(e),n)for(e=0;e >>=0,e===0?32:31-(od(e)/id|0)|0}var gs=64,js=4194304;function Lt(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ys(e,n){var t=e.pendingLanes;if(t===0)return 0;var s=0,r=e.suspendedLanes,l=e.pingedLanes,a=t&268435455;if(a!==0){var o=a&~r;o!==0?s=Lt(o):(l&=a,l!==0&&(s=Lt(l)))}else a=t&~r,a!==0?s=Lt(a):l!==0&&(s=Lt(l));if(s===0)return 0;if(n!==0&&n!==s&&!(n&r)&&(r=s&-s,l=n&-n,r>=l||r===16&&(l&4194240)!==0))return n;if(s&4&&(s|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=s;0 t;t++)n.push(e);return n}function os(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-Ae(n),e[n]=t}function dd(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0 =zt),Oo=" ",Ro=!1;function Iu(e,n){switch(e){case"keyup":return Ud.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hn=!1;function Vd(e,n){switch(e){case"compositionend":return zu(n);case"keypress":return n.which!==32?null:(Ro=!0,Oo);case"textInput":return e=n.data,e===Oo&&Ro?null:e;default:return null}}function Bd(e,n){if(Hn)return e==="compositionend"||!La&&Iu(e,n)?(e=Ou(),Ds=Pa=an=null,Hn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1 =n)return{node:t,offset:n-e};e=s}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=Ao(t)}}function Mu(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Mu(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function $u(){for(var e=window,n=Hs();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=Hs(e.document)}return n}function Oa(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function qd(e){var n=$u(),t=e.focusedElem,s=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&Mu(t.ownerDocument.documentElement,t)){if(s!==null&&Oa(t)){if(n=s.start,e=s.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var r=t.textContent.length,l=Math.min(s.start,r);s=s.end===void 0?l:Math.min(s.end,r),!e.extend&&l>s&&(r=s,s=l,l=r),r=Fo(t,l);var a=Fo(t,s);r&&a&&(e.rangeCount!==1||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(n=n.createRange(),n.setStart(r.node,r.offset),e.removeAllRanges(),l>s?(e.addRange(n),e.extend(a.node,a.offset)):(n.setEnd(a.node,a.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t =document.documentMode,Wn=null,zl=null,At=null,Dl=!1;function Mo(e,n,t){var s=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Dl||Wn==null||Wn!==Hs(s)||(s=Wn,"selectionStart"in s&&Oa(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),At&&Yt(At,s)||(At=s,s=Zs(zl,"onSelect"),0 Yn||(e.current=bl[Yn],bl[Yn]=null,Yn--)}function F(e,n){Yn++,bl[Yn]=e.current,e.current=n}var jn={},oe=xn(jn),me=xn(!1),In=jn;function ot(e,n){var t=e.type.contextTypes;if(!t)return jn;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===n)return s.__reactInternalMemoizedMaskedChildContext;var r={},l;for(l in t)r[l]=n[l];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=r),r}function ye(e){return e=e.childContextTypes,e!=null}function Js(){$(me),$(oe)}function Wo(e,n,t){if(oe.current!==jn)throw Error(x(168));F(oe,n),F(me,t)}function Yu(e,n,t){var s=e.stateNode;if(n=n.childContextTypes,typeof s.getChildContext!="function")return t;s=s.getChildContext();for(var r in s)if(!(r in n))throw Error(x(108,Kp(e)||"Unknown",r));return H({},t,s)}function er(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||jn,In=oe.current,F(oe,e),F(me,me.current),!0}function Qo(e,n,t){var s=e.stateNode;if(!s)throw Error(x(169));t?(e=Yu(e,n,In),s.__reactInternalMemoizedMergedChildContext=e,$(me),$(oe),F(oe,e)):$(me),F(me,t)}var We=null,kr=!1,tl=!1;function Xu(e){We===null?We=[e]:We.push(e)}function pf(e){kr=!0,Xu(e)}function kn(){if(!tl&&We!==null){tl=!0;var e=0,n=A;try{var t=We;for(A=1;e >=a,r-=a,Qe=1<<32-Ae(n)+r|t< T?(U=C,C=null):U=C.sibling;var I=m(p,C,h[T],g);if(I===null){C===null&&(C=U);break}e&&C&&I.alternate===null&&n(p,C),c=l(I,c,T),k===null?_=I:k.sibling=I,k=I,C=U}if(T===h.length)return t(p,C),b&&En(p,T),_;if(C===null){for(;T T?(U=C,C=null):U=C.sibling;var Oe=m(p,C,I.value,g);if(Oe===null){C===null&&(C=U);break}e&&C&&Oe.alternate===null&&n(p,C),c=l(Oe,c,T),k===null?_=Oe:k.sibling=Oe,k=Oe,C=U}if(I.done)return t(p,C),b&&En(p,T),_;if(C===null){for(;!I.done;T++,I=h.next())I=f(p,I.value,g),I!==null&&(c=l(I,c,T),k===null?_=I:k.sibling=I,k=I);return b&&En(p,T),_}for(C=s(p,C);!I.done;T++,I=h.next())I=v(C,p,T,I.value,g),I!==null&&(e&&I.alternate!==null&&C.delete(I.key===null?T:I.key),c=l(I,c,T),k===null?_=I:k.sibling=I,k=I);return e&&C.forEach(function(gt){return n(p,gt)}),b&&En(p,T),_}function E(p,c,h,g){if(typeof h=="object"&&h!==null&&h.type===Bn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case ms:e:{for(var _=h.key,k=c;k!==null;){if(k.key===_){if(_=h.type,_===Bn){if(k.tag===7){t(p,k.sibling),c=r(k,h.props.children),c.return=p,p=c;break e}}else if(k.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===tn&&Jo(_)===k.type){t(p,k.sibling),c=r(k,h.props),c.ref=Et(p,k,h),c.return=p,p=c;break e}t(p,k);break}else n(p,k);k=k.sibling}h.type===Bn?(c=On(h.props.children,p.mode,g,h.key),c.return=p,p=c):(g=Bs(h.type,h.key,h.props,null,p.mode,g),g.ref=Et(p,c,h),g.return=p,p=g)}return a(p);case Vn:e:{for(k=h.key;c!==null;){if(c.key===k)if(c.tag===4&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){t(p,c.sibling),c=r(c,h.children||[]),c.return=p,p=c;break e}else{t(p,c);break}else n(p,c);c=c.sibling}c=cl(h,p.mode,g),c.return=p,p=c}return a(p);case tn:return k=h._init,E(p,c,k(h._payload),g)}if(Tt(h))return j(p,c,h,g);if(wt(h))return w(p,c,h,g);Cs(p,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,c!==null&&c.tag===6?(t(p,c.sibling),c=r(c,h),c.return=p,p=c):(t(p,c),c=ul(h,p.mode,g),c.return=p,p=c),a(p)):t(p,c)}return E}var ut=sc(!0),rc=sc(!1),cs={},Be=xn(cs),qt=xn(cs),Jt=xn(cs);function Tn(e){if(e===cs)throw Error(x(174));return e}function Ua(e,n){switch(F(Jt,n),F(qt,e),F(Be,cs),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:Sl(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=Sl(n,e)}$(Be),F(Be,n)}function ct(){$(Be),$(qt),$(Jt)}function lc(e){Tn(Jt.current);var n=Tn(Be.current),t=Sl(n,e.type);n!==t&&(F(qt,e),F(Be,t))}function ba(e){qt.current===e&&($(Be),$(qt))}var V=xn(0);function ar(e){for(var n=e;n!==null;){if(n.tag===13){var t=n.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if(n.flags&128)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var sl=[];function Va(){for(var e=0;e t?t:4,e(!0);var s=rl.transition;rl.transition={};try{e(!1),n()}finally{A=t,rl.transition=s}}function xc(){return Le().memoizedState}function mf(e,n,t){var s=yn(e);if(t={lane:s,action:t,hasEagerState:!1,eagerState:null,next:null},kc(e))_c(n,t);else if(t=Ju(e,n,t,s),t!==null){var r=ce();Fe(t,e,s,r),Sc(t,n,s)}}function yf(e,n,t){var s=yn(e),r={lane:s,action:t,hasEagerState:!1,eagerState:null,next:null};if(kc(e))_c(n,r);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=n.lastRenderedReducer,l!==null))try{var a=n.lastRenderedState,o=l(a,t);if(r.hasEagerState=!0,r.eagerState=o,Me(o,a)){var i=n.interleaved;i===null?(r.next=r,Ma(n)):(r.next=i.next,i.next=r),n.interleaved=r;return}}catch{}finally{}t=Ju(e,n,r,s),t!==null&&(r=ce(),Fe(t,e,s,r),Sc(t,n,s))}}function kc(e){var n=e.alternate;return e===B||n!==null&&n===B}function _c(e,n){Ft=or=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function Sc(e,n,t){if(t&4194240){var s=n.lanes;s&=e.pendingLanes,t|=s,n.lanes=t,Sa(e,t)}}var ir={readContext:Te,useCallback:re,useContext:re,useEffect:re,useImperativeHandle:re,useInsertionEffect:re,useLayoutEffect:re,useMemo:re,useReducer:re,useRef:re,useState:re,useDebugValue:re,useDeferredValue:re,useTransition:re,useMutableSource:re,useSyncExternalStore:re,useId:re,unstable_isNewReconciler:!1},vf={readContext:Te,useCallback:function(e,n){return Ue().memoizedState=[e,n===void 0?null:n],e},useContext:Te,useEffect:ni,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,$s(4194308,4,yc.bind(null,n,e),t)},useLayoutEffect:function(e,n){return $s(4194308,4,e,n)},useInsertionEffect:function(e,n){return $s(4,2,e,n)},useMemo:function(e,n){var t=Ue();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var s=Ue();return n=t!==void 0?t(n):n,s.memoizedState=s.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},s.queue=e,e=e.dispatch=mf.bind(null,B,e),[s.memoizedState,e]},useRef:function(e){var n=Ue();return e={current:e},n.memoizedState=e},useState:ei,useDebugValue:Ka,useDeferredValue:function(e){return Ue().memoizedState=e},useTransition:function(){var e=ei(!1),n=e[0];return e=hf.bind(null,e[1]),Ue().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var s=B,r=Ue();if(b){if(t===void 0)throw Error(x(407));t=t()}else{if(t=n(),ee===null)throw Error(x(349));Dn&30||ic(s,n,t)}r.memoizedState=t;var l={value:t,getSnapshot:n};return r.queue=l,ni(cc.bind(null,s,l,e),[e]),s.flags|=2048,ts(9,uc.bind(null,s,l,t,n),void 0,null),t},useId:function(){var e=Ue(),n=ee.identifierPrefix;if(b){var t=Ke,s=Qe;t=(s&~(1<<32-Ae(s)-1)).toString(32)+t,n=":"+n+"R"+t,t=es++,0 <\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=a.createElement(t,{is:s.is}):(e=a.createElement(t),t==="select"&&(a=e,s.multiple?a.multiple=!0:s.size&&(a.size=s.size))):e=a.createElementNS(e,t),e[be]=n,e[Zt]=s,Ic(e,n,!1,!1),n.stateNode=e;e:{switch(a=Cl(t,s),t){case"dialog":M("cancel",e),M("close",e),r=s;break;case"iframe":case"object":case"embed":M("load",e),r=s;break;case"video":case"audio":for(r=0;r dt&&(n.flags|=128,s=!0,Ct(l,!1),n.lanes=4194304)}else{if(!s)if(e=ar(a),e!==null){if(n.flags|=128,s=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),Ct(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!b)return le(n),null}else 2*K()-l.renderingStartTime>dt&&t!==1073741824&&(n.flags|=128,s=!0,Ct(l,!1),n.lanes=4194304);l.isBackwards?(a.sibling=n.child,n.child=a):(t=l.last,t!==null?t.sibling=a:n.child=a,l.last=a)}return l.tail!==null?(n=l.tail,l.rendering=n,l.tail=n.sibling,l.renderingStartTime=K(),n.sibling=null,t=V.current,F(V,s?t&1|2:t&1),n):(le(n),null);case 22:case 23:return Ja(),s=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(n.flags|=8192),s&&n.mode&1?je&1073741824&&(le(n),n.subtreeFlags&6&&(n.flags|=8192)):le(n),null;case 24:return null;case 25:return null}throw Error(x(156,n.tag))}function Ef(e,n){switch(Ia(n),n.tag){case 1:return ye(n.type)&&Js(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ct(),$(me),$(oe),Va(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return ba(n),null;case 13:if($(V),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(x(340));it()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return $(V),null;case 4:return ct(),null;case 10:return Fa(n.type._context),null;case 22:case 23:return Ja(),null;case 24:return null;default:return null}}var Ns=!1,ae=!1,Cf=typeof WeakSet=="function"?WeakSet:Set,P=null;function qn(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(s){W(e,n,s)}else t.current=null}function Jl(e,n,t){try{t()}catch(s){W(e,n,s)}}var ci=!1;function Pf(e,n){if(Al=Xs,e=$u(),Oa(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var s=t.getSelection&&t.getSelection();if(s&&s.rangeCount!==0){t=s.anchorNode;var r=s.anchorOffset,l=s.focusNode;s=s.focusOffset;try{t.nodeType,l.nodeType}catch{t=null;break e}var a=0,o=-1,i=-1,u=0,d=0,f=e,m=null;n:for(;;){for(var v;f!==t||r!==0&&f.nodeType!==3||(o=a+r),f!==l||s!==0&&f.nodeType!==3||(i=a+s),f.nodeType===3&&(a+=f.nodeValue.length),(v=f.firstChild)!==null;)m=f,f=v;for(;;){if(f===e)break n;if(m===t&&++u===r&&(o=a),m===l&&++d===s&&(i=a),(v=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=v}t=o===-1||i===-1?null:{start:o,end:i}}else t=null}t=t||{start:0,end:0}}else t=null;for(Fl={focusedElem:e,selectionRange:t},Xs=!1,P=n;P!==null;)if(n=P,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,P=e;else for(;P!==null;){n=P;try{var j=n.alternate;if(n.flags&1024)switch(n.tag){case 0:case 11:case 15:break;case 1:if(j!==null){var w=j.memoizedProps,E=j.memoizedState,p=n.stateNode,c=p.getSnapshotBeforeUpdate(n.elementType===n.type?w:Ie(n.type,w),E);p.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var h=n.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(x(163))}}catch(g){W(n,n.return,g)}if(e=n.sibling,e!==null){e.return=n.return,P=e;break}P=n.return}return j=ci,ci=!1,j}function Mt(e,n,t){var s=n.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&e)===e){var l=r.destroy;r.destroy=void 0,l!==void 0&&Jl(n,t,l)}r=r.next}while(r!==s)}}function Er(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var s=t.create;t.destroy=s()}t=t.next}while(t!==n)}}function ea(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function Ac(e){var n=e.alternate;n!==null&&(e.alternate=null,Ac(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[be],delete n[Zt],delete n[Ul],delete n[uf],delete n[cf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fc(e){return e.tag===5||e.tag===3||e.tag===4}function pi(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function na(e,n,t){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=qs));else if(s!==4&&(e=e.child,e!==null))for(na(e,n,t),e=e.sibling;e!==null;)na(e,n,t),e=e.sibling}function ta(e,n,t){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(ta(e,n,t),e=e.sibling;e!==null;)ta(e,n,t),e=e.sibling}var ne=null,ze=!1;function en(e,n,t){for(t=t.child;t!==null;)Mc(e,n,t),t=t.sibling}function Mc(e,n,t){if(Ve&&typeof Ve.onCommitFiberUnmount=="function")try{Ve.onCommitFiberUnmount(vr,t)}catch{}switch(t.tag){case 5:ae||qn(t,n);case 6:var s=ne,r=ze;ne=null,en(e,n,t),ne=s,ze=r,ne!==null&&(ze?(e=ne,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):ne.removeChild(t.stateNode));break;case 18:ne!==null&&(ze?(e=ne,t=t.stateNode,e.nodeType===8?nl(e.parentNode,t):e.nodeType===1&&nl(e,t),Qt(e)):nl(ne,t.stateNode));break;case 4:s=ne,r=ze,ne=t.stateNode.containerInfo,ze=!0,en(e,n,t),ne=s,ze=r;break;case 0:case 11:case 14:case 15:if(!ae&&(s=t.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){r=s=s.next;do{var l=r,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&Jl(t,n,a),r=r.next}while(r!==s)}en(e,n,t);break;case 1:if(!ae&&(qn(t,n),s=t.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=t.memoizedProps,s.state=t.memoizedState,s.componentWillUnmount()}catch(o){W(t,n,o)}en(e,n,t);break;case 21:en(e,n,t);break;case 22:t.mode&1?(ae=(s=ae)||t.memoizedState!==null,en(e,n,t),ae=s):en(e,n,t);break;default:en(e,n,t)}}function di(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new Cf),n.forEach(function(s){var r=Af.bind(null,e,s);t.has(s)||(t.add(s),s.then(r,r))})}}function Re(e,n){var t=n.deletions;if(t!==null)for(var s=0;s r&&(r=a),s&=~l}if(s=r,s=K()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Tf(s/1960))-s,10 e?16:e,on===null)var s=!1;else{if(e=on,on=null,pr=0,z&6)throw Error(x(331));var r=z;for(z|=4,P=e.current;P!==null;){var l=P,a=l.child;if(P.flags&16){var o=l.deletions;if(o!==null){for(var i=0;iK()-Za?Ln(e,0):Ga|=t),ve(e,n)}function Qc(e,n){n===0&&(e.mode&1?(n=js,js<<=1,!(js&130023424)&&(js=4194304)):n=1);var t=ce();e=Ze(e,n),e!==null&&(os(e,n,t),ve(e,t))}function Df(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Qc(e,t)}function Af(e,n){var t=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(t=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(x(314))}s!==null&&s.delete(n),Qc(e,t)}var Kc;Kc=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||me.current)he=!0;else{if(!(e.lanes&t)&&!(n.flags&128))return he=!1,_f(e,n,t);he=!!(e.flags&131072)}else he=!1,b&&n.flags&1048576&&Gu(n,tr,n.index);switch(n.lanes=0,n.tag){case 2:var s=n.type;Us(e,n),e=n.pendingProps;var r=ot(n,oe.current);rt(n,t),r=Ha(null,n,s,e,r,t);var l=Wa();return n.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,ye(s)?(l=!0,er(n)):l=!1,n.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,$a(n),r.updater=_r,n.stateNode=r,r._reactInternals=n,Ql(n,s,e,t),n=Xl(null,n,s,!0,l,t)):(n.tag=0,b&&l&&Ra(n),ue(null,n,r,t),n=n.child),n;case 16:s=n.elementType;e:{switch(Us(e,n),e=n.pendingProps,r=s._init,s=r(s._payload),n.type=s,r=n.tag=Mf(s),e=Ie(s,e),r){case 0:n=Yl(null,n,s,e,t);break e;case 1:n=oi(null,n,s,e,t);break e;case 11:n=li(null,n,s,e,t);break e;case 14:n=ai(null,n,s,Ie(s.type,e),t);break e}throw Error(x(306,s,""))}return n;case 0:return s=n.type,r=n.pendingProps,r=n.elementType===s?r:Ie(s,r),Yl(e,n,s,r,t);case 1:return s=n.type,r=n.pendingProps,r=n.elementType===s?r:Ie(s,r),oi(e,n,s,r,t);case 3:e:{if(Lc(n),e===null)throw Error(x(387));s=n.pendingProps,l=n.memoizedState,r=l.element,ec(e,n),lr(n,s,null,t);var a=n.memoizedState;if(s=a.element,l.isDehydrated)if(l={element:s,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},n.updateQueue.baseState=l,n.memoizedState=l,n.flags&256){r=pt(Error(x(423)),n),n=ii(e,n,s,t,r);break e}else if(s!==r){r=pt(Error(x(424)),n),n=ii(e,n,s,t,r);break e}else for(we=fn(n.stateNode.containerInfo.firstChild),xe=n,b=!0,De=null,t=rc(n,null,s,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(it(),s===r){n=qe(e,n,t);break e}ue(e,n,s,t)}n=n.child}return n;case 5:return lc(n),e===null&&Bl(n),s=n.type,r=n.pendingProps,l=e!==null?e.memoizedProps:null,a=r.children,Ml(s,r)?a=null:l!==null&&Ml(s,l)&&(n.flags|=32),Tc(e,n),ue(e,n,a,t),n.child;case 6:return e===null&&Bl(n),null;case 13:return Oc(e,n,t);case 4:return Ua(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=ut(n,null,s,t):ue(e,n,s,t),n.child;case 11:return s=n.type,r=n.pendingProps,r=n.elementType===s?r:Ie(s,r),li(e,n,s,r,t);case 7:return ue(e,n,n.pendingProps,t),n.child;case 8:return ue(e,n,n.pendingProps.children,t),n.child;case 12:return ue(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(s=n.type._context,r=n.pendingProps,l=n.memoizedProps,a=r.value,F(sr,s._currentValue),s._currentValue=a,l!==null)if(Me(l.value,a)){if(l.children===r.children&&!me.current){n=qe(e,n,t);break e}}else for(l=n.child,l!==null&&(l.return=n);l!==null;){var o=l.dependencies;if(o!==null){a=l.child;for(var i=o.firstContext;i!==null;){if(i.context===s){if(l.tag===1){i=Ye(-1,t&-t),i.tag=2;var u=l.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?i.next=i:(i.next=d.next,d.next=i),u.pending=i}}l.lanes|=t,i=l.alternate,i!==null&&(i.lanes|=t),Hl(l.return,t,n),o.lanes|=t;break}i=i.next}}else if(l.tag===10)a=l.type===n.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(x(341));a.lanes|=t,o=a.alternate,o!==null&&(o.lanes|=t),Hl(a,t,n),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===n){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}ue(e,n,r.children,t),n=n.child}return n;case 9:return r=n.type,s=n.pendingProps.children,rt(n,t),r=Te(r),s=s(r),n.flags|=1,ue(e,n,s,t),n.child;case 14:return s=n.type,r=Ie(s,n.pendingProps),r=Ie(s.type,r),ai(e,n,s,r,t);case 15:return Pc(e,n,n.type,n.pendingProps,t);case 17:return s=n.type,r=n.pendingProps,r=n.elementType===s?r:Ie(s,r),Us(e,n),n.tag=1,ye(s)?(e=!0,er(n)):e=!1,rt(n,t),tc(n,s,r),Ql(n,s,r,t),Xl(null,n,s,!0,e,t);case 19:return Rc(e,n,t);case 22:return Nc(e,n,t)}throw Error(x(156,n.tag))};function Yc(e,n){return wu(e,n)}function Ff(e,n,t,s){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,n,t,s){return new Ff(e,n,t,s)}function no(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Mf(e){if(typeof e=="function")return no(e)?1:0;if(e!=null){if(e=e.$$typeof,e===wa)return 11;if(e===xa)return 14}return 2}function vn(e,n){var t=e.alternate;return t===null?(t=Pe(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function Bs(e,n,t,s,r,l){var a=2;if(s=e,typeof e=="function")no(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Bn:return On(t.children,r,l,n);case ja:a=8,r|=8;break;case yl:return e=Pe(12,t,n,r|2),e.elementType=yl,e.lanes=l,e;case vl:return e=Pe(13,t,n,r),e.elementType=vl,e.lanes=l,e;case gl:return e=Pe(19,t,n,r),e.elementType=gl,e.lanes=l,e;case su:return Pr(t,r,l,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case nu:a=10;break e;case tu:a=9;break e;case wa:a=11;break e;case xa:a=14;break e;case tn:a=16,s=null;break e}throw Error(x(130,e==null?e:typeof e,""))}return n=Pe(a,t,n,r),n.elementType=e,n.type=s,n.lanes=l,n}function On(e,n,t,s){return e=Pe(7,e,s,n),e.lanes=t,e}function Pr(e,n,t,s){return e=Pe(22,e,s,n),e.elementType=su,e.lanes=t,e.stateNode={isHidden:!1},e}function ul(e,n,t){return e=Pe(6,e,null,n),e.lanes=t,e}function cl(e,n,t){return n=Pe(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function $f(e,n,t,s,r){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hr(0),this.expirationTimes=Hr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hr(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function to(e,n,t,s,r,l,a,o,i){return e=new $f(e,n,t,o,i),n===1?(n=1,l===!0&&(n|=8)):n=0,l=Pe(3,null,null,n),e.current=l,l.stateNode=e,l.memoizedState={element:s,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},$a(l),e}function Uf(e,n,t){var s=3 "u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qc)}catch(e){console.error(e)}}qc(),Gi.exports=_e;var Wf=Gi.exports,Jc,ep,wi=Wf;ep=wi.createRoot,Jc=wi.hydrateRoot;const np={theme:"light",sideNav:!0,initialized:!1},tp=S.createContext({state:np,init:e=>{},setTheme:e=>{},toggleSideNav:()=>{}});function ao(){return S.useContext(tp)}function xi(e,n){try{localStorage.setItem(e,n)}catch(t){console.error(t)}}const ki=({children:e})=>{const[n,t]=S.useState(np);function s(o){o=="dark"?(document.body.classList.remove("light"),document.body.classList.add("dark")):(document.body.classList.remove("dark"),document.body.classList.add("light"))}function r(o){try{const i=localStorage.getItem("theme")||"light";let u=o.width>=500;{const d=localStorage.getItem("sideNav");d&&(u=d=="true")}s(i),t(d=>({...d,theme:i,sideNav:u}))}catch(i){console.error(i)}t(i=>({...i,initialized:!0}))}function l(o){s(o),t({...n,theme:o}),xi("theme",o)}function a(){const o=!n.sideNav;t({...n,sideNav:o}),xi("sideNav",o)}return y.jsx(tp.Provider,{value:S.useMemo(()=>({state:n,init:r,setTheme:l,toggleSideNav:a}),[n]),children:e})};/** - * @remix-run/router v1.14.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function rs(){return rs=Object.assign?Object.assign.bind():function(e){for(var n=1;n "u")throw new Error(n)}function oo(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Kf(){return Math.random().toString(36).substr(2,8)}function Si(e,n){return{usr:e.state,key:e.key,idx:n}}function oa(e,n,t,s){return t===void 0&&(t=null),rs({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof n=="string"?yt(n):n,{state:t,key:n&&n.key||s||Kf()})}function sp(e){let{pathname:n="/",search:t="",hash:s=""}=e;return t&&t!=="?"&&(n+=t.charAt(0)==="?"?t:"?"+t),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function yt(e){let n={};if(e){let t=e.indexOf("#");t>=0&&(n.hash=e.substr(t),e=e.substr(0,t));let s=e.indexOf("?");s>=0&&(n.search=e.substr(s),e=e.substr(0,s)),e&&(n.pathname=e)}return n}function Yf(e,n,t,s){s===void 0&&(s={});let{window:r=document.defaultView,v5Compat:l=!1}=s,a=r.history,o=un.Pop,i=null,u=d();u==null&&(u=0,a.replaceState(rs({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function f(){o=un.Pop;let E=d(),p=E==null?null:E-u;u=E,i&&i({action:o,location:w.location,delta:p})}function m(E,p){o=un.Push;let c=oa(w.location,E,p);t&&t(c,E),u=d()+1;let h=Si(c,u),g=w.createHref(c);try{a.pushState(h,"",g)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;r.location.assign(g)}l&&i&&i({action:o,location:w.location,delta:1})}function v(E,p){o=un.Replace;let c=oa(w.location,E,p);t&&t(c,E),u=d();let h=Si(c,u),g=w.createHref(c);a.replaceState(h,"",g),l&&i&&i({action:o,location:w.location,delta:0})}function j(E){let p=r.location.origin!=="null"?r.location.origin:r.location.href,c=typeof E=="string"?E:sp(E);return Z(p,"No window.location.(origin|href) available to create URL for href: "+c),new URL(c,p)}let w={get action(){return o},get location(){return e(r,a)},listen(E){if(i)throw new Error("A history only accepts one active listener");return r.addEventListener(_i,f),i=E,()=>{r.removeEventListener(_i,f),i=null}},createHref(E){return n(r,E)},createURL:j,encodeLocation(E){let p=j(E);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:m,replace:v,go(E){return a.go(E)}};return w}var Ei;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ei||(Ei={}));function Xf(e,n,t){t===void 0&&(t="/");let s=typeof n=="string"?yt(n):n,r=op(s.pathname||"/",t);if(r==null)return null;let l=rp(e);Gf(l);let a=null;for(let o=0;a==null&&o {let i={relativePath:o===void 0?l.path||"":o,caseSensitive:l.caseSensitive===!0,childrenIndex:a,route:l};i.relativePath.startsWith("/")&&(Z(i.relativePath.startsWith(s),'Absolute route path "'+i.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),i.relativePath=i.relativePath.slice(s.length));let u=Rn([s,i.relativePath]),d=t.concat(i);l.children&&l.children.length>0&&(Z(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),rp(l.children,n,d,u)),!(l.path==null&&!l.index)&&n.push({path:u,score:sh(u,l.index),routesMeta:d})};return e.forEach((l,a)=>{var o;if(l.path===""||!((o=l.path)!=null&&o.includes("?")))r(l,a);else for(let i of lp(l.path))r(l,a,i)}),n}function lp(e){let n=e.split("/");if(n.length===0)return[];let[t,...s]=n,r=t.endsWith("?"),l=t.replace(/\?$/,"");if(s.length===0)return r?[l,""]:[l];let a=lp(s.join("/")),o=[];return o.push(...a.map(i=>i===""?l:[l,i].join("/"))),r&&o.push(...a),o.map(i=>e.startsWith("/")&&i===""?"/":i)}function Gf(e){e.sort((n,t)=>n.score!==t.score?t.score-n.score:rh(n.routesMeta.map(s=>s.childrenIndex),t.routesMeta.map(s=>s.childrenIndex)))}const Zf=/^:\w+$/,qf=3,Jf=2,eh=1,nh=10,th=-2,Ci=e=>e==="*";function sh(e,n){let t=e.split("/"),s=t.length;return t.some(Ci)&&(s+=th),n&&(s+=Jf),t.filter(r=>!Ci(r)).reduce((r,l)=>r+(Zf.test(l)?qf:l===""?eh:nh),s)}function rh(e,n){return e.length===n.length&&e.slice(0,-1).every((s,r)=>s===n[r])?e[e.length-1]-n[n.length-1]:0}function lh(e,n){let{routesMeta:t}=e,s={},r="/",l=[];for(let a=0;a {let{paramName:m,isOptional:v}=d;if(m==="*"){let w=o[f]||"";a=l.slice(0,l.length-w.length).replace(/(.)\/+$/,"$1")}const j=o[f];return v&&!j?u[m]=void 0:u[m]=ih(j||"",m),u},{}),pathname:l,pathnameBase:a,pattern:e}}function ah(e,n,t){n===void 0&&(n=!1),t===void 0&&(t=!0),oo(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:(\w+)(\?)?/g,(a,o,i)=>(s.push({paramName:o,isOptional:i!=null}),i?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,n?void 0:"i"),s]}function oh(e){try{return decodeURI(e)}catch(n){return oo(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+n+").")),e}}function ih(e,n){try{return decodeURIComponent(e)}catch(t){return oo(!1,'The value for the URL param "'+n+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+t+").")),e}}function op(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let t=n.endsWith("/")?n.length-1:n.length,s=e.charAt(t);return s&&s!=="/"?null:e.slice(t)||"/"}function uh(e,n){n===void 0&&(n="/");let{pathname:t,search:s="",hash:r=""}=typeof e=="string"?yt(e):e;return{pathname:t?t.startsWith("/")?t:ch(t,n):n,search:mh(s),hash:yh(r)}}function ch(e,n){let t=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function pl(e,n,t,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+n+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+t+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function ph(e){return e.filter((n,t)=>t===0||n.route.path&&n.route.path.length>0)}function dh(e,n){let t=ph(e);return n?t.map((s,r)=>r===e.length-1?s.pathname:s.pathnameBase):t.map(s=>s.pathnameBase)}function fh(e,n,t,s){s===void 0&&(s=!1);let r;typeof e=="string"?r=yt(e):(r=rs({},e),Z(!r.pathname||!r.pathname.includes("?"),pl("?","pathname","search",r)),Z(!r.pathname||!r.pathname.includes("#"),pl("#","pathname","hash",r)),Z(!r.search||!r.search.includes("#"),pl("#","search","hash",r)));let l=e===""||r.pathname==="",a=l?"/":r.pathname,o;if(a==null)o=t;else{let f=n.length-1;if(!s&&a.startsWith("..")){let m=a.split("/");for(;m[0]==="..";)m.shift(),f-=1;r.pathname=m.join("/")}o=f>=0?n[f]:"/"}let i=uh(r,o),u=a&&a!=="/"&&a.endsWith("/"),d=(l||a===".")&&t.endsWith("/");return!i.pathname.endsWith("/")&&(u||d)&&(i.pathname+="/"),i}const Rn=e=>e.join("/").replace(/\/\/+/g,"/"),hh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),mh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,yh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function vh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const ip=["post","put","patch","delete"];new Set(ip);const gh=["get",...ip];new Set(gh);/** - * React Router v6.21.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ls(){return ls=Object.assign?Object.assign.bind():function(e){for(var n=1;n {o.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!o.current)return;if(typeof u=="number"){s.go(u);return}let f=fh(u,JSON.parse(a),l,d.relative==="path");e==null&&n!=="/"&&(f.pathname=f.pathname==="/"?n:Rn([n,f.pathname])),(d.replace?s.replace:s.push)(f,d.state,d)},[n,s,a,l,e])}function kh(e,n){return _h(e,n)}function _h(e,n,t,s){zr()||Z(!1);let{navigator:r}=S.useContext(Rr),{matches:l}=S.useContext(vt),a=l[l.length-1],o=a?a.params:{};a&&a.pathname;let i=a?a.pathnameBase:"/";a&&a.route;let u=Dr(),d;if(n){var f;let E=typeof n=="string"?yt(n):n;i==="/"||(f=E.pathname)!=null&&f.startsWith(i)||Z(!1),d=E}else d=u;let m=d.pathname||"/",v=i==="/"?m:m.slice(i.length)||"/",j=Xf(e,{pathname:v}),w=Nh(j&&j.map(E=>Object.assign({},E,{params:Object.assign({},o,E.params),pathname:Rn([i,r.encodeLocation?r.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?i:Rn([i,r.encodeLocation?r.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),l,t,s);return n&&w?S.createElement(Ir.Provider,{value:{location:ls({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:un.Pop}},w):w}function Sh(){let e=Rh(),n=vh(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),t=e instanceof Error?e.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},n),t?S.createElement("pre",{style:r},t):null,null)}const Eh=S.createElement(Sh,null);class Ch extends S.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,t){return t.location!==n.location||t.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:t.error,location:t.location,revalidation:n.revalidation||t.revalidation}}componentDidCatch(n,t){console.error("React Router caught the following error during render",n,t)}render(){return this.state.error!==void 0?S.createElement(vt.Provider,{value:this.props.routeContext},S.createElement(up.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ph(e){let{routeContext:n,match:t,children:s}=e,r=S.useContext(io);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),S.createElement(vt.Provider,{value:n},s)}function Nh(e,n,t,s){var r;if(n===void 0&&(n=[]),t===void 0&&(t=null),s===void 0&&(s=null),e==null){var l;if((l=t)!=null&&l.errors)e=t.matches;else return null}let a=e,o=(r=t)==null?void 0:r.errors;if(o!=null){let d=a.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id]));d>=0||Z(!1),a=a.slice(0,Math.min(a.length,d+1))}let i=!1,u=-1;if(t&&s&&s.v7_partialHydration)for(let d=0;d =0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,f,m)=>{let v,j=!1,w=null,E=null;t&&(v=o&&f.route.id?o[f.route.id]:void 0,w=f.route.errorElement||Eh,i&&(u<0&&m===0?(zh("route-fallback",!1),j=!0,E=null):u===m&&(j=!0,E=f.route.hydrateFallbackElement||null)));let p=n.concat(a.slice(0,m+1)),c=()=>{let h;return v?h=w:j?h=E:f.route.Component?h=S.createElement(f.route.Component,null):f.route.element?h=f.route.element:h=d,S.createElement(Ph,{match:f,routeContext:{outlet:d,matches:p,isDataRoute:t!=null},children:h})};return t&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?S.createElement(Ch,{location:t.location,revalidation:t.revalidation,component:w,error:v,children:c(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):c()},null)}var pp=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(pp||{}),hr=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(hr||{});function Th(e){let n=S.useContext(io);return n||Z(!1),n}function Lh(e){let n=S.useContext(jh);return n||Z(!1),n}function Oh(e){let n=S.useContext(vt);return n||Z(!1),n}function dp(e){let n=Oh(),t=n.matches[n.matches.length-1];return t.route.id||Z(!1),t.route.id}function Rh(){var e;let n=S.useContext(up),t=Lh(hr.UseRouteError),s=dp(hr.UseRouteError);return n!==void 0?n:(e=t.errors)==null?void 0:e[s]}function Ih(){let{router:e}=Th(pp.UseNavigateStable),n=dp(hr.UseNavigateStable),t=S.useRef(!1);return cp(()=>{t.current=!0}),S.useCallback(function(r,l){l===void 0&&(l={}),t.current&&(typeof r=="number"?e.navigate(r):e.navigate(r,ls({fromRouteId:n},l)))},[e,n])}const Pi={};function zh(e,n,t){!n&&!Pi[e]&&(Pi[e]=!0)}function fp(e){Z(!1)}function Dh(e){let{basename:n="/",children:t=null,location:s,navigationType:r=un.Pop,navigator:l,static:a=!1,future:o}=e;zr()&&Z(!1);let i=n.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:i,navigator:l,static:a,future:ls({v7_relativeSplatPath:!1},o)}),[i,o,l,a]);typeof s=="string"&&(s=yt(s));let{pathname:d="/",search:f="",hash:m="",state:v=null,key:j="default"}=s,w=S.useMemo(()=>{let E=op(d,i);return E==null?null:{location:{pathname:E,search:f,hash:m,state:v,key:j},navigationType:r}},[i,d,f,m,v,j,r]);return w==null?null:S.createElement(Rr.Provider,{value:u},S.createElement(Ir.Provider,{children:t,value:w}))}function Ah(e){let{children:n,location:t}=e;return kh(ia(n),t)}new Promise(()=>{});function ia(e,n){n===void 0&&(n=[]);let t=[];return S.Children.forEach(e,(s,r)=>{if(!S.isValidElement(s))return;let l=[...n,r];if(s.type===S.Fragment){t.push.apply(t,ia(s.props.children,l));return}s.type!==fp&&Z(!1),!s.props.index||!s.props.children||Z(!1);let a={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(a.children=ia(s.props.children,l)),t.push(a)}),t}/** - * React Router DOM v6.21.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ua(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,t)=>{let s=e[t];return n.concat(Array.isArray(s)?s.map(r=>[t,r]):[[t,s]])},[]))}function Fh(e,n){let t=ua(e);return n&&n.forEach((s,r)=>{t.has(r)||n.getAll(r).forEach(l=>{t.append(r,l)})}),t}const Mh="startTransition",Ni=zp[Mh];function $h(e){let{basename:n,children:t,future:s,window:r}=e,l=S.useRef();l.current==null&&(l.current=Qf({window:r,v5Compat:!0}));let a=l.current,[o,i]=S.useState({action:a.action,location:a.location}),{v7_startTransition:u}=s||{},d=S.useCallback(f=>{u&&Ni?Ni(()=>i(f)):i(f)},[i,u]);return S.useLayoutEffect(()=>a.listen(d),[a,d]),S.createElement(Dh,{basename:n,children:t,location:o.location,navigationType:o.action,navigator:a,future:s})}var Ti;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ti||(Ti={}));var Li;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Li||(Li={}));function Uh(e){let n=S.useRef(ua(e)),t=S.useRef(!1),s=Dr(),r=S.useMemo(()=>Fh(s.search,t.current?null:n.current),[s.search]),l=wh(),a=S.useCallback((o,i)=>{const u=ua(typeof o=="function"?o(r):o);t.current=!0,l("?"+u,i)},[l,r]);return[r,a]}const bh="_component_nqcni_1",Vh="_sideNav_nqcni_6",Bh="_main_nqcni_13",Hh="_children_nqcni_21",Os={component:bh,sideNav:Vh,main:Bh,children:Hh},Wh="_list_1ltry_1",Qh="_title_1ltry_6",Kh="_listItem_1ltry_11",Yh="_listItemActive_1ltry_18",Xh="_link_1ltry_26",bn={list:Wh,title:Qh,listItem:Kh,listItemActive:Yh,link:Xh},Gh=[{lang:"Simplified Chinese",url:"https://github.com/Web3-Club/vyper-by-example_Chinese"}],Zh=[{path:"hello-world",title:"Hello World"},{path:"values",title:"Data Types - Values"},{path:"references",title:"Data Types - References"},{path:"dynamic-arrays",title:"Dynamic Arrays"},{path:"function",title:"Function"},{path:"internal-external-functions",title:"Internal and External Functions"},{path:"view-pure-functions",title:"View and Pure Functions"},{path:"constructor",title:"Constructor"},{path:"private-public-state-variables",title:"Private and Public State Variables"},{path:"constants",title:"Constants"},{path:"immutable",title:"Immutable"},{path:"if-else",title:"If Else"},{path:"for-loop",title:"For Loop"},{path:"error",title:"Error"},{path:"event",title:"Event"},{path:"payable",title:"Payable"},{path:"default-function",title:"Default Function"},{path:"send-ether",title:"Send Ether"},{path:"raw-call",title:"Raw Call"},{path:"delegate-call",title:"Delegate Call"},{path:"interface",title:"Interface"},{path:"hash-function",title:"Hash Function"},{path:"verify-signature",title:"Verify Signature"},{path:"create-new-contract",title:"Create New Contract"},{path:"re-entrancy-lock",title:"Re-entrancy Lock"},{path:"self-destruct",title:"Self Destruct"},{path:"print",title:"Debug with Print"},{path:"unsafe-math",title:"Unsafe Math"}],qh=[{path:"curve-swap",title:"Curve Swap"},{path:"curve-liquidity",title:"Curve Add and Remove Liquidity"}],uo=[{title:"",routes:Zh.map(e=>({...e,path:`/${e.path}`}))},{title:"DeFi",routes:qh.map(e=>({...e,path:`/defi/${e.path}`}))}],mr=uo.map(({routes:e})=>e).flat(),Jh=mr.reduce((e,n,t)=>(e[n.path]=t,e),{});function em(e){const n=Jh[e];if(n>=0){const t=mr[n-1]||null,s=mr[n+1]||null;return{prev:t,next:s}}return{prev:null,next:null}}const nm=({onClick:e})=>{const n=Dr();function t(s,r){s.preventDefault(),e(r)}return y.jsxs(y.Fragment,{children:[y.jsx("h3",{className:bn.category,children:"Basic"}),uo.map(({routes:s,title:r},l)=>y.jsxs("div",{children:[r&&y.jsx("h3",{className:bn.title,children:r}),y.jsx("ul",{className:bn.list,children:s.map(({path:a,title:o})=>{const i=!!ap(a,n.pathname);return y.jsx("li",{className:i?bn.listItemActive:bn.listItem,children:y.jsx("a",{className:bn.link,href:a,onClick:u=>t(u,a),children:o})},a)})})]},l))]})},tm=({size:e,className:n="",onClick:t})=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:2,stroke:"currentColor",className:n,width:e,height:e,onClick:t,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})}),sm="_component_15x91_1",rm="_a_15x91_13",lm="_center_15x91_16",am="_logo_15x91_21",om="_header_15x91_24",im="_mode_15x91_28",um="_hamburger_15x91_33",nn={component:sm,a:rm,center:lm,logo:am,header:om,mode:im,hamburger:um},cm=({size:e,className:n=""})=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#fff",viewBox:"0 0 438.277 438.277",width:e,height:e,className:n,children:y.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"})}),pm=({size:e,className:n=""})=>y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 302.4 302.4",width:e,height:e,className:n,children:[y.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}),y.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})]}),dm=({size:e,className:n="",fill:t})=>y.jsxs("svg",{"data-name":"Transparent Logo",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2048 1773.62",width:e,height:e,className:n,fill:t,children:[y.jsx("path",{style:{opacity:.8},d:"m1024 886.81-256 443.41 256 443.4 256-443.4-256-443.41z"}),y.jsx("path",{style:{opacity:.6},d:"m1280 443.41-256 443.4 256 443.41 256-443.41-256-443.4zM768 443.41l-256 443.4 256 443.41 256-443.41-256-443.4z"}),y.jsx("path",{style:{opacity:.45},d:"m1536 0-256 443.41 256 443.4 256-443.4L1536 0zM1152 221.7H896L768 443.41l256 443.4 256-443.4-128-221.71zM512 0 256 443.41l256 443.4 256-443.4L512 0z"}),y.jsx("path",{style:{opacity:.3},d:"M1792 443.4 2048 0h-512l256 443.4zM256 443.4 512 0H0l256 443.4z"})]});function fm(){const{state:e,setTheme:n,toggleSideNav:t}=ao();function s(){n(e.theme=="light"?"dark":"light")}return y.jsxs("div",{className:nn.component,children:[y.jsx(tm,{size:20,className:nn.hamburger,onClick:t}),y.jsxs("div",{className:nn.center,children:[y.jsx("a",{href:"/",className:nn.a,children:y.jsx(dm,{className:nn.logo,size:30,fill:e.theme=="dark"?"rgb(255, 0, 255)":"currentColor"})}),y.jsx("h3",{className:nn.header,children:y.jsx("a",{href:"/",className:nn.a,children:"Vyper by Example"})})]}),y.jsx("button",{className:nn.mode,onClick:s,children:e.theme=="dark"?y.jsx(cm,{size:20}):y.jsx(pm,{size:20})})]})}const hm="_component_h47vh_1",mm="_row_h47vh_8",ym="_bar_h47vh_13",vm="_to_h47vh_21",gm="_social_h47vh_24",jm="_sce_h47vh_29",wm="_telegram_h47vh_34",xm="_discord_h47vh_38",km="_youTube_h47vh_42",ge={component:hm,row:mm,bar:ym,to:vm,social:gm,sce:jm,telegram:wm,discord:xm,youTube:km},_m="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK0AAADACAYAAAB2xePHAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUARnJpIDE5IEZlYiAyMDIxIDA2OjI5OjE1IEFNIEpTVJ0PYF0AAA5FSURBVHic7Z3Li2RXHce/5956d1dXV/ekk0AmBCQORLIZRSQm2cSJQUwWMiAJJBo3uhAh/huBBCQLXWhMAgnCrBJQ40SQPHyAzia4mOhCbITY8+iurld3Vd17XHTa6a7p6rqP3z3n9zt1Pqt59ONU1bdunfs7n9856r7PPaDh8QgisD0AjyctPrQecfjQesThQ+sRhw+tRxw+tB5x+NB6xOFD6xGHD61HHD60HnH40HrE4UPrEYcPrUccPrQecfjQesRRsj0A04zvGSO+e2x7GPnZC1D9uGZ7FFZYqNDqksb1F/8DBFr8Z0z4aQntF+9E+d8V20MxjvCXLh27z91AdM8Y0ls11Egh6IQYPLFreyhWWJjQRq0I3W/vHPz5rjEQyY1uuFWCgsLk3jH2HxzaHo5xFia0Oz/cAhoHQVWBghb6qar6AYJ++P+/Dx7vQpfkvgGzsBChHd+3j+GF3rF/izYmwMTSgHJQ2jp+GxK3I+w91Lc0GjssRGi3f7wFhMf/TWmFuBnbGVBGgp0QanT7SzZ4tId4KbIwIjs4H9rhV3rYP3/yvE+3YkBK9StWCK/PKPbUNAaP9U7+PwdxPrQ7P7oOpdXM/4/ORNCa/5wwvBFCRbMfx/6XBphsSHkH5sPp0HYvbiM6O+eFrOtTw8ABNVYItsPTvyjAwpTAnA1tXIux+92bib42umsCMJ7ehtdKp35aHDL+/Aij+/cMjMguzoa28/3rB3PWJJQAHfCcIqhhgKA75yp7hMETXbaPhQonQzvZGKP/VCfV90R38iyBhVvpVtqjOyfY/+KgoNHwwMnQ7rywBaRcPFBKIW7wukIFuyGCvfQv0eCxHuIq4/lOTpwL7f4XBhh+NVuxXa9FwJjJTZnG7BLXvG9djjF81N0SmHOh3X7hGpTKHry4PWFRAgu3Q6gcb6C9h/qI2gznOwQ4Fdr+4x1Mzo1y/Qy9rKEmlq+2kUJwI6c1Wj7wElzEmdDGYYzOD26Q/KxoYwId27vahtdKUHH+N87+g0OM7833JuaIM6Htfucm4juI1t+rAGDnanvgytK8LArKyQUHJ0J71JUl+5mWnNtDV5YKF51bJ0J71JWlwoZzO+3KUuGacys+tCe5slSYdm6nXVkqXHNuxYf2JFeWCpPO7SxXlgqXnFvRoT3NlaXCiHN7mitLhUPOrejQznNlqYjbxTq381xZKlxxbsWGNpErS0SRCw6JXFkqAmDwNfkLDiJDm8aVpaKoBYekriwVowf2xC84iAxtKleWigIWHNK6siS/04EFB3GhzeLKUkG94JDWlaVC+oKDuNBmcWWpoFxwyOrKUiF5wUFUaPO4slSQLDjkcGWpkLzgICq0eV1ZCigWHPK6slRIXXAQE1oKV5aKXAsOFK4sFUIXHESEltKVpSLrJh9UriwVEhccRISW1JWlIsMmH5SuLBkCN/lg9gzeThGuLBVpN/mgdmWpkLbJB/vQFuHKkpFik4+iXFkqJG3ywTq0RbqyVCTd5KMoV5YKSZt8sA5tka4sFUk2+SjalaVCyiYfbJ9JE64sFadu8mHClSVCyiYfbENrypWlYtYmH6ZcWSokbPLBMrQmXVkqTnJujbqyVAjY5INdaG24slRMO7emXVkquG/ywS60VlxZKo44tzZcWSq4O7esQmvTlaXi0Lm15cpSwdm5ZfXMDh/vQUUBwPO5SoQCUPmkjvoflm0PJT9VnosNrELbeGcFvW90oBtCpwc4uPlqvXIGpa2y7aE4C6vpQdgJ0by0ansYuVh6p+UDWzCsQgscvOhS54NBJ8Sy8DedBNiFVo0VWj9ftz2MTDTfbCMYsHtKnYPlM1z7yxKqV+q2h5GK0mYZjctN28NYCFiGFgBWXl0HmHnfp7Hy6jqrjgSXYRva8mYFjcsrtoeRiOqVOmpXGraHsTCwDS0ANN9qQ3GfI0affSp4jME6ERJKYI3LKyhvWto9ZEFhHVqAdwlMDQI032rbHsbCwT60aqyw8vqa7WGcSPPSKsKOTClGMuxDCwD1D5dRuVq1PYxjhFslLL3Tsj2MhUREaAFg5Re8bnZWXl9jsbXRIiImtJWrNdQ/4GFOVa5WUf+Qx1gWETGhBYDmG20WVzduV/1FQ1RoS1tl6/PI+gfLqFytWR3DoiMqtACwfGkVgaU7djVWaL7hS1y2ERfaYBCg+aad4HhXlgfiQgsAjctNlDbNhifcKnlXlgkiQ6tiZXy9f+X1Ne/KMkHsq1C70jDm3PoSFy/EhhYw59xyLXHpCs9u2aIRHVoTzi3XElf/67vof1P2HhFZER1aoFjnlmuJK27E6D6zje7FHUQtQe0dRIgPbZHOLdcSV+/iDuJWBN2I0X162/ZwjCM+tEAxzi3XdvCoFaH/5K1pweDCLsZn+W4WVwROhLYI55ZrO3j36W3o8pEbsBDYfZ7XcVVFw+9VyQilc8u1HXx8doTBhdt3M9w/P8TeeRnnJVDgTGgButIU13bw3edvzDyDYvf5G2JOp8mLU6GlcG65toPvnR+cegbF5OwYgwu8d/CmwqnQAjmdW6bt4DrQieat3We2EQvecTIpzoU2j3PLtR18cKGLSYIzKOJWhN5FnqdbUuJcaIFszi3XdvDDhYSk9J/siDugOS1OhjaLc8u1HfxwISEpuqzRfdbtBQcnQwukc265toNPNsbHFhKSMnykh9E5OQc0p8XZ0KZxbrm2g3efnVpISMHu99xdcHA2tEAy55arKzs6t4fhI9mP/Byd28fwYf5HhmbB6dAC851brq4sxZVy97mbma/UnHE+tKc5t1xd2eHDPYzO7ef+OdHGJNOcmDvOhxY4cG6nS2BcXVld1th9ju6YVRed24UIbdgJbyuBcXVl+092EG3QnQLuonO7EKEFjpfAOLuy3QJWtFxzbhcmtEdLYKxd2SLcAcecW36vXIHUrjSw/HYLS+/xO4BklitLhUvO7UKFFvisxMXwvuQ0V5byd7jg3C5caDkyz5WlwhXn1ofWMkldWSpccG59aC2T1JWlIm5F6D8le8HBh9YiaV1ZKnpPdUQvOPjQWiStK0uF9AUHH1pLZHVlqZC84OBDa4k8riwJghccfGgtkNeVpULqgoMPrQU4dRVIXHDwoTUMlStLhcQFBx9ag1C7slRIW3DwoTUItStLhbRNPnxoDVGUK0uFpE0+fGgNUZgrS4SkTT58aA1QtCtLhZRNPnxoDWDClaWCUzluFj60BWPKlaVCwiYfPrQFYtqVpYL7Jh8+tAVi2pWlgvsmHz60BWHLlaWC8yYfPrQFYcuVpYKzc0t7YlxO4uUYe1/u2x5GfqoavYs70DW+88Ik9L/VQeu1Naghr2sbq9AGvQDj+/dFzgOPMrl7DAwVdFvulRYAah822AUWYDg9aPx6BRpyr1BxLUa8EgHQgMzGgANGwOrLG7ZHcSLsQlverKD68ekbIXPmUIhRgUL4X1YfZKlYepvnBn0Aw9ACQOPdJsBPhppL3Iyg67f8Al3SUD1+2+LPQ3UCtH52xvYwZsIytOFOCbWPlmwPIxVaaUR3HH+nKaUQbMu72q78cg3BHstoAGAaWgCov78M1ZdzlYrb0cmrSGUNdVOIeAAg3CyjeYnfZtNHYRvaYD9A4z1+J4GfhA41ovXZlYJgoKBj/jeXWmms/oTvtOAQtqEFgOrfGgi3+H+8RmcmwGnNgSUg/JTnTc1RqlfqqP+Z30k/07AOrYoV+xKYrsSIV5PUY5mXwCKg/RLPEtc0rEMLAJV/VlmXwCYJe764l8Dql5dR/lfV9jASwT60AN8SWLwUQS8lb6FhWwIbKKy+IuMqCwgJLccSmIZO3VnLtQTW/BXPw6xnISK0AL8SWNyKoSsZ5trMSmDBtRDN19ZsDyMVYkLLqQSmg9sXEtIQDBS05nFz2frpOoJITAwACAotwKcEFq9PgDBH6EpgcVNWulrB0u9atoeRGlGhVbFC4zd2r7a6rBERKIcqVlZvLrXWaL98h70B5EBUaAGg8o8ayp9UrP3+6MwEoJhaB0D4qb2rbf2jJVT/3rD2+/MgLrQA0PjtCmBhs5ZbriwNOtTA0MLNJWNXNgkiQ1vaKqP6V/NXCerN45RSCK+bryRwdmWTIDK0AND4/TKwZ+4qNe3KklE+8FdNwd2VTYLY0Ab9EI33zcgdeUtc8wi6AbQyUwLj7somQfToa39cQrBT/EOI1yfF7rhSgpFSXumTCntXNgmiQ6smCo13iz1RnKrENQ81Kta51Vqj/ZLMEtc0okMLANWP6yhtFndTQVbimkdYrHMrucQ1jfjQAsW1nVOXuOZTkHMrvMQ1jROhLart3PT5CEU5t9JLXNM4EVqA3rktrMQ1B2rn1oUS1zTOhJbSuT2pHdwU1M6tCyWuaZx6NFTO7cx2cFMQObcS2sGz4FRoKZzbee3gpsjr3EppB8+CU6EF8ju3c9vBTZHTuZXSDp4F50Kbx7lN3g5uhszOraB28Cw4F1ogu3ObtB3cGBmdW0nt4FlwMrRAeuc2bTu4KVI7t8LawbPgbGjTOLdZ2sFNkda5ldYOngVnQwskd24zt4ObIqFzK7EdPAtOhzaJc1u0K0tFEudWYjt4Fpx/hPOc29zt4KaY49xKbQfPgvOhPc25NeXKUjHLuZXcDp4F50MLzHZujbmyVMxwbl1yZZOwEKEFbnduzbuyVEw5t465sklYmNBOO7dcS1zzUIE6Nrd1zZVNwsKEFrjl3NpyZckoHZTAXHRlk7BQoQ13Sqj9aUlEiWseQTdEy0FXNgnqvs89IKDe4/HcYvHeph7x+NB6xOFD6xGHD61HHD60HnH40HrE4UPrEYcPrUccPrQecfjQesThQ+sRhw+tRxw+tB5x+NB6xOFD6xGHD61HHD60HnH40HrE8T8YG8SKlmk4HgAAAABJRU5ErkJggg==",hp="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",Sm="/assets/telegram-zGrx4xca.png",Em="/assets/discord-akqDA9xj.png";function Cm(){return y.jsxs("div",{className:ge.component,children:[y.jsxs("div",{className:ge.row,children:[y.jsx("img",{src:_m,alt:"smart contract engineer",className:ge.sce}),y.jsx("a",{href:"https://www.smartcontract.engineer",target:"__blank",children:"Smart Contract Engineer"})]}),y.jsxs("div",{className:ge.social,children:[y.jsxs("div",{className:ge.row,children:[y.jsx("img",{src:Em,alt:"discord",className:ge.discord}),y.jsx("a",{href:"https://discord.gg/bt8FK2wkcW",target:"__blank",children:"Discord"})]}),y.jsxs("div",{className:ge.row,children:[y.jsx("img",{src:Sm,alt:"telegram",className:ge.telegram}),y.jsx("a",{href:"https://t.me/smartcontractprogrammer",target:"__blank",children:"Telegram"})]}),y.jsxs("div",{className:ge.row,children:[y.jsx("img",{src:hp,alt:"youtube",className:ge.youTube}),y.jsx("a",{href:"https://www.youtube.com/channel/UCJWh7F3AFyQ_x01VKzr9eyA",target:"__blank",children:"YouTube"})]})]}),y.jsx("div",{className:ge.row,children:y.jsx("a",{href:"mailto:contact@vyper-by-example.org",children:"contact@vyper-by-example.org"})}),y.jsxs("div",{className:ge.row,children:[y.jsx("a",{href:"https://github.com/vyper-by-example/vyper-by-example.github.io",target:"__blank",children:"source"}),y.jsx("div",{className:ge.bar,children:"|"}),y.jsx("a",{href:"https://github.com/vyper-by-example/vyper-by-example.github.io/blob/gh-pages/LICENSE",target:"__blank",children:"license"})]})]})}const Pm=({children:e})=>{const{state:n}=ao(),t=S.useRef(null);S.useLayoutEffect(()=>{t.current&&(t.current.scrollTop=sessionStorage.getItem("scroll")||0)},[]);function s(r){var l;sessionStorage.setItem("scroll",(l=t.current)==null?void 0:l.scrollTop),window.location.href=r}return y.jsxs("div",{className:Os.component,children:[y.jsx("div",{ref:t,className:Os.sideNav,style:n.sideNav?{width:"var(--side-nav-width)",padding:"20px 10px 60px 10px"}:{width:0},children:n.sideNav?y.jsx(nm,{onClick:s}):null}),y.jsxs("div",{className:Os.main,children:[y.jsx(fm,{}),y.jsxs("div",{className:Os.children,children:[e,y.jsx(Cm,{})]})]})]})},mp=({title:e,description:n})=>(S.useEffect(()=>{document.title=e;const t=document.querySelector("meta[name='description']");t&&t.setAttribute("content",n)},[]),null),Oi='',Nm='';function Tm(e=[]){S.useEffect(()=>{const n=r=>{try{const l=document.createElement("textarea");l.setAttribute("style","width:1px;border:0;opacity:0;"),document.body.appendChild(l),navigator.clipboard.writeText(r.innerText),document.body.removeChild(l)}catch(l){console.error(l)}},t=[];return document.querySelectorAll("pre").forEach(r=>{var u;if(((u=r.parentElement)==null?void 0:u.className)=="copy-wrapper")return;const l=document.createElement("div");l.className="copy-wrapper",r.parentElement.insertBefore(l,r),l.appendChild(r);const a=document.createElement("button");a.className="copy",a.title="Copy",a.innerHTML=Oi,a.ariaLabel="Copy to clipboard",r.after(a);function o(d){d.preventDefault(),n(r.childNodes[0]),a.innerHTML=Nm}function i(d){d.preventDefault(),a.innerHTML=Oi}a.addEventListener("click",o),a.addEventListener("blur",i),t.push(()=>{a.removeEventListener("click",o),a.removeEventListener("blur",i)})}),()=>{for(let r=0;r (Tm([]),y.jsx("div",{className:`code ${e}`,dangerouslySetInnerHTML:{__html:n}})),Om="_component_ni5i2_1",Rm="_content_ni5i2_5",Im="_prevNext_ni5i2_8",dl={component:Om,content:Rm,prevNext:Im},D=({title:e,version:n,description:t,html:s,prev:r,next:l})=>y.jsxs("div",{className:dl.component,children:[y.jsx(mp,{title:`${e} | Vyper by Example | ${n}`,description:t}),y.jsxs("div",{className:dl.content,children:[y.jsx("h2",{children:e}),y.jsx(Lm,{html:s}),y.jsxs("div",{className:dl.prevNext,children:[r&&y.jsxs("a",{href:r.path,children:["< ",r.title]}),l&&y.jsxs("a",{href:l.path,children:[l.title," >"]})]}),y.jsxs("p",{children:["Try on"," ",y.jsx("a",{href:"https://smartcontract.engineer/challenges?language=vyper",target:"__blank",children:"Smart Contract Engineer"})]})]})]}),zm="0.3.9",Dm="Constants",Am="Constants in Vyper",Fm=` Constants are variables that cannot change.
-`,Mm=({prev:e,next:n})=>y.jsx(D,{version:zm,title:Dm,description:Am,html:Fm,prev:e,next:n}),$m="0.3.9",Um="Constructor",bm="Constructor in Vyper",Vm=`
# @version ^0.3.9 - -MY_CONSTANT: constant(uint256) = 123 -MIN: constant(uint256) = 1 -MAX: constant(uint256) = 10 -ADDR: constant(address) = 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B - - -@external -@pure -def getBuiltInConstants() -> (address, uint256, bytes32): - # Commonly used constants availabe in Vyper - return (ZERO_ADDRESS, MAX_UINT256, EMPTY_BYTES32) - - -@external -@pure -def getMyConstants() -> (uint256, uint256, address): - return (MIN, MAX, ADDR) -
-
__init__
is a special function that is executed only once when the contract is deployed.`,Bm=({prev:e,next:n})=>y.jsx(D,{version:$m,title:Um,description:bm,html:Vm,prev:e,next:n}),Hm="0.3.9",Wm="Create New Contract",Qm="Create new contract in Vyper",Km=`
# @version ^0.3.9 - -owner: public(address) -name: public(String[10]) -createdAt: public(uint256) -expiresAt: public(uint256) - - -@external -def __init__(name: String[10], duration: uint256): - # set owner to caller - self.owner = msg.sender - # set name from input - self.name = name - self.createdAt = block.timestamp - self.expiresAt = block.timestamp + duration -
Vyper contracts can deploy new contracts using the function
-create_forwarder_to
.-
create_forwarder_to
is also known as "minimal proxy contract". How it works, we won't explain it here.Here we will focus on how to use it to deploy new contracts.
-How to use
-create_forwarder_to
-
-- Deploy
-ContractToDeploy
. This is the "master copy." All deployed contracts will execute code from this master copy.- Call
-deploy()
passing the address of the master copy and any other arguments needed to setup the new contractHere is
-ContractToDeploy
ContractToDeploy.vy
-
# @version ^0.3.9 - - -owner: public(address) - - -# __init__ is not called when deployed from create_forwarder_to -@external -def __init__(): - self.owner = msg.sender - - -# call once after create_forwarder_to -@external -def setup(owner: address): - assert self.owner == ZERO_ADDRESS, "owner != zero address" - self.owner = owner - - -# DANGER: never have selfdestruct in original contract used by create_forwarder_to -@external -def kill(): - selfdestruct(msg.sender) -
Create.vy
-`,Ym=({prev:e,next:n})=>y.jsx(D,{version:Hm,title:Wm,description:Qm,html:Km,prev:e,next:n}),Xm="0.3.9",Gm="Default Function",Zm="Default function in Vyper",qm=`
# @version ^0.3.9 - - -interface ContractToDeploy: - def setup(owner: address): nonpayable - - -event Log: - addr: address - - -@external -def deploy(_masterCopy: address, owner: address): - addr: address = create_forwarder_to(_masterCopy) - ContractToDeploy(addr).setup(owner) - log Log(addr) - - -@external -def deployTest(_masterCopy: address): - addr: address = create_forwarder_to(_masterCopy) - ContractToDeploy(addr).setup(self) - log Log(addr) -
A contract can have a default function, executed when a function that does not exist is called. This is the same function as the fallback function in Solidity.
-This function is named
-__default__
and it is commonly used to receive Ether.`,Jm=({prev:e,next:n})=>y.jsx(D,{version:Xm,title:Gm,description:Zm,html:qm,prev:e,next:n}),ey="0.3.9",ny="Curve Add and Remove Liquidity",ty="Curve Add and Remove Liquidity",sy=`
# @version ^0.3.9 - - -event Payment: - sender: indexed(address) - amount: uint256 - - -@external -@payable -def __default__(): - log Payment(msg.sender, msg.value) -
Add and remove liquidity from Curve pools
-`,ry=({prev:e,next:n})=>y.jsx(D,{version:ey,title:ny,description:ty,html:sy,prev:e,next:n}),ly="0.3.9",ay="Curve Swap",oy="Curve Swap",iy=`
# @version ^0.3.9 - -from vyper.interfaces import ERC20 - - -interface IStableSwap: - def add_liquidity(amounts: uint256[3], min_shares: uint256): nonpayable - def remove_liquidity(shares: uint256, min_amounts: uint256[3]): nonpayable - def remove_liquidity_one_coin(shares: uint256, i: int128, min_amount: uint256): nonpayable - def get_virtual_price() -> uint256: view - - -DAI: constant(address) = 0x6B175474E89094C44Da98b954EedeAC495271d0F -USDC: constant(address) = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 -USDT: constant(address) = 0xdAC17F958D2ee523a2206206994597C13D831ec7 - -POOL: constant(address) = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7 -COINS: constant(address[3]) = [DAI, USDC, USDT] - - -@internal -def _safeTransfer(coin: address, to: address, amount: uint256): - res: Bytes[32] = raw_call( - coin, - concat( - method_id("transfer(address,uint256)"), - convert(to, bytes32), - convert(amount, bytes32), - ), - max_outsize=32, - ) - - if len(res) > 0: - assert convert(res, bool) - - -@internal -def _safeTransferFrom(coin: address, _from: address, to: address, amount: uint256): - res: Bytes[32] = raw_call( - coin, - concat( - method_id("transferFrom(address,address,uint256)"), - convert(_from, bytes32), - convert(to, bytes32), - convert(amount, bytes32), - ), - max_outsize=32, - ) - - if len(res) > 0: - assert convert(res, bool) - - -@internal -def _safeApprove(coin: address, to: address, amount: uint256): - res: Bytes[32] = raw_call( - coin, - concat( - method_id("approve(address,uint256)"), - convert(to, bytes32), - convert(amount, bytes32), - ), - max_outsize=32, - ) - - if len(res) > 0: - assert convert(res, bool) - - -@external -def addLiquidity(amounts: uint256[3], min_shares: uint256): - for i in range(3): - if amounts[i] > 0: - self._safeTransferFrom(COINS[i], msg.sender, self, amounts[i]) - self._safeApprove(COINS[i], POOL, amounts[i]) - - IStableSwap(POOL).add_liquidity(amounts, min_shares) - - -@external -@view -def calculateValueOfShares(shares: uint256) -> uint256: - return shares * IStableSwap(POOL).get_virtual_price() / 10**18 - - -@external -def removeLiquidity(shares: uint256, min_amounts: uint256[3]): - IStableSwap(POOL).remove_liquidity(shares, min_amounts) - - for coin in COINS: - bal: uint256 = ERC20(coin).balanceOf(self) - self._safeTransfer(coin, msg.sender, bal) - - -@external -def removeLiquidityOneCoin(shares: uint256, i: int128, min_amount: uint256): - IStableSwap(POOL).remove_liquidity_one_coin(shares, i, min_amount) - - bal: uint256 = ERC20(COINS[i]).balanceOf(self) - self._safeTransfer(COINS[i], msg.sender, bal) -
Swap tokens on Curve
-`,uy=({prev:e,next:n})=>y.jsx(D,{version:ly,title:ay,description:oy,html:iy,prev:e,next:n}),cy="0.3.9",py="Delegate Call",dy="Delegate call in Vyper",fy=`
# @version ^0.3.9 - -from vyper.interfaces import ERC20 - - -interface IStableSwap: - def exchange(i: int128, j: int128, dx: uint256, min_dy: uint256): nonpayable - - -DAI: constant(address) = 0x6B175474E89094C44Da98b954EedeAC495271d0F -USDC: constant(address) = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 -USDT: constant(address) = 0xdAC17F958D2ee523a2206206994597C13D831ec7 - -POOL: constant(address) = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7 -COINS: constant(address[3]) = [DAI, USDC, USDT] - - -@internal -def _safeTransfer(coin: address, to: address, amount: uint256): - res: Bytes[32] = raw_call( - coin, - concat( - method_id("transfer(address,uint256)"), - convert(to, bytes32), - convert(amount, bytes32), - ), - max_outsize=32, - ) - - if len(res) > 0: - assert convert(res, bool) - - -@internal -def _safeTransferFrom(coin: address, _from: address, to: address, amount: uint256): - res: Bytes[32] = raw_call( - coin, - concat( - method_id("transferFrom(address,address,uint256)"), - convert(_from, bytes32), - convert(to, bytes32), - convert(amount, bytes32), - ), - max_outsize=32, - ) - - if len(res) > 0: - assert convert(res, bool) - - -@internal -def _safeApprove(coin: address, to: address, amount: uint256): - res: Bytes[32] = raw_call( - coin, - concat( - method_id("approve(address,uint256)"), - convert(to, bytes32), - convert(amount, bytes32), - ), - max_outsize=32, - ) - - if len(res) > 0: - assert convert(res, bool) - - -@external -def swap(i: int128, j: int128, dx: uint256, min_dy: uint256): - self._safeTransferFrom(COINS[i], msg.sender, self, dx) - self._safeApprove(COINS[i], POOL, dx) - - IStableSwap(POOL).exchange(i, j, dx, min_dy) - - bal: uint256 = ERC20(COINS[j]).balanceOf(self) - self._safeTransfer(COINS[j], msg.sender, bal) -
When contract
-A
delegates call to contractB
,B
's code will be executed inside contractA
. This will update state variables and Ether balance inside contractA
and notB
.Delegate call is commonly used to create an upgradable contract.
-Here is the contract that we will delegate call to.
-TestDelegateCall.vy
-
# @version ^0.3.9 - -# State variables must be declared in the same order -# as contract making the call -x: public(uint256) -y: public(uint256) - - -@external -def updateX(x: uint256): - # when this function is called with delegate call - # this will update self.x inside the calling contract - self.x = x + 1 - - -@external -def updateY(y: uint256): - self.y = y * y -
DelegateCall.vy
-`,hy=({prev:e,next:n})=>y.jsx(D,{version:cy,title:py,description:dy,html:fy,prev:e,next:n}),my="0.3.9",yy="Dynamic Arrays",vy="Dynamic arrays in Vyper",gy=`
# @version ^0.3.9 - - -x: public(uint256) -y: public(uint256) - - -@external -def updateX(to: address, x: uint256): - raw_call( - to, - concat( - method_id("updateX(uint256)"), - convert(x, bytes32) - ), - is_delegate_call=True - ) - - -@external -def updateY(to: address, y: uint256): - raw_call( - to, - concat( - method_id("updateY(uint256)"), - convert(y, bytes32) - ), - is_delegate_call=True - ) -
Dynamic arrays are bounded arrays whose length can change. The length of the array cannot exceed the maximum length set where the array is declared.
-`,jy=({prev:e,next:n})=>y.jsx(D,{version:my,title:yy,description:vy,html:gy,prev:e,next:n}),wy="0.3.9",xy="Error",ky="Error in Vyper",_y=`
# @version ^0.3.9 - -# Dynamic array of type uint256, max 3 elements -nums: DynArray[uint256, 3] - -@external -def __init__(): - self.nums.append(11) - self.nums.append(22) - self.nums.append(33) - # This will revert (Appending to array with max 3 elements) - # self.nums.append(44) - - # Remove last element - self.nums.pop() - - # Delete all elements - self.nums = [] - # Set values - self.nums = [1,2,3] - - -@external -@pure -def examples(xs: DynArray[uint256, 5]) -> DynArray[uint256, 8]: - ys: DynArray[uint256, 5] = [1,2,3] - # Copy xs into ys - for x in xs: - ys.append(x) - return ys - - -@external -@pure -def filter(addrs: DynArray[address, 5]) -> DynArray[address, 5]: - nonzeros: DynArray[address, 5] = [] - for addr in addrs: - if addr != ZERO_ADDRESS: - nonzeros.append(addr) - return nonzeros -
Use
-assert
andraise
to check inputs and validate state.When an error occurs, it will halt the entire function call, undoing any changes.
-You will still need to pay gas for the failed transaction.
-`,Sy=({prev:e,next:n})=>y.jsx(D,{version:wy,title:xy,description:ky,html:_y,prev:e,next:n}),Ey="0.3.9",Cy="Event",Py="Event in Vyper",Ny=`
# @version ^0.3.9 - -x: public(uint256) -owner: public(address) - - -@external -def __init__(): - self.owner = msg.sender - - -@external -def testAssert(x: uint256): - assert x >= 1, "x < 1" - # self.x will not be updated if there is an error from line above - self.x = x - - -@external -def testRaise(x: uint256): - # same check as above using "raise" - if x <= 1: - raise "x < 1" - self.x = x - - -@internal -def _testErrorBubblesUp(x: uint256): - assert x >= 1, "x < 1" - self.x = x - - -@external -def testErrorBubblesUp(x: uint256): - self._testErrorBubblesUp(x) - # self.x = 123 will not be executed if there is an error - # from function above - self.x = 123 - - -@external -def setOwner(owner: address): - assert msg.sender == self.owner, "!owner" - assert owner != ZERO_ADDRESS, "owner = zero" - self.owner = owner -
Events write logs to the blockchain, commonly used by application to monitor blockchain state and as a cheaper alternative to store data on the blockchain without using state variables.
-Events can be efficiently searched by indexing their arguments. Up to 3 parameters can be indexed.
-`,Ty=({prev:e,next:n})=>y.jsx(D,{version:Ey,title:Cy,description:Py,html:Ny,prev:e,next:n}),Ly="0.3.9",Oy="For Loop",Ry="For loop in Vyper",Iy=`
# @version ^0.3.9 - -# up to 3 index -event Transfer: - # enables quick search of all Transfer events where sender is a certain address - sender: indexed(address) - # enables quick search of all Transfer events where receiver is a certain address - receiver: indexed(address) - amount: uint256 - - -@external -def transfer(receiver: address, amount: uint256): - # some code ... - log Transfer(msg.sender, receiver, amount) - - -@external -def mint(amount: uint256): - # some code ... - log Transfer(ZERO_ADDRESS, msg.sender, amount) - - -@external -def burn(amount: uint256): - # some code ... - log Transfer(msg.sender, ZERO_ADDRESS, amount) -
There are 2 ways to loop through an array, using
-range
and directly looping through array elements.`,zy=({prev:e,next:n})=>y.jsx(D,{version:Ly,title:Oy,description:Ry,html:Iy,prev:e,next:n}),Dy="0.3.9",Ay="Function",Fy="Function in Vyper",My=`
# @version ^0.3.9 - - -@external -@pure -def forLoop(): - # for loop through range - # sum from 0 to 9 - s: uint256 = 0 - for i in range(10): - s += i - - # for loop through array elements - # find minimum of nums - nums: uint256[5] = [4, 5, 1, 9, 0] - x: uint256 = MAX_UINT256 - for num in nums: - if x < num: - x = num - - # continue - skip current iteration - # break - exit for loop - c: uint256 = 0 - for i in [1, 2, 3, 4, 5]: - # skip 2 - if i == 2: - continue - # end loop at i = 4 - if i == 4: - break - # otherwise increment c by 1 - c += 1 - # c = 2 (incremented at i = 1 and 3) - - -@external -@pure -def sum(nums: uint256[10]) -> uint256: - s: uint256 = 0 - for n in nums: - s += n - return s -
`,$y=({prev:e,next:n})=>y.jsx(D,{version:Dy,title:Ay,description:Fy,html:My,prev:e,next:n}),Uy="0.3.9",by="Hash Function",Vy="Hash function in Vyper",By=`
# @version ^0.3.9 - - -@external -@pure -def multiply(x: uint256, y: uint256) -> uint256: - return x * y - - -@external -@pure -def divide(x: uint256, y: uint256) -> uint256: - return x / y - - -# A funciton that does nothing -@external -def doNothing(): - # pass is useful when you want to compile the contract now, - # write the code later - pass - - -# Functions can return multiple outputs -@external -@pure -def multiOut() -> (uint256, bool): - return (1, True) - - -@external -@pure -def addAndSub(x: uint256, y: uint256) -> (uint256, uint256): - return (x + y, x - y) -
Vyper supports the same hash function available in Solidity,
-keccack256
.`,Hy=({prev:e,next:n})=>y.jsx(D,{version:Uy,title:by,description:Vy,html:By,prev:e,next:n}),Wy="0.3.9",Qy="Hello World",Ky="Hello world in Vyper",Yy=`
# @version ^0.3.9 - - -@external -@pure -def getHash(addr: address, num: uint256, ) -> bytes32: - # input of keccak256 can be String, Bytes or bytes32 - return keccak256( - # convert different data into Bytes - concat( - convert(addr, bytes32), - convert(num, bytes32), - convert("THIS IS A STRING", Bytes[16]) - ) - ) - - -@external -@pure -def getMessageHash(_str: String[100]) -> bytes32: - return keccak256(_str) -
-
@version
specifies the compiler version of Vyper.`,Xy=({prev:e,next:n})=>y.jsx(D,{version:Wy,title:Qy,description:Ky,html:Yy,prev:e,next:n}),Gy="0.3.9",Zy="If Else Conditional Statement",qy="If else conditional statement in Vyper",Jy=`
# @version ^0.3.0 - -# Create a string variable that can store maximum 100 characters -greet: public(String[100]) - -@external -def __init__(): - self.greet = "Hello World" -
`,ev=({prev:e,next:n})=>y.jsx(D,{version:Gy,title:Zy,description:qy,html:Jy,prev:e,next:n}),nv="0.3.9",tv="Immutable",sv="Immutable in Vyper",rv=`
# @version ^0.3.9 - - -@external -def ifElse(x: uint256) -> uint256: - if x <= 10: - return 1 - elif x <= 20: - return 2 - else: - return 3 - - -@external -@pure -def absoluteValue(x: uint256, y: uint256) -> uint256: - if x >= y: - return x - y - return y - x -
Immutable variables are like constants except value are assigned when the contract is deployed.
-When to use
-immutable
variables?-
-- You have a variable that needs to be set when the contract is deployed, -for example like setting contract owner to
-msg.sender
- and this variable will never change after deployment
-Why declare variables as
-immutable
?Like constants,
-immutable
variables save run time gas`,lv=({prev:e,next:n})=>y.jsx(D,{version:nv,title:tv,description:sv,html:rv,prev:e,next:n}),av="0.3.9",ov="Interface",iv="Interface in Vyper",uv=`
# @version ^0.3.9 - -OWNER: immutable(address) -MY_IMMUTABLE: immutable(uint256) - -@external -def __init__(_val: uint256): - OWNER = msg.sender - MY_IMMUTABLE = _val - - -@external -@pure -def getMyImmutable() -> uint256: - return MY_IMMUTABLE -
Use
-interface
to call other smart contracts.Here is the
-TestInterface
self.contract that we will call.TestInterface.vy
-
# @version ^0.3.9 - - -owner: public(address) -eth: public(uint256) - - -@external -def setOwner(owner: address): - self.owner = owner - - -@external -@payable -def sendEth(): - self.eth = msg.value - - -@external -@payable -def setOwnerAndSendEth(owner: address): - self.owner = owner - self.eth = msg.value -
Interface.vy
-`,cv=({prev:e,next:n})=>y.jsx(D,{version:av,title:ov,description:iv,html:uv,prev:e,next:n}),pv="0.3.9",dv="Internal and External Functions",fv="Internal and external functions in Vyper",hv=`
# @version ^0.3.9 - - -interface TestInterface: - # get address of owner - def owner() -> address: view - # set new owner - def setOwner(owner: address): nonpayable - # send ETH - def sendEth(): payable - # set owner and send ETH - def setOwnerAndSendEth(owner: address): payable - - -# store contract having the above interface -test: public(TestInterface) - - -@external -def __init__(test: address): - # store contract instance - self.test = TestInterface(test) - # if you need to get address from self.test - addr: address = self.test.address - - -@external -@view -def getOwner() -> address: - return self.test.owner() - - -@external -@view -def getOwnerFromAddress(test: address) -> address: - # you can also call functions by passing in the address of the interface - return TestInterface(test).owner() - - -@external -def setOwner(owner: address): - self.test.setOwner(owner) - - -@external -@payable -def sendEth(): - self.test.sendEth(value=msg.value) - - -@external -@payable -def setOwnerAndSendEth(owner: address): - self.test.setOwnerAndSendEth(owner, value=msg.value) -
-
@internal
functions can only be called inside the contract.-
@external
functions can only be called from outside the contract.`,mv=({prev:e,next:n})=>y.jsx(D,{version:pv,title:dv,description:fv,html:hv,prev:e,next:n}),yv="0.3.9",vv="Payable",gv="Payable in Vyper",jv=`
# @version ^0.3.9 - -# Internal functions can only be called inside this contract -@internal -@pure -def _add(x: uint256, y: uint256) -> uint256: - return x + y - - -@external -@view -def extFunc() -> bool: - return True - - -# External functions can only be called from outside this contract -@external -@view -def avg(x: uint256, y: uint256) -> uint256: - # cannot call other external function - # self.extFunc() - - # can call internal functions - z: uint256 = self._add(x, y) - - return (x + y) / 2 - - -@internal -@pure -def _sqr(x: uint256) -> uint256: - return x * x - - -@external -@view -def sumOfSquares(x: uint256, y: uint256) -> uint256: - return self._sqr(x) + self._sqr(y) -
Functions declared with
-@payable
can receive Ether.`,wv=({prev:e,next:n})=>y.jsx(D,{version:yv,title:vv,description:gv,html:jv,prev:e,next:n}),xv="0.3.9",kv="Debug with Print",_v="Debug with Print",Sv=`
# @version ^0.3.9 - - -event Deposit: - sender: indexed(address) - amount: uint256 - - -@external -@payable -def deposit(): - log Deposit(msg.sender, msg.value) - - -@external -@view -def getBalance() -> uint256: - # Get balance of Ether stored in this contract - return self.balance - - -owner: public(address) - - -@external -@payable -def pay(): - assert msg.value > 0, "msg.value = 0" - self.owner = msg.sender -
Use the built-in function
-`,Ev=({prev:e,next:n})=>y.jsx(D,{version:xv,title:kv,description:_v,html:Sv,prev:e,next:n}),Cv="0.3.9",Pv="Private and Public State Variables",Nv="Private and public state variables in Vyper",Tv=`
# @version ^0.3.9 - -@external -def test_print(): - x: uint256 = 123 - # Set hardhat_compat = True when testing with Hardhat - print("print something here", x, hardhat_compat=True) - - -
Private state variables cannot be accessed from outside the contract.
-Public state variables can be read by anyone, including users and other contracts.
-`,Lv=({prev:e,next:n})=>y.jsx(D,{version:Cv,title:Pv,description:Nv,html:Tv,prev:e,next:n}),Ov="0.3.9",Rv="Raw Call",Iv="Raw call in Vyper",zv=`
# @version ^0.3.9 - -# publis state variable -owner: public(address) -# private state variable -foo: uint256 -bar: public(bool) - - -@external -def __init__(): - self.owner = msg.sender - self.foo = 123 - self.bar = True -
-
raw_call
is a low level function. It is used to call and send Ether to other functions.For this example, we will write a contract that calls this contract below.
-TestRawCall.vy
-
# @version ^0.3.9 - - -sender: public(address) - - -@external -def testAdd(x: uint256, y: uint256) -> uint256: - self.sender = msg.sender - return x + y - - -@external -def testSub(x: uint256, y: uint256) -> uint256: - self.sender = msg.sender - return x - y -
RawCall.vy
-`,Dv=({prev:e,next:n})=>y.jsx(D,{version:Ov,title:Rv,description:Iv,html:zv,prev:e,next:n}),Av="0.3.9",Fv="Re-Entrancy Lock",Mv="Re-entrancy lock in Vyper",$v=`
# @version ^0.3.9 - - -@external -def testRawCall(to: address, x: uint256, y: uint256): - res: Bytes[32] = raw_call( - to, # address to call - # data to send in Bytes - concat( - method_id("testAdd(uint256,uint256)"), # function to call - convert(x, bytes32), # first input - convert(y, bytes32), # secode input - ), - max_outsize=32, # max size of ouput, default 0 - gas=100000, # optional, amount of gas to send, default forwards all gas - value=0, # optional, amount of ETH to send, default 0 - ) - - z: uint256 = convert(res, uint256) - - -@external -@payable -def sendEth(to: address): - # Example to send ETH - # data = b"", empty data - # value = msg.value, all of ETH that was sent to this function - raw_call(to, b"", value=msg.value) - - -diff: public(uint256) - - -@external -def testRawCallSub(to: address, x: uint256, y: uint256): - res: Bytes[32] = raw_call( - to, - concat( - method_id("testSub(uint256,uint256)"), - convert(x, bytes32), - convert(y, bytes32) - ), - max_outsize=32, - ) - - self.diff = convert(res, uint256) -
Vyper has a handy way to secure your contract from re-entrancy.
-A re-entrancy lock can be created on a function with
-@nonreentrant("lock")
.Functions can be locked together by using the same name for the locks.
-`,Uv=({prev:e,next:n})=>y.jsx(D,{version:Av,title:Fv,description:Mv,html:$v,prev:e,next:n}),bv="0.3.9",Vv="Data Types - References",Bv="References in Vyper",Hv=`
# @version ^0.3.9 - - -@external -@nonreentrant("lock") -def func0(): - # call back msg.sender - raw_call(msg.sender, b"", value=0) - - -@external -@nonreentrant("lock-2") -def func1(): - raw_call(msg.sender, b"", value=0) - - -@external -@nonreentrant("lock-2") -def func2(): - raw_call(msg.sender, b"", value=0) -
References types are data types that are passed by their reference, pointer to where the actual data is stored.
-`,Wv=({prev:e,next:n})=>y.jsx(D,{version:bv,title:Vv,description:Bv,html:Hv,prev:e,next:n}),Qv="0.3.9",Kv="Self Destruct",Yv="Self destruct in Vyper",Xv=`
# @version ^0.3.9 - - -struct Person: - name: String[100] - age: uint256 - - -# Fixed sized list -nums: public(uint256[10]) # must be bounded -myMap: public(HashMap[address, uint256]) -person: public(Person) - - -@external -def __init__(): - # This updates self.nums[0] - self.nums[0] = 123 - self.nums[9] = 456 - # Copies self.nums to array in memory. - # Does not modify referenced variable (self.nums) - arr: uint256[10] = self.nums - arr[0] = 123 - - # This updates self.myMap - self.myMap[msg.sender] = 1 - self.myMap[msg.sender] = 11 - - # This updates self.person - self.person.age = 11 - self.person.name = "Vyper" - # Person struct is copied into memory. - # Does not modify referenced variable (self.person) - p: Person = self.person - p.name = "Solidity" -
-
selfdestruct
deletes the contract from the blockchain. It takes a single input, an address to send all of Ether stored in the contract.`,Gv=({prev:e,next:n})=>y.jsx(D,{version:Qv,title:Kv,description:Yv,html:Xv,prev:e,next:n}),Zv="0.3.9",qv="Send Ether",Jv="Send ETH in Vyper",e0=`
# @version ^0.3.9 - - -@external -@payable -def __default__(): - pass - - -@external -def kill(): - selfdestruct(msg.sender) - - -@external -def burn(): - selfdestruct(ZERO_ADDRESS) -
There are two ways to send Ether from a contract,
-send
andraw_call
. Here we introduce the simpler function to use,send
.`,n0=({prev:e,next:n})=>y.jsx(D,{version:Zv,title:qv,description:Jv,html:e0,prev:e,next:n}),t0="0.3.9",s0="Unsafe Math",r0="Unsafe math in Vyper",l0=`
# @version ^0.3.9 - - -# Receive Ether into this contract -@external -@payable -def __default__(): - pass - - -@external -def sendEther(to: address, amount: uint256): - # when Ether is sent to a contract it will call - # __default__ inside the receiving contract - # forwards 2300 gas - send(to, amount) - - -@external -def sendAll(to: address): - send(to, self.balance) -
Critical math checks such as overflow, underflow and division by 0 can be skipped using unsafe functions
-`,a0=({prev:e,next:n})=>y.jsx(D,{version:t0,title:s0,description:r0,html:l0,prev:e,next:n}),o0="0.3.9",i0="Data Types - Values",u0="Values in Vyper",c0=`
# @version ^0.3.9 - - -@external -def test_add(x: uint256, y: uint256) -> uint256: - # 21510 gas - # return x + y - - # 21472 gas - return unsafe_add(x, y) - - -@external -def test_sub(x: uint256, y: uint256) -> uint256: - # 21533 gas - # return x - y - - # 21495 gas - return unsafe_sub(x, y) - - -@external -def test_mul(x: uint256, y: uint256) -> uint256: - # 21578 gas - # return x * y - - # 21520 gas - return unsafe_mul(x, y) - - -@external -def test_div(x: uint256, y: uint256) -> uint256: - # 21578 gas - # return x / y - - # 21543 gas - return unsafe_div(x, y) -
Some values available in Vyper
--
-- -
bool
- -
int128
- -
uint256
- -
decimals
- -
address
- -
bytes32
- -
Bytes
- -
String
`,p0=({prev:e,next:n})=>y.jsx(D,{version:o0,title:i0,description:u0,html:c0,prev:e,next:n}),d0="0.3.9",f0="Verify Signature",h0="Verify signature in Vyper",m0=`
# @version ^0.3.9 - -b: public(bool) -i: public(int128) # -2 ** 127 to (2 ** 127 - 1) -u: public(uint256) # 0 to 2 ** 256 - 1 -dec: public(decimal) # -2 ** 127 to (2 ** 127 - 1), 10 decimal places -addr: public(address) -b32: public(bytes32) -bs: public(Bytes[100]) -s: public(String[100]) - - -@external -def __init__(): - self.b = False - self.i = -1 - self.u = 123 - self.dec = 3.14 - self.addr = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 - self.b32 = 0xada1b75f8ae9a65dcc16f95678ac203030505c6b465c8206e26ae84b525cdacb - self.bs = b"\\x01" - self.s = "Hello Vyper" -
Signing and verifying signature takes 3 steps.
--
-- Hash the data to sign. This can be done with and without a smart contract.
-- Sign the hash. This must be done off chain.
-- Verify the signature. This is done using a smart contract.
-`,y0=({prev:e,next:n})=>y.jsx(D,{version:d0,title:f0,description:h0,html:m0,prev:e,next:n}),v0="0.3.9",g0="View and Pure Functions",j0="View and pure functions in Vyper",w0=`
# @version ^0.3.9 - - -# hash = getHash("Hello Vyper!") -# 0x5436c86f18e3d25a10e557ae125450118dd0a481ca22112b1977d55a676e4c91 -@external -@pure -def getHash(_str: String[100]) -> bytes32: - return keccak256(_str) - - -# getEthSignedHash(hash) -# 0x045b623a8e8fb7b4fcfbd1ae07e7326d55303d7de4085c69b346bd130c1936da -@external -@pure -def getEthSignedHash(_hash: bytes32) -> bytes32: - return keccak256( - concat( - b'\\x19Ethereum Signed Message:\\n32', - _hash - ) - ) - - -# account = your account -# hash = getHash("Hello Vyper!") -# signature = await ethereum.request({ method: "personal_sign", params: [account, hash]}) -@external -@pure -def recoverSigner(ethSignedHash: bytes32, sig: Bytes[65]) -> address: - r: uint256 = convert(slice(sig, 0, 32), uint256) - s: uint256 = convert(slice(sig, 32, 32), uint256) - v: uint256 = convert(slice(sig, 64, 1), uint256) - return ecrecover(ethSignedHash, v, r, s) - - -@external -@pure -def verify(sig: Bytes[65], _str: String[100], _signer: address) -> bool: - _hash: bytes32 = keccak256(_str) - ethSignedHash: bytes32 = keccak256( - concat( - b'\\x19Ethereum Signed Message:\\n32', - _hash - ) - ) - r: uint256 = convert(slice(sig, 0, 32), uint256) - s: uint256 = convert(slice(sig, 32, 32), uint256) - v: uint256 = convert(slice(sig, 64, 1), uint256) - signer: address = ecrecover(ethSignedHash, v, r, s) - - return _signer == signer -
Both
-pure
andview
functions are read only function, they cannot write anything to the blockchain.-
pure
functions do not read any state or global variables-
view
functions can read state variables, global variables and call internal functions.`,x0=({prev:e,next:n})=>y.jsx(D,{version:v0,title:g0,description:j0,html:w0,prev:e,next:n}),k0=({size:e,className:n=""})=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",width:e,height:e,className:n,children:y.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"})}),_0="_component_efeb7_1",S0="_icon_efeb7_8",E0="_input_efeb7_12",fl={component:_0,icon:S0,input:E0},C0=({value:e,onChange:n})=>{function t(s){n(s.target.value)}return y.jsxs("div",{className:fl.component,children:[y.jsx(k0,{size:18,className:fl.icon}),y.jsx("input",{className:fl.input,placeholder:"Search",value:e,onChange:t})]})};var P0="Expected a function",Ri=NaN,N0="[object Symbol]",T0=/^\s+|\s+$/g,L0=/^[-+]0x[0-9a-f]+$/i,O0=/^0b[01]+$/i,R0=/^0o[0-7]+$/i,I0=parseInt,z0=typeof fs=="object"&&fs&&fs.Object===Object&&fs,D0=typeof self=="object"&&self&&self.Object===Object&&self,A0=z0||D0||Function("return this")(),F0=Object.prototype,M0=F0.toString,$0=Math.max,U0=Math.min,hl=function(){return A0.Date.now()};function b0(e,n,t){var s,r,l,a,o,i,u=0,d=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(P0);n=Ii(n)||0,ca(t)&&(d=!!t.leading,f="maxWait"in t,l=f?$0(Ii(t.maxWait)||0,n):l,m="trailing"in t?!!t.trailing:m);function v(k){var C=s,T=r;return s=r=void 0,u=k,a=e.apply(T,C),a}function j(k){return u=k,o=setTimeout(p,n),d?v(k):a}function w(k){var C=k-i,T=k-u,U=n-C;return f?U0(U,l-T):U}function E(k){var C=k-i,T=k-u;return i===void 0||C>=n||C<0||f&&T>=l}function p(){var k=hl();if(E(k))return c(k);o=setTimeout(p,w(k))}function c(k){return o=void 0,m&&s?v(k):(s=r=void 0,a)}function h(){o!==void 0&&clearTimeout(o),u=0,s=i=r=o=void 0}function g(){return o===void 0?a:c(hl())}function _(){var k=hl(),C=E(k);if(s=arguments,r=this,i=k,C){if(o===void 0)return j(i);if(f)return o=setTimeout(p,n),v(i)}return o===void 0&&(o=setTimeout(p,n)),a}return _.cancel=h,_.flush=g,_}function ca(e){var n=typeof e;return!!e&&(n=="object"||n=="function")}function V0(e){return!!e&&typeof e=="object"}function B0(e){return typeof e=="symbol"||V0(e)&&M0.call(e)==N0}function Ii(e){if(typeof e=="number")return e;if(B0(e))return Ri;if(ca(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=ca(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=e.replace(T0,"");var t=O0.test(e);return t||R0.test(e)?I0(e.slice(2),t?2:8):L0.test(e)?Ri:+e}var H0=b0;const W0=Mi(H0),Q0={leading:!1,trailing:!0};function K0(e,n,t){return S.useCallback(W0(e,n,Q0),t)}function Y0(e,n){let t=e;for(let s=0;s
# @version ^0.3.9 - -num: public(uint256) - -# Pure functions does not read any state or global variables -@external -@pure -def pureFunc(x: uint256) -> uint256: - return x - - -# View functions might read state or global state, or call an internal function -@external -@view -def viewFunc(x: uint256) -> bool: - return x > self.num - - -@external -@pure -def sum(x: uint256, y: uint256, z: uint256) -> uint256: - return x + y + z - - -@external -@view -def addNum(x: uint256) -> uint256: - return x + self.num -
0;){const[l,a,o]=n.pop();r&&(s=s.slice(0,a-1),r=!1),s+=l;const i=Object.keys(o);if(i.length>0)for(let u=0;u n+r)}const Z0=["/view-pure-functions"],q0=["/view-pure-functions"],J0=["/view-pure-functions","/payable","/internal-external-functions","/hash-function","/function","/default-function"],eg=["/verify-signature"],ng=["/verify-signature"],tg=["/verify-signature"],sg=["/values","/references"],rg=["/values","/references"],lg=["/values","/references"],ag=["/values"],og=["/values"],ig=["/values","/references","/private-public-state-variables"],ug=["/values","/references","/private-public-state-variables"],cg=["/values"],pg=["/values"],dg=["/values"],fg=["/values"],hg=["/values"],mg=["/values"],yg=["/values"],vg=["/unsafe-math"],gg=["/unsafe-math"],jg=["/unsafe-math"],wg=["/send-ether"],xg=["/send-ether"],kg=["/send-ether","/raw-call"],_g=["/send-ether","/payable","/default-function"],Sg=["/self-destruct"],Eg=["/self-destruct"],Cg=["/self-destruct"],Pg=["/references"],Ng=["/references"],Tg=["/references","/dynamic-arrays"],Lg=["/references","/dynamic-arrays"],Og=["/references"],Rg=["/references"],Ig=["/references"],zg=["/references"],Dg=["/re-entrancy-lock"],Ag=["/re-entrancy-lock"],Fg=["/raw-call"],Mg=["/raw-call","/delegate-call"],$g=["/private-public-state-variables"],Ug=["/print"],bg=["/print"],Vg=["/internal-external-functions"],Bg=["/internal-external-functions"],Hg=["/interface"],Wg=["/immutable"],Qg=["/immutable"],Kg=["/immutable","/constants"],Yg=["/immutable","/constants"],Xg=["/if-else"],Gg=["/if-else"],Zg=["/hello-world"],qg=["/hello-world"],Jg=["/hello-world"],e1=["/hash-function"],n1=["/hash-function"],t1=["/for-loop"],s1=["/for-loop"],r1=["/for-loop"],l1=["/event"],a1=["/event"],o1=["/error"],i1=["/error"],u1=["/dynamic-arrays"],c1=["/delegate-call"],p1=["/defi/curve-swap","/defi/curve-liquidity"],d1=["/defi/curve-swap"],f1=["/defi/curve-swap","/defi/curve-liquidity"],h1=["/defi/curve-swap","/defi/curve-liquidity"],m1=["/defi/curve-liquidity"],y1=["/default-function"],v1=["/default-function"],g1=["/create-new-contract"],j1=["/create-new-contract"],w1=["/create-new-contract"],x1=["/constructor"],zi={view:Z0,pure:q0,function:["/view-pure-functions","/payable","/internal-external-functions","/hash-function","/function","/default-function"],functions:J0,verify:eg,signature:ng,ecrecover:tg,data:sg,type:rg,types:lg,value:ag,values:og,variable:ig,variables:ug,bool:cg,int128:pg,uint256:dg,decimals:fg,address:hg,bytes32:mg,Bytes:yg,String:["/values"],gas:vg,unsafe:gg,math:jg,send:wg,ether:xg,raw_call:kg,payable:_g,selfdestruct:Sg,self:Eg,destruct:Cg,reference:Pg,references:Ng,array:Tg,arrays:Lg,struct:Og,structs:Rg,HashMap:Ig,mapping:zg,"re-entrancy":["/re-entrancy-lock"],lock:Dg,nonreentrant:Ag,raw:Fg,call:Mg,private:["/private-public-state-variables"],public:["/private-public-state-variables"],state:$g,debug:Ug,print:bg,internal:Vg,external:Bg,interface:["/interface"],interfaces:Hg,immutable:Wg,immutables:Qg,constant:Kg,constants:Yg,if:["/if-else"],else:["/if-else"],conditional:Xg,statement:Gg,hello:Zg,world:qg,version:Jg,hash:e1,keccack256:n1,for:["/for-loop"],loop:t1,loops:s1,range:r1,event:l1,events:a1,error:o1,errors:i1,dynamic:u1,delegate:c1,curve:p1,swap:d1,defi:f1,amm:h1,add:m1,"remove liquidity":["/defi/curve-liquidity"],default:["/default-function"],__default__:y1,fallback:v1,create:g1,new:["/create-new-contract"],contract:j1,create_forwarder_to:w1,constructor:x1},Di={"/view-pure-functions":["view","pure","function","functions"],"/verify-signature":["verify","signature","ecrecover"],"/values":["data","type","types","value","values","variable","variables","bool","int128","uint256","decimals","address","bytes32","Bytes","String"],"/unsafe-math":["gas","unsafe","math"],"/send-ether":["send","ether","raw_call","payable"],"/self-destruct":["selfdestruct","self","destruct"],"/references":["data","type","types","reference","references","variable","variables","array","arrays","struct","structs","HashMap","mapping"],"/re-entrancy-lock":["re-entrancy","lock","nonreentrant"],"/raw-call":["raw","call","raw_call"],"/private-public-state-variables":["private","public","state","variable","variables"],"/print":["debug","print"],"/payable":["payable","function","functions"],"/internal-external-functions":["internal","external","function","functions"],"/interface":["interface","interfaces"],"/immutable":["immutable","immutables","constant","constants"],"/if-else":["if","else","conditional","statement"],"/hello-world":["hello","world","version"],"/hash-function":["hash","keccack256","function","functions"],"/function":["function","functions"],"/for-loop":["for","loop","loops","range"],"/event":["event","events"],"/error":["error","errors"],"/dynamic-arrays":["dynamic","arrays","array"],"/delegate-call":["delegate","call"],"/defi/curve-swap":["curve","swap","defi","amm"],"/defi/curve-liquidity":["curve","add","remove liquidity","defi","amm"],"/default-function":["default","function","functions","__default__","fallback","payable"],"/create-new-contract":["create","new","contract","create_forwarder_to"],"/constructor":["constructor"],"/constants":["constant","constants"]},pa=[];for(const e of Object.keys(Di))pa.push(...Di[e]);const yp={};for(let e=0;e {const d=t.get("q");d!=null&&d.length>0&&(n(d),a(d,!1))},[]);function a(d,f){const m=d.trim();if(m.length==0){l(null),f&&s({q:""});return}const v=k1(m.split(" ")),j={};for(const w of v){const E=_1(w);for(const p of E)j[p]=!0}l(j),f&&s({q:m})}const o=K0(d=>a(d,!0),500,[]);function i(d){n(d),o(d)}function u(){return r?Object.keys(r).length==0?y.jsx("div",{children:"No results"}):y.jsx("ul",{className:ie.list,children:mr.filter(({path:d})=>r[d]).map(({path:d,title:f})=>y.jsx("li",{className:ie.listItem,children:y.jsx("a",{href:d,children:f})},d))}):y.jsxs(y.Fragment,{children:[uo.map(({routes:d,title:f},m)=>y.jsxs("div",{children:[f&&y.jsx("h3",{className:ie.category,children:f}),y.jsx("ul",{className:ie.list,children:d.map(({path:v,title:j})=>y.jsx("li",{className:ie.listItem,children:y.jsx("a",{href:v,children:j})},v))})]},m)),y.jsxs("div",{children:[y.jsx("h3",{className:ie.category,children:"Translations"}),Gh.map(({lang:d,url:f})=>y.jsx("li",{className:ie.listItem,children:y.jsx("a",{href:f,target:"__blank",children:d})},f))]})]})}return y.jsxs("div",{className:ie.component,children:[y.jsx(mp,{title:"Vyper by Example | 0.3.9",description:"Learn smart contract programming using Vyper"}),y.jsx("h1",{className:ie.header,children:y.jsx("a",{href:"/",children:"Vyper by Example"})}),y.jsx("div",{className:ie.subHeader,children:"v 0.3.9"}),y.jsxs("div",{className:ie.main,children:[y.jsxs("p",{children:["an introduction to ",y.jsx("a",{href:"https://vyper.readthedocs.io",children:"Vyper"})," with simple examples"]}),y.jsxs("div",{className:ie.youTube,children:[y.jsx("img",{src:hp,alt:"logo",className:ie.youTubeLogo}),y.jsx("a",{href:"https://www.youtube.com/@smartcontractprogrammer",target:"__blank",children:"Most code are explained here"})]}),y.jsx("div",{className:ie.updates,children:I1.map((d,f)=>y.jsx("div",{children:d},f))}),y.jsx("div",{className:ie.search,children:y.jsx(C0,{value:e,onChange:i})}),u()]})]})}const D1=[{path:"/constants",component:Mm},{path:"/constructor",component:Bm},{path:"/create-new-contract",component:Ym},{path:"/default-function",component:Jm},{path:"/defi/curve-liquidity",component:ry},{path:"/defi/curve-swap",component:uy},{path:"/delegate-call",component:hy},{path:"/dynamic-arrays",component:jy},{path:"/error",component:Sy},{path:"/event",component:Ty},{path:"/for-loop",component:zy},{path:"/function",component:$y},{path:"/hash-function",component:Hy},{path:"/hello-world",component:Xy},{path:"/if-else",component:ev},{path:"/immutable",component:lv},{path:"/interface",component:cv},{path:"/internal-external-functions",component:mv},{path:"/payable",component:wv},{path:"/print",component:Ev},{path:"/private-public-state-variables",component:Lv},{path:"/raw-call",component:Dv},{path:"/re-entrancy-lock",component:Uv},{path:"/references",component:Wv},{path:"/self-destruct",component:Gv},{path:"/send-ether",component:n0},{path:"/unsafe-math",component:a0},{path:"/values",component:p0},{path:"/verify-signature",component:y0},{path:"/view-pure-functions",component:x0},{path:"",component:z1}];function Ai(){const{state:e,init:n}=ao();return S.useLayoutEffect(()=>{n({width:window.document.body.clientWidth})},[]),e.initialized?y.jsx($h,{basename:"",children:y.jsx(Pm,{children:y.jsx(Ah,{children:D1.map(t=>{const{prev:s,next:r}=em(t.path);return y.jsx(fp,{path:t.path,element:Yi.createElement(t.component,{prev:s,next:r})},t.path)})})})}):null}const A1=document.getElementById("root"),F1=ep(A1),Fi=document.getElementById("root");Fi.hasChildNodes()?Jc(Fi,y.jsx(ki,{children:y.jsx(Ai,{})})):F1.render(y.jsx(ki,{children:y.jsx(Ai,{})})); diff --git a/assets/telegram-zGrx4xca.png b/assets/telegram-DMavHjFx.png similarity index 100% rename from assets/telegram-zGrx4xca.png rename to assets/telegram-DMavHjFx.png diff --git a/constants/index.html b/constants/index.html index 1d5cf7b..b3f21e2 100644 --- a/constants/index.html +++ b/constants/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/constructor/index.html b/constructor/index.html index 1d5cf7b..b3f21e2 100644 --- a/constructor/index.html +++ b/constructor/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/create-new-contract/index.html b/create-new-contract/index.html index 1d5cf7b..b3f21e2 100644 --- a/create-new-contract/index.html +++ b/create-new-contract/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/default-function/index.html b/default-function/index.html index 1d5cf7b..b3f21e2 100644 --- a/default-function/index.html +++ b/default-function/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/defi/curve-liquidity/index.html b/defi/curve-liquidity/index.html index 1d5cf7b..b3f21e2 100644 --- a/defi/curve-liquidity/index.html +++ b/defi/curve-liquidity/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/defi/curve-swap/index.html b/defi/curve-swap/index.html index 1d5cf7b..b3f21e2 100644 --- a/defi/curve-swap/index.html +++ b/defi/curve-swap/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/delegate-call/index.html b/delegate-call/index.html index 1d5cf7b..b3f21e2 100644 --- a/delegate-call/index.html +++ b/delegate-call/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/dynamic-arrays/index.html b/dynamic-arrays/index.html index 1d5cf7b..b3f21e2 100644 --- a/dynamic-arrays/index.html +++ b/dynamic-arrays/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/error/index.html b/error/index.html index 1d5cf7b..b3f21e2 100644 --- a/error/index.html +++ b/error/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/event/index.html b/event/index.html index 1d5cf7b..b3f21e2 100644 --- a/event/index.html +++ b/event/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/for-loop/index.html b/for-loop/index.html index 1d5cf7b..b3f21e2 100644 --- a/for-loop/index.html +++ b/for-loop/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/function/index.html b/function/index.html index 1d5cf7b..b3f21e2 100644 --- a/function/index.html +++ b/function/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/hash-function/index.html b/hash-function/index.html index 1d5cf7b..b3f21e2 100644 --- a/hash-function/index.html +++ b/hash-function/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/hello-world/index.html b/hello-world/index.html index 1d5cf7b..b3f21e2 100644 --- a/hello-world/index.html +++ b/hello-world/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/if-else/index.html b/if-else/index.html index 1d5cf7b..b3f21e2 100644 --- a/if-else/index.html +++ b/if-else/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/immutable/index.html b/immutable/index.html index 1d5cf7b..b3f21e2 100644 --- a/immutable/index.html +++ b/immutable/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/index.html b/index.html index 1d5cf7b..b3f21e2 100644 --- a/index.html +++ b/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/interface/index.html b/interface/index.html index 1d5cf7b..b3f21e2 100644 --- a/interface/index.html +++ b/interface/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/internal-external-functions/index.html b/internal-external-functions/index.html index 1d5cf7b..b3f21e2 100644 --- a/internal-external-functions/index.html +++ b/internal-external-functions/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/payable/index.html b/payable/index.html index 1d5cf7b..b3f21e2 100644 --- a/payable/index.html +++ b/payable/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/print/index.html b/print/index.html index 1d5cf7b..b3f21e2 100644 --- a/print/index.html +++ b/print/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/private-public-state-variables/index.html b/private-public-state-variables/index.html index 1d5cf7b..b3f21e2 100644 --- a/private-public-state-variables/index.html +++ b/private-public-state-variables/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/raw-call/index.html b/raw-call/index.html index 1d5cf7b..b3f21e2 100644 --- a/raw-call/index.html +++ b/raw-call/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/re-entrancy-lock/index.html b/re-entrancy-lock/index.html index 1d5cf7b..b3f21e2 100644 --- a/re-entrancy-lock/index.html +++ b/re-entrancy-lock/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/references/index.html b/references/index.html index 1d5cf7b..b3f21e2 100644 --- a/references/index.html +++ b/references/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/self-destruct/index.html b/self-destruct/index.html index 1d5cf7b..b3f21e2 100644 --- a/self-destruct/index.html +++ b/self-destruct/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/send-ether/index.html b/send-ether/index.html index 1d5cf7b..b3f21e2 100644 --- a/send-ether/index.html +++ b/send-ether/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/unsafe-math/index.html b/unsafe-math/index.html index 1d5cf7b..b3f21e2 100644 --- a/unsafe-math/index.html +++ b/unsafe-math/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/values/index.html b/values/index.html index 1d5cf7b..b3f21e2 100644 --- a/values/index.html +++ b/values/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/verify-signature/index.html b/verify-signature/index.html index 1d5cf7b..b3f21e2 100644 --- a/verify-signature/index.html +++ b/verify-signature/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + + diff --git a/view-pure-functions/index.html b/view-pure-functions/index.html index 1d5cf7b..b3f21e2 100644 --- a/view-pure-functions/index.html +++ b/view-pure-functions/index.html @@ -31,8 +31,8 @@ gtag("config", "G-KTVFSR7C2H") - - + +