10900 lines
302 KiB
Text
Generated
10900 lines
302 KiB
Text
Generated
'# pragma version 0.3.10' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'# pragma optimize codesize' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'# pragma evm-version shanghai' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'"""' Comment.Multiline
|
|
'\n@title CurveStableSwapNG\n@author Curve.Fi\n@license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved\n@notice Stableswap implementation for up to 8 coins with no rehypothecation,\n i.e. the AMM does not deposit tokens into other contracts. The Pool contract also\n records exponential moving averages for coins relative to coin 0.\n@dev Asset Types:\n 0. Standard ERC20 token with no additional features.\n Note: Users are advised to do careful due-diligence on\n ERC20 tokens that they interact with, as this\n contract cannot differentiate between harmless and\n malicious ERC20 tokens.\n 1. Oracle - token with rate oracle (e.g. wstETH)\n Note: Oracles may be controlled externally by an EOA. Users\n are advised to proceed with caution.\n 2. Rebasing - token with rebase (e.g. stETH).\n Note: Users and Integrators are advised to understand how\n the AMM contract works with rebasing balances.\n 3. ERC4626 - token with convertToAssets method (e.g. sDAI).\n Note: Some ERC4626 implementations may be susceptible to\n Donation/Inflation attacks. Users are advised to\n proceed with caution.\n Supports:\n 1. ERC20 support for return True/revert, return True/False, return None\n 2. ERC20 tokens can have arbitrary decimals (<=18).\n 3. ERC20 tokens that rebase (either positive or fee on transfer)\n 4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.)\n Note: Oracle precision _must_ be 10**18.\n 5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying\n asset.\n Additional features include:\n 1. Adds price oracles based on AMM State Price (and _not_ last traded price).\n 2. Adds TVL oracle based on D.\n 3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred\n prior to executing the swap.\n Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing)\n then calling `exchange_received` will REVERT.\n b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing)\n then this is an incorrect implementation and rebases can be\n stolen.\n 4. Adds `get_dx`: Similar to `get_dy` which returns an expected output\n of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected\n input of coin[i] for an output amount of coin[j].\n 5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very\n slight discrepancies between calculated fees and realised fees.\n' Comment.Multiline
|
|
|
|
'"""' Comment.Multiline
|
|
'\n\n' Text.Whitespace
|
|
|
|
'from' Keyword
|
|
' ' Text.Whitespace
|
|
'vyper.interfaces' Name.Namespace
|
|
' ' Text.Whitespace
|
|
'import' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'\n' Text.Whitespace
|
|
|
|
'from' Keyword
|
|
' ' Text.Whitespace
|
|
'vyper.interfaces' Name.Namespace
|
|
' ' Text.Whitespace
|
|
'import' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC20Detailed' Name.Class
|
|
'\n' Text.Whitespace
|
|
|
|
'from' Keyword
|
|
' ' Text.Whitespace
|
|
'vyper.interfaces' Name.Namespace
|
|
' ' Text.Whitespace
|
|
'import' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC4626' Name.Class
|
|
'\n\n' Text.Whitespace
|
|
|
|
'implements' Keyword
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# ------------------------------- Interfaces ---------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'interface' Keyword
|
|
' ' Text.Whitespace
|
|
'Factory' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'fee_receiver' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'admin' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'views_implementation' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n\n' Text.Whitespace
|
|
|
|
'interface' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC1271' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'isValidSignature' Name.Function
|
|
'(' Punctuation
|
|
'_hash:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_signature:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'Bytes[65]' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n\n' Text.Whitespace
|
|
|
|
'interface' Keyword
|
|
' ' Text.Whitespace
|
|
'StableSwapViews' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_dx' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'pool:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_dy' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'pool:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'dynamic_fee' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'pool:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n ' Text.Whitespace
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'calc_token_amount' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_is_deposit:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_pool:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'view' Keyword.Declaration
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# --------------------------------- Events -----------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'Transfer' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sender:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'Approval' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'owner:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'spender:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'TokenExchange' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'buyer:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sold_id:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'tokens_sold:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'bought_id:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'tokens_bought:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'TokenExchangeUnderlying' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'buyer:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sold_id:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'tokens_sold:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'bought_id:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'tokens_bought:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'AddLiquidity' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'provider:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'token_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fees:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'invariant:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'token_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'RemoveLiquidity' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'provider:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'token_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fees:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'token_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'RemoveLiquidityOne' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'provider:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'token_id:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'token_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'coin_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'token_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'RemoveLiquidityImbalance' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'provider:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'indexed' Keyword
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'token_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fees:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'invariant:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'token_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'RampA' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'old_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'new_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'initial_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'future_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'StopRampA' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
't:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n' Text.Whitespace
|
|
|
|
'event' Keyword
|
|
' ' Text.Whitespace
|
|
'ApplyNewFee' Name.Class
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
'offpeg_fee_multiplier:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'MAX_COINS:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'8' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# max coins is 8 in the factory' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'MAX_COINS_128:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'int128' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'8' Literal.Number.Integer
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# ---------------------------- Pool Variables --------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'N_COINS:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'N_COINS_128:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'int128' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'PRECISION:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'18' Literal.Number.Integer
|
|
'\n\n' Text.Whitespace
|
|
|
|
'factory:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'Factory' Name
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'coins:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'asset_types:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint8' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'stored_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# Fee specific vars' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'FEE_DENOMINATOR:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
'\n' Text.Whitespace
|
|
|
|
'fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# fee * 1e10' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'offpeg_fee_multiplier:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# * 1e10' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'admin_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'5000000000' Literal.Number.Integer
|
|
'\n' Text.Whitespace
|
|
|
|
'MAX_FEE:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'5' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'9' Literal.Number.Integer
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# ---------------------- Pool Amplification Parameters -----------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'A_PRECISION:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'100' Literal.Number.Integer
|
|
'\n' Text.Whitespace
|
|
|
|
'MAX_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'6' Literal.Number.Integer
|
|
'\n' Text.Whitespace
|
|
|
|
'MAX_A_CHANGE:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
'\n\n' Text.Whitespace
|
|
|
|
'initial_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'future_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'initial_A_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'future_A_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# ---------------------------- Admin Variables -------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'MIN_RAMP_TIME:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'86400' Literal.Number.Integer
|
|
'\n' Text.Whitespace
|
|
|
|
'admin_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# ----------------------- Oracle Specific vars -------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'rate_multipliers:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'# [bytes4 method_id][bytes8 <empty>][bytes20 oracle]' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'oracles:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# For ERC4626 tokens, we need:' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'call_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'scale_factor:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'last_prices_packed:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'# packing: last_price, ma_price' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'last_D_packed:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'# packing: last_D, ma_D' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'ma_exp_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'D_ma_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'ma_last_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# packing: ma_last_time_p, ma_last_time_D' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'# ma_last_time has a distinction for p and D because p is _not_ updated if' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'# users remove_liquidity, but D is.' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# shift(2**32 - 1, 224)' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'ORACLE_BIT_MASK:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'32' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'256' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'28' Literal.Number.Integer
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# --------------------------- ERC20 Specific Vars ----------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'name:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'String' Keyword.Type
|
|
'[' Punctuation
|
|
'64' Literal.Number.Integer
|
|
']' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'symbol:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'String' Keyword.Type
|
|
'[' Punctuation
|
|
'32' Literal.Number.Integer
|
|
']' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'decimals:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint8' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'18' Literal.Number.Integer
|
|
'\n' Text.Whitespace
|
|
|
|
'version:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'String' Keyword.Type
|
|
'[' Punctuation
|
|
'8' Literal.Number.Integer
|
|
']' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'v7.0.0' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n\n' Text.Whitespace
|
|
|
|
'balanceOf:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'HashMap' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'allowance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'HashMap' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'HashMap' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
']' Punctuation
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'total_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
'nonces:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'HashMap' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'# keccak256("isValidSignature(bytes32,bytes)")[:4] << 224' Comment.Single
|
|
'\n' Text.Whitespace
|
|
|
|
'ERC1271_MAGIC_VAL:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0x1626ba7e00000000000000000000000000000000000000000000000000000000' Literal.Number.Hex
|
|
'\n' Text.Whitespace
|
|
|
|
'EIP712_TYPEHASH:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'"' Literal.String.Double
|
|
'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'EIP2612_TYPEHASH:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'"' Literal.String.Double
|
|
'Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
')' Punctuation
|
|
'\n\n' Text.Whitespace
|
|
|
|
'VERSION_HASH:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'constant' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'version' Name
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'NAME_HASH:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'CACHED_CHAIN_ID:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'salt:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'public' Keyword.Declaration
|
|
'(' Punctuation
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'CACHED_DOMAIN_SEPARATOR:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'immutable' Keyword.Declaration
|
|
'(' Punctuation
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# ------------------------------ AMM Setup -----------------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'__init__' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_name:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'String' Keyword.Type
|
|
'[' Punctuation
|
|
'32' Literal.Number.Integer
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_symbol:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'String' Keyword.Type
|
|
'[' Punctuation
|
|
'10' Literal.Number.Integer
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_offpeg_fee_multiplier:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_ma_exp_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_coins:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_rate_multipliers:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_asset_types:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint8' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_method_ids:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'bytes4' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_oracles:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
"\n @notice Initialize the pool contract\n @param _name Name of the new plain pool.\n @param _symbol Symbol for the new plain pool.\n @param _A Amplification co-efficient - a lower value here means\n less tolerance for imbalance within the pool's assets.\n Suggested values include:\n * Uncollateralized algorithmic stablecoins: 5-10\n * Non-redeemable, collateralized assets: 100\n * Redeemable assets: 200-400\n @param _fee Trade fee, given as an integer with 1e10 precision. The\n the maximum is 1% (100000000).\n 50% of the fee is distributed to veCRV holders.\n @param _offpeg_fee_multiplier A multiplier that determines how much to increase\n Fees by when assets in the AMM depeg. Example value: 20000000000\n @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2)\n Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866\n @param _coins List of addresses of the coins being used in the pool.\n @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)]\n @param _asset_types Array of uint8 representing tokens in pool\n @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures\n of the oracle addresses that gives rate oracles.\n Calculated as: keccak(text=event_signature.replace(" Comment.Multiline
|
|
'"' Comment.Multiline
|
|
' ' Comment.Multiline
|
|
'"' Comment.Multiline
|
|
', ' Comment.Multiline
|
|
'"' Comment.Multiline
|
|
'"' Comment.Multiline
|
|
'))[:4]\n @param _oracles Array of rate oracle addresses.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n\n ' Text.Whitespace
|
|
'coins' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_coins' Name
|
|
'\n ' Text.Whitespace
|
|
'asset_types' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_asset_types' Name
|
|
'\n ' Text.Whitespace
|
|
'__n_coins:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'len' Name.Builtin
|
|
'(' Punctuation
|
|
'_coins' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'__n_coins' Name
|
|
'\n ' Text.Whitespace
|
|
'N_COINS_128' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'__n_coins' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'rate_multipliers' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_rate_multipliers' Name
|
|
'\n\n ' Text.Whitespace
|
|
'factory' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'Factory' Name
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_A' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'A' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'A' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'fee' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_fee' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'offpeg_fee_multiplier' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_offpeg_fee_multiplier' Name
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_ma_exp_time' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_exp_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_ma_exp_time' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'D_ma_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'62324' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# <--------- 12 hours default on contract start.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------- initialize storage for DynArrays ------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'_call_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_scale_factor:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_prices_packed' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'18' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'18' Literal.Number.Integer
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'oracles' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'_method_ids' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'224' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'|' Operator
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'_oracles' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'stored_balances' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'0' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'0' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_asset_types' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'3' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'_call_amount' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'ERC20Detailed' Name
|
|
'(' Punctuation
|
|
'_coins' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'decimals' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_underlying_asset:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ERC4626' Name
|
|
'(' Punctuation
|
|
'_coins' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'asset' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_scale_factor' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'(' Punctuation
|
|
'18' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'ERC20Detailed' Name
|
|
'(' Punctuation
|
|
'_underlying_asset' Name
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'decimals' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'_call_amount' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'0' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_scale_factor' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'0' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'call_amount' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_call_amount' Name
|
|
'\n ' Text.Whitespace
|
|
'scale_factor' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_scale_factor' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# ----------------------------- ERC20 stuff ------------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'name' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_name' Name
|
|
'\n ' Text.Whitespace
|
|
'symbol' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_symbol' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# EIP712 related params -----------------' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'NAME_HASH' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'name' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'salt' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'block' Name
|
|
'.' Punctuation
|
|
'prevhash' Name
|
|
'\n ' Text.Whitespace
|
|
'CACHED_CHAIN_ID' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'chain' Name
|
|
'.' Punctuation
|
|
'id' Name
|
|
'\n ' Text.Whitespace
|
|
'CACHED_DOMAIN_SEPARATOR' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_abi_encode' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'EIP712_TYPEHASH' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'NAME_HASH' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'VERSION_HASH' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'chain' Name
|
|
'.' Punctuation
|
|
'id' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'salt' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------ Fire a transfer event -------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'Transfer' Name.Class
|
|
'(' Punctuation
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# ------------------ Token transfers in and out of the AMM -------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_transfer_in' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'coin_idx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sender:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'expect_optimistic_transfer:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Contains all logic to handle ERC20 token transfers.\n @param coin_idx Index of the coin to transfer in.\n @param dx amount of `_coin` to transfer into the pool.\n @param dy amount of `_coin` to transfer out of the pool.\n @param sender address to transfer `_coin` from.\n @param receiver address to transfer `_coin` to.\n @param expect_optimistic_transfer True if contract expects an optimistic coin transfer\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'_dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'coin_idx' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------- Handle Transfers -----------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'expect_optimistic_transfer:' Name.Variable
|
|
'\n\n ' Text.Whitespace
|
|
'_dx' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'stored_balances' Name
|
|
'[' Punctuation
|
|
'coin_idx' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'dx' Name
|
|
'\n\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'dx' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev : do not transferFrom 0 tokens into the pool' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'coin_idx' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'transferFrom' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sender' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dx' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'default_return_value' Name
|
|
'=' Operator
|
|
'True' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'_dx' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'coin_idx' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# --------------------------- Store transferred in amount ---------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'stored_balances' Name
|
|
'[' Punctuation
|
|
'coin_idx' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_transfer_out' Name.Function
|
|
'(' Punctuation
|
|
'_coin_idx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Transfer a single token from the pool to receiver.\n @dev This function is called by `remove_liquidity` and\n `remove_liquidity_one`, `_exchange` and `_withdraw_admin_fees` methods.\n @param _coin_idx Index of the token to transfer out\n @param _amount Amount of token to transfer out\n @param receiver Address to send the tokens to\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n\n ' Text.Whitespace
|
|
'coin_balance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'_coin_idx' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------- Handle Transfers -----------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'_coin_idx' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'transfer' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'receiver' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'default_return_value' Name
|
|
'=' Operator
|
|
'True' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ----------------------- Update Stored Balances -------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'stored_balances' Name
|
|
'[' Punctuation
|
|
'_coin_idx' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'coin_balance' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'_amount' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# -------------------------- AMM Special Methods -----------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_stored_rates' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Gets rate multipliers for each coin.\n @dev If the coin has a rate oracle that has been properly initialised,\n this method queries that rate by static-calling an external\n contract.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'rate_multipliers' Name
|
|
'\n ' Text.Whitespace
|
|
'oracles:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'oracles' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'asset_types' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'and' Name
|
|
' ' Text.Whitespace
|
|
'not' Name
|
|
' ' Text.Whitespace
|
|
'oracles' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# NOTE: fetched_rate is assumed to be 10**18 precision' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'fetched_rate:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'raw_call' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'oracles' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'%' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'160' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_abi_encode' Name.Builtin
|
|
'(' Punctuation
|
|
'oracles' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'&' Operator
|
|
' ' Text.Whitespace
|
|
'ORACLE_BIT_MASK' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'max_outsize' Name
|
|
'=' Operator
|
|
'32' Literal.Number.Integer
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'is_static_call' Name
|
|
'=' Operator
|
|
'True' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'fetched_rate' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'elif' Keyword
|
|
' ' Text.Whitespace
|
|
'asset_types' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'3' Literal.Number.Integer
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'# ERC4626' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i]' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# here: call_amount has ERC4626 precision, but the returned value is scaled up to 18' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# using scale_factor which is (18 - n) if underlying asset has n decimals.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'ERC4626' Name
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'convertToAssets' Name
|
|
'(' Punctuation
|
|
'call_amount' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'scale_factor' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'PRECISION' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# 1e18 precision' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_balances' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
"\n @notice Calculates the pool's balances _excluding_ the admin's balances.\n @dev If the pool contains rebasing tokens, this method ensures LPs keep all\n rebases and admin only claims swap fees. This also means that, since\n admin's balances are stored in an array and not inferred from read balances,\n the fees in the rebasing token that the admin collects is immune to\n slashing events.\n " Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'result:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'balances_i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'asset_types:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'balances_i' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ERC20' Name.Class
|
|
'(' Punctuation
|
|
'coins' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'balances_i' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'stored_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'result' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'balances_i' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'result' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# -------------------------- AMM Main Functions ------------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'exchange' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Perform an exchange between two coins\n @dev Index values can be found via the `coins` public getter method\n @param i Index value for the coin to send\n @param j Index value of the coin to recieve\n @param _dx Amount of `i` being exchanged\n @param _min_dy Minimum amount of `j` to receive\n @return Actual amount of `j` received\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_exchange' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dx' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_dy' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'False' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'exchange_received' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Perform an exchange between two coins without transferring token in\n @dev The contract swaps tokens based on a change in balance of coin[i]. The\n dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of\n this method are dex aggregators, arbitrageurs, or other users who do not\n wish to grant approvals to the contract: they would instead send tokens\n directly to the contract and call `exchange_received`.\n Note: This is disabled if pool contains rebasing tokens.\n @param i Index value for the coin to send\n @param j Index valie of the coin to recieve\n @param _dx Amount of `i` being exchanged\n @param _min_dy Minimum amount of `j` to receive\n @return Actual amount of `j` received\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'not' Name
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'asset_types' Name
|
|
' ' Text.Whitespace
|
|
'# dev: exchange_received not supported if pool contains rebasing tokens' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_exchange' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dx' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_dy' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'True' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'# <--------------------------------------- swap optimistically.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'add_liquidity' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_mint_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Deposit coins into the pool\n @param _amounts List of amounts of coins to deposit\n @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit\n @param _receiver Address that owns the minted LP tokens\n @return Amount of LP tokens received by depositing\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'old_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Initial invariant' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'D0:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'total_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'new_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# -------------------------- Do Transfers In -----------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_amounts' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'new_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_in' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amounts' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'False' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'# expect_optimistic_transfer' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: initial deposit requires all coins' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------------------------------------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# Invariant after change' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'D1:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'new_balances' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# We need to recalculate the invariant accounting for fees' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
"# to calculate fair user's share" Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'fees:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'mint_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'ideal_balance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'difference:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'new_balance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'ys:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
'\n ' Text.Whitespace
|
|
'xs:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'_dynamic_fee_i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'# Only account for fees if we are not the first to deposit' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'base_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'4' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
'\n ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'new_balance' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'new_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'xs' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'old_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dynamic_fee_i' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_dynamic_fee' Name
|
|
'(' Punctuation
|
|
'xs' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'ys' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'base_fee' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fees' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'_dynamic_fee_i' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'fees' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'admin_fee' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
'\n ' Text.Whitespace
|
|
'new_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'fees' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_xp_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'new_balances' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# <--------------- Reuse D1 for new D value.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'mint_amount' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'upkeep_oracles' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'mint_amount' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'# Take the dust if there was any' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# (re)instantiate D oracle if totalSupply is zero.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_D_packed' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'D1' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'mint_amount' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'_min_mint_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'Slippage screwed you' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n\n ' Text.Whitespace
|
|
'# Mint pool tokens' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'mint_amount' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'[' Punctuation
|
|
'_receiver' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'mint_amount' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'Transfer' Name.Class
|
|
'(' Punctuation
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_receiver' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'mint_amount' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'AddLiquidity' Name.Class
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amounts' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'fees' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'mint_amount' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'remove_liquidity_one_coin' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_received:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Withdraw a single coin from the pool\n @param _burn_amount Amount of LP tokens to burn in the withdrawal\n @param i Index value of the coin to withdraw\n @param _min_received Minimum amount of coin to receive\n @param _receiver Address that receives the withdrawn coins\n @return Amount of coin received\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: do not remove 0 LP tokens' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'fee' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_withdraw_one_coin' Name
|
|
'(' Punctuation
|
|
'_burn_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'_min_received' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'Not enough coins removed' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'admin_fee' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_burnFrom' Name
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_out' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_receiver' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'RemoveLiquidityOne' Name.Class
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'upkeep_oracles' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'remove_liquidity_imbalance' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_max_burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Withdraw coins from the pool in an imbalanced amount\n @param _amounts List of amounts of underlying coins to withdraw\n @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal\n @param _receiver Address that receives the withdrawn coins\n @return Actual amount of the LP token burned in the withdrawal\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'old_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D0:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'new_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_amounts' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'new_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_amounts' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_out' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amounts' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_receiver' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'D1:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'new_balances' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'base_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'4' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ys:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
'\n\n ' Text.Whitespace
|
|
'fees:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'dynamic_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'xs:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'ideal_balance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'difference:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'new_balance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
'\n ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'new_balance' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'new_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'ideal_balance' Name
|
|
'\n\n ' Text.Whitespace
|
|
'xs' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'old_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'new_balance' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'dynamic_fee' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_dynamic_fee' Name
|
|
'(' Punctuation
|
|
'xs' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'ys' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'base_fee' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fees' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'dynamic_fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'difference' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'fees' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'admin_fee' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
'\n ' Text.Whitespace
|
|
'new_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'fees' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'new_balances' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# dev: reuse D1 for new D.' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'upkeep_oracles' Name
|
|
'(' Punctuation
|
|
'new_balances' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'total_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'(' Punctuation
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'burn_amount' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: zero tokens burned' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'burn_amount' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'_max_burn_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'Slippage screwed you' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n\n ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'burn_amount' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_burnFrom' Name
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'burn_amount' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'RemoveLiquidityImbalance' Name.Class
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amounts' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'fees' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'burn_amount' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'remove_liquidity' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_claim_admin_fees:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'True' Name
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Withdraw coins from the pool\n @dev Withdrawal amounts are based on current deposit ratios\n @param _burn_amount Quantity of LP tokens to burn in the withdrawal\n @param _min_amounts Minimum amounts of underlying coins to receive\n @param _receiver Address that receives the withdrawn coins\n @return List of amounts of coins that were withdrawn\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'total_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: invalid burn amount' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'value' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'_min_amounts' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'Withdrawal resulted in fewer coins than expected' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n ' Text.Whitespace
|
|
'amounts' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'value' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_out' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_receiver' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_burnFrom' Name
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# <---- Updates self.total_supply' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# --------------------------- Upkeep D_oracle ----------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'ma_last_time_unpacked:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'[' Punctuation
|
|
'2' Literal.Number.Integer
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'unpack_2' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'last_D_packed_current:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_D_packed' Name
|
|
'\n ' Text.Whitespace
|
|
'old_D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'last_D_packed_current' Name
|
|
' ' Text.Whitespace
|
|
'&' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_D_packed' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'old_D' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'old_D' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'# new_D = proportionally reduce D.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_moving_average' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'last_D_packed_current' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'D_ma_time' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'1' Literal.Number.Integer
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'1' Literal.Number.Integer
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'1' Literal.Number.Integer
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'0' Literal.Number.Integer
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'1' Literal.Number.Integer
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------------- Log event ------------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'RemoveLiquidity' Name.Class
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'amounts' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------- Withdraw admin fees if _claim_admin_fees is set to True --------' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_claim_admin_fees:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_withdraw_admin_fees' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'amounts' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'withdraw_admin_fees' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Claim admin fees. Callable by anyone.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_withdraw_admin_fees' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# ------------------------ AMM Internal Functions ----------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_dynamic_fee' Name.Function
|
|
'(' Punctuation
|
|
'xpi:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'xpj:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'_offpeg_fee_multiplier:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'offpeg_fee_multiplier' Name
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_offpeg_fee_multiplier' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'_fee' Name
|
|
'\n\n ' Text.Whitespace
|
|
'xps2:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'xpi' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'xpj' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'(' Punctuation
|
|
'_offpeg_fee_multiplier' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'_fee' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
'\n ' Text.Whitespace
|
|
'(' Punctuation
|
|
'(' Punctuation
|
|
'_offpeg_fee_multiplier' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'4' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'xpi' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'xpj' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'xps2' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'__exchange' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'x:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D' Name
|
|
'(' Punctuation
|
|
'_xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'y:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_y' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_xp' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# -1 just in case there were some rounding errors' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'dy_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_dynamic_fee' Name
|
|
'(' Punctuation
|
|
'(' Punctuation
|
|
'_xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'_xp' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'fee' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# Convert all to real units' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'dy_fee' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'dy_fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'admin_fee' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Calculate and store state prices:' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_xp' Name
|
|
'\n ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
'\n ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'# D is not changed because we did not apply a fee' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'upkeep_oracles' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_exchange' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sender:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_min_dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'expect_optimistic_transfer:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'# dev: coin index out of range' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: do not exchange 0 coins' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'old_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_xp_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'old_balances' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# --------------------------- Do Transfer in -----------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# `dx` is whatever the pool received after ERC20 transfer:' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_in' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_dx' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'sender' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'expect_optimistic_transfer' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------------- Exchange -------------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'x:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'dx' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
'\n ' Text.Whitespace
|
|
'dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'__exchange' Name
|
|
'(' Punctuation
|
|
'x' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'_min_dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'Exchange resulted in fewer coins than expected' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n\n ' Text.Whitespace
|
|
'# --------------------------- Do Transfer out ----------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_out' Name
|
|
'(' Punctuation
|
|
'j' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'receiver' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# ------------------------------------------------------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'TokenExchange' Name.Class
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_dx' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_withdraw_admin_fees' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'fee_receiver:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'fee_receiver' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'fee_receiver' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# dev: fee receiver not set' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'admin_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer_out' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'fee_receiver' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'admin_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'admin_balances' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'admin_balances' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# --------------------------- AMM Math Functions -----------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_y' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'x:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
"\n Calculate x[j] if one makes x[i] = x\n\n Done by solving quadratic equation iteratively.\n x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)\n x_1**2 + b*x_1 = c\n\n x_1 = (x_1**2 + c) / (2*x_1 + b)\n " Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'# x in the input is converted to the same price/precision' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'# dev: same coin' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: j below zero' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128' Name
|
|
' ' Text.Whitespace
|
|
'# dev: j above N_COINS' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# should be unreachable, but good for safety' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128' Name
|
|
'\n\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_amp' Name
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_D' Name
|
|
'\n\n ' Text.Whitespace
|
|
'S_:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'_x:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'y_prev:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'c:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n ' Text.Whitespace
|
|
'Ann:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'_x' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
'\n ' Text.Whitespace
|
|
'elif' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'_x' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'_i' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'continue' Name
|
|
'\n\n ' Text.Whitespace
|
|
'S_' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_x' Name
|
|
'\n ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'_x' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'Ann' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'b:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'S_' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'Ann' Name
|
|
' ' Text.Whitespace
|
|
'# - D' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'y:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'255' Literal.Number.Integer
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'y_prev' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'y' Name
|
|
'*' Operator
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'c' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'b' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'# Equality with the precision of 1' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'y_prev:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'y_prev' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'y_prev' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'raise' Keyword
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_D' Name.Function
|
|
'(' Punctuation
|
|
'_xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n D invariant calculation in non-overflowing integer operations\n iteratively\n\n A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i))\n\n Converging solution:\n D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1)\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'S:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'_xp:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'S' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'S' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'S' Name
|
|
'\n ' Text.Whitespace
|
|
'Ann:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_amp' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
'\n ' Text.Whitespace
|
|
'D_P:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'Dprev:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'255' Literal.Number.Integer
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'D_P' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'_xp:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'D_P' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D_P' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'x' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'Dprev' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P)' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'(' Punctuation
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'Ann' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'S' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'D_P' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'\n ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'(' Punctuation
|
|
'Ann' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'\n ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'N_COINS' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D_P' Name
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Equality with the precision of 1' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'Dprev:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'Dprev' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'Dprev' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n ' Text.Whitespace
|
|
'# convergence typically occurs in 4 rounds or less, this should be unreachable!' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# if it does happen the pool is borked and LPs can withdraw via `remove_liquidity`' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'raise' Keyword
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_y_D' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
"\n Calculate x[i] if one reduces D from being calculated for xp to D\n\n Done by solving quadratic equation iteratively.\n x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)\n x_1**2 + b*x_1 = c\n\n x_1 = (x_1**2 + c) / (2*x_1 + b)\n " Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'# x in the input is converted to the same price/precision' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'# dev: i below zero' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128' Name
|
|
' ' Text.Whitespace
|
|
'# dev: i above N_COINS' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'S_:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'_x:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'y_prev:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'c:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n ' Text.Whitespace
|
|
'Ann:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'A' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'_x' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'_i' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'continue' Name
|
|
'\n ' Text.Whitespace
|
|
'S_' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_x' Name
|
|
'\n ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'_x' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'c' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'Ann' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'b:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'S_' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'Ann' Name
|
|
'\n ' Text.Whitespace
|
|
'y:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'_i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'255' Literal.Number.Integer
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'y_prev' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'y' Name
|
|
'*' Operator
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'c' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'b' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'# Equality with the precision of 1' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'y_prev:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'y_prev' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'y_prev' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
'\n ' Text.Whitespace
|
|
'raise' Keyword
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_A' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n Handle ramping A up or down\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
't1:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A_time' Name
|
|
'\n ' Text.Whitespace
|
|
'A1:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
't1:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'A0:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A' Name
|
|
'\n ' Text.Whitespace
|
|
't0:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A_time' Name
|
|
'\n ' Text.Whitespace
|
|
'# Expressions in uint256 cannot have negative numbers, thus "if"' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'A1' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'A0:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'A0' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'A1' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'A0' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
't0' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
't1' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
't0' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'A0' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'A0' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'A1' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
't0' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
't1' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
't0' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'# when t1 == 0 or block.timestamp >= t1' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'A1' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_xp_mem' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'result:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n ' Text.Whitespace
|
|
'result' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'_rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'_balances' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'result' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_D_mem' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_balances:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_xp_mem' Name
|
|
'(' Punctuation
|
|
'_rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_balances' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_amp' Name
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_calc_withdraw_one_coin' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'# First, need to calculate' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# * Get current D' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# * Solve Eqn against y_i for D - _token_amount' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'rates:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_xp_mem' Name
|
|
'(' Punctuation
|
|
'rates' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D0:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'total_supply:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'D1:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'total_supply' Name
|
|
'\n ' Text.Whitespace
|
|
'new_y:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_y_D' Name
|
|
'(' Punctuation
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'base_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'4' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ys:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp_reduced:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'\n\n ' Text.Whitespace
|
|
'dx_expected:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'xp_j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'xavg:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'dynamic_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'dx_expected' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'xp_j' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'dx_expected' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp_j' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'new_y' Name
|
|
'\n ' Text.Whitespace
|
|
'xavg' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'xp_j' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'new_y' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'dx_expected' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp_j' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'xp_j' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'D0' Name
|
|
'\n ' Text.Whitespace
|
|
'xavg' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp_j' Name
|
|
'\n\n ' Text.Whitespace
|
|
'dynamic_fee' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_dynamic_fee' Name
|
|
'(' Punctuation
|
|
'xavg' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'ys' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'base_fee' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp_reduced' Name
|
|
'[' Punctuation
|
|
'j' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp_j' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'dynamic_fee' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'dx_expected' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
'\n\n ' Text.Whitespace
|
|
'dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'xp_reduced' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_y_D' Name
|
|
'(' Punctuation
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'xp_reduced' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'dy_0:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'new_y' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'# w/o fees' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'dy' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'rates' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'# Withdraw less to account for rounding errors' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'# update xp with new_y for p calculations.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'new_y' Name
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy_0' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D1' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# -------------------------- AMM Price Methods -------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'pack_2' Name.Function
|
|
'(' Punctuation
|
|
'p1:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'p2:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'p1' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'p2' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'p1' Name
|
|
' ' Text.Whitespace
|
|
'|' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'p2' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'128' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'unpack_2' Name.Function
|
|
'(' Punctuation
|
|
'packed:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'[' Punctuation
|
|
'2' Literal.Number.Integer
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'[' Punctuation
|
|
'packed' Name
|
|
' ' Text.Whitespace
|
|
'&' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'packed' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'128' Literal.Number.Integer
|
|
']' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_get_p' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# dx_0 / dx_1 only, however can have any number of coins in pool' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'ANN:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'Dr:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'D' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'pow_mod256' Name.Builtin
|
|
'(' Punctuation
|
|
'N_COINS' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS_128' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS_128:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'Dr' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'Dr' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'p:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp0_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'ANN' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'0' Literal.Number.Integer
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'1' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'p' Name
|
|
'.' Punctuation
|
|
'append' Name
|
|
'(' Punctuation
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'18' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'xp0_A' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'Dr' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'0' Literal.Number.Integer
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'xp' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'xp0_A' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'Dr' Name
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'p' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'upkeep_oracles' Name.Function
|
|
'(' Punctuation
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Upkeeps price and D oracles.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time_unpacked:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'[' Punctuation
|
|
'2' Literal.Number.Integer
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'unpack_2' Name
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'last_prices_packed_current:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_prices_packed' Name
|
|
'\n ' Text.Whitespace
|
|
'last_prices_packed_new:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'last_prices_packed_current' Name
|
|
'\n\n ' Text.Whitespace
|
|
'spot_price:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_get_p' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# -------------------------- Upkeep price oracle -------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'MAX_COINS' Name
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'N_COINS' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'break' Name
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'spot_price' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Upate packed prices -----------------' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'last_prices_packed_new' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'spot_price' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_moving_average' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'last_prices_packed_current' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_exp_time' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'0' Literal.Number.Integer
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'# index 0 is ma_exp_time for prices' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_prices_packed' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'last_prices_packed_new' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# ---------------------------- Upkeep D oracle ---------------------------' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'last_D_packed_current:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_D_packed' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_D_packed' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_moving_average' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'last_D_packed_current' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'D_ma_time' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'1' Literal.Number.Integer
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'# index 1 is ma_exp_time for D' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Housekeeping: Update ma_last_time for p and D oracles ------------------' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'for' Keyword
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'range' Name.Builtin
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'pack_2' Name
|
|
'(' Punctuation
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'0' Literal.Number.Integer
|
|
']' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'ma_last_time_unpacked' Name
|
|
'[' Punctuation
|
|
'1' Literal.Number.Integer
|
|
']' Punctuation
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_calc_moving_average' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'packed_value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'averaging_window:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'ma_last_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'last_spot_value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'packed_value' Name
|
|
' ' Text.Whitespace
|
|
'&' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'last_ema_value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'packed_value' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'128' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'ma_last_time' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'# calculate new_ema_value and return that.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'alpha:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'exp' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'-' Operator
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'(' Punctuation
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'ma_last_time' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'18' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'averaging_window' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'last_spot_value' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'18' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'alpha' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'last_ema_value' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'alpha' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'10' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'18' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'last_ema_value' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'last_price' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_prices_packed' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'&' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'ema_price' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_prices_packed' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'128' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_p' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Returns the AMM State price of token\n @dev if i = 0, it will return the state price of coin[1].\n @param i index of state price (0 for coin[1], 1 for coin[2], ...)\n @return uint256 The state price quoted by the AMM for coin[i+1]\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_xp_mem' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_get_p' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
')' Punctuation
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'price_oracle' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_moving_average' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_prices_packed' Name
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_exp_time' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
' ' Text.Whitespace
|
|
'&' Operator
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'2' Literal.Number.Integer
|
|
'*' Operator
|
|
'*' Operator
|
|
'128' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'D_oracle' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_moving_average' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'last_D_packed' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'D_ma_time' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_last_time' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'128' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# ----------------------------- Math Utils -----------------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@pure' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'exp' Name.Function
|
|
'(' Punctuation
|
|
'x:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
"\n @dev Calculates the natural exponential function of a signed integer with\n a precision of 1e18.\n @notice Note that this function consumes about 810 gas units. The implementation\n is inspired by Remco Bloemen's implementation under the MIT license here:\n https://xn--2-umb.com/22/exp-ln.\n @dev This implementation is derived from Snekmate, which is authored\n by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license.\n https://github.com/pcaversaccio/snekmate\n @param x The 32-byte variable.\n @return int256 The 32-byte calculation result.\n " Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# If the result is `< 0.5`, we return zero. This happens when we have the following:' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# "x <= floor(log(0.5e18) * 1e18) ~ -42e18".' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'(' Punctuation
|
|
'x' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'42139678854452767551' Literal.Number.Integer
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135".' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'x' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'135305999368893231589' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'"' Literal.String.Double
|
|
'wad_exp overflow' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
'\n\n ' Text.Whitespace
|
|
'# `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# intermediate precision and a binary base. This base conversion is a multiplication with' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78".' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'value' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'x' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'78' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'5' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'18' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# so that "exp(x) = exp(x\') * 2 ** k", where `k` is a signer integer. Solving this gives' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# "k = round(x / log(2))" and "x\' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]".' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'k:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'value' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'54916777467707473351141471128' Literal.Number.Integer
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'2' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'95' Literal.Number.Integer
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
'\n ' Text.Whitespace
|
|
'value' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_sub' Name.Builtin
|
|
'(' Punctuation
|
|
'value' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'k' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'54916777467707473351141471128' Literal.Number.Integer
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic,' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# we will multiply by a scaling factor later.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'y:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'value' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'1346386616545796478920950773328' Literal.Number.Integer
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'57155421227552351082224309758442' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'p:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_sub' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'y' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'94201549194550492254356042504812' Literal.Number.Integer
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'y' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
'\\' Text
|
|
'\n' Text.Whitespace
|
|
|
|
' ' Text.Whitespace
|
|
'28719021644029726153956944680412240' Literal.Number.Integer
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'4385272521454847904659076985693276' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# We leave `p` in the "2 ** 192" base so that we do not have to scale it up' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# again for the division.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'q:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_sub' Name.Builtin
|
|
'(' Punctuation
|
|
'value' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'2855989394907223263936484059900' Literal.Number.Integer
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'50020603652535783019961831881945' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'q' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_sub' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'q' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'533845033583426703283633433725380' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'q' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'q' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'3604857256930695427073651918091429' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'q' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_sub' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'q' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'14423608567350463180887372962807573' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'q' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_add' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'q' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'value' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'96' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'26449188498355588339934803723976023' Literal.Number.Integer
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# The polynomial `q` has no zeros in the range because all its roots are complex.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# No scaling is required, as `p` is already "2 ** 96" too large. Also,' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# `r` is in the range "(0.09, 0.25) * 2**96" after the division.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'r:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'unsafe_div' Name.Builtin
|
|
'(' Punctuation
|
|
'p' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'q' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# To finalise the calculation, we have to multiply `r` by:' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# - the scale factor "s = ~6.031367120",' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# - the factor "2 ** k" from the range reduction, and' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# - the factor "1e18 / 2 ** 96" for the base conversion.' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# We do this all at once, with an intermediate result in "2**213" base,' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# so that the final right shift always gives a positive value.' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
"# Note that to circumvent Vyper's safecast feature for the potentially" Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# negative parameter value `r`, we first convert `r` to `bytes32` and' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# subsequently to `uint256`. Remember that the EVM default behaviour is' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
"# to use two's complement representation to handle signed integers." Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'unsafe_mul' Name.Builtin
|
|
'(' Punctuation
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'r' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'3822833074963236453042738258902158003155416615667' Literal.Number.Integer
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'unsafe_sub' Name.Builtin
|
|
'(' Punctuation
|
|
'195' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'k' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# ---------------------------- ERC20 Utils -----------------------------------' Comment.Single
|
|
'\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_domain_separator' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'chain' Name
|
|
'.' Punctuation
|
|
'id' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'CACHED_CHAIN_ID:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_abi_encode' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'EIP712_TYPEHASH' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'NAME_HASH' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'VERSION_HASH' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'chain' Name
|
|
'.' Punctuation
|
|
'id' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'salt' Name
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'CACHED_DOMAIN_SEPARATOR' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_transfer' Name.Function
|
|
'(' Punctuation
|
|
'_from:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_to:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'# # NOTE: vyper does not allow underflows' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# # so the following subtraction would revert on insufficient balance' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'[' Punctuation
|
|
'_from' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'[' Punctuation
|
|
'_to' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'Transfer' Name.Class
|
|
'(' Punctuation
|
|
'_from' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_to' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@internal' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'_burnFrom' Name.Function
|
|
'(' Punctuation
|
|
'_from:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'balanceOf' Name
|
|
'[' Punctuation
|
|
'_from' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
'\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'Transfer' Name.Class
|
|
'(' Punctuation
|
|
'_from' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_burn_amount' Name
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'transfer' Name.Function
|
|
'(' Punctuation
|
|
'_to' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @dev Transfer token for a specified address\n @param _to The address to transfer to.\n @param _value The amount to be transferred.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer' Name
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_to' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'True' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'transferFrom' Name.Function
|
|
'(' Punctuation
|
|
'_from' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_to' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @dev Transfer tokens from one address to another.\n @param _from address The address which you want to send tokens from\n @param _to address The address which you want to transfer to\n @param _value uint256 the amount of tokens to be transferred\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_transfer' Name
|
|
'(' Punctuation
|
|
'_from' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_to' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'_allowance:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'allowance' Name
|
|
'[' Punctuation
|
|
'_from' Name
|
|
']' Punctuation
|
|
'[' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_allowance' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'max_value' Name.Builtin
|
|
'(' Punctuation
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'allowance' Name
|
|
'[' Punctuation
|
|
'_from' Name
|
|
']' Punctuation
|
|
'[' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_allowance' Name
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
'\n\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'True' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'approve' Name.Function
|
|
'(' Punctuation
|
|
'_spender' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
' ' Text.Whitespace
|
|
':' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Approve the passed address to transfer the specified amount of\n tokens on behalf of msg.sender\n @dev Beware that changing an allowance via this method brings the risk that\n someone may use both the old and new allowance by unfortunate transaction\n ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n @param _spender The address which will transfer the funds\n @param _value The amount of tokens that may be transferred\n @return bool success\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'allowance' Name
|
|
'[' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
']' Punctuation
|
|
'[' Punctuation
|
|
'_spender' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'Approval' Name.Class
|
|
'(' Punctuation
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_spender' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'True' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'permit' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_owner:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_spender:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'address' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_value:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_deadline:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_v:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint8' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_r:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_s:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
"\n @notice Approves spender by owner's signature to expend owner's tokens.\n See https://eips.ethereum.org/EIPS/eip-2612.\n @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793\n @dev Supports smart contract wallets which implement ERC1271\n https://eips.ethereum.org/EIPS/eip-1271\n @param _owner The address which is a source of funds and has signed the Permit.\n @param _spender The address which is allowed to spend the funds.\n @param _value The amount of tokens to be spent.\n @param _deadline The timestamp after which the Permit is no longer valid.\n @param _v The bytes[64] of the valid secp256k1 signature of permit by owner\n @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner\n @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner\n @return True, if transaction completes successfully\n " Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_owner' Name
|
|
' ' Text.Whitespace
|
|
'!=' Operator
|
|
' ' Text.Whitespace
|
|
'empty' Name.Builtin
|
|
'(' Punctuation
|
|
'address' Keyword.Type
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'_deadline' Name
|
|
'\n\n ' Text.Whitespace
|
|
'nonce:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'nonces' Name
|
|
'[' Punctuation
|
|
'_owner' Name
|
|
']' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'digest:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'concat' Name.Builtin
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'b' Name
|
|
'"' Literal.String.Double
|
|
'\\x' Literal.String.Escape
|
|
'19' Literal.String.Double
|
|
'\\x' Literal.String.Escape
|
|
'01' Literal.String.Double
|
|
'"' Literal.String.Double
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_domain_separator' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'keccak256' Name.Builtin
|
|
'(' Punctuation
|
|
'_abi_encode' Name.Builtin
|
|
'(' Punctuation
|
|
'EIP2612_TYPEHASH' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_owner' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_spender' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'nonce' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_deadline' Name
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_owner' Name
|
|
'.' Punctuation
|
|
'is_contract:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'sig:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'Bytes[65]' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'concat' Name.Builtin
|
|
'(' Punctuation
|
|
'_abi_encode' Name.Builtin
|
|
'(' Punctuation
|
|
'_r' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_s' Name
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'slice' Name.Builtin
|
|
'(' Punctuation
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'_v' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'31' Literal.Number.Integer
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'# reentrancy not a concern since this is a staticcall' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'ERC1271' Name
|
|
'(' Punctuation
|
|
'_owner' Name
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'isValidSignature' Name
|
|
'(' Punctuation
|
|
'digest' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'sig' Name
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'ERC1271_MAGIC_VAL' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'ecrecover' Name.Builtin
|
|
'(' Punctuation
|
|
'digest' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'_v' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'_r' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'convert' Name.Builtin
|
|
'(' Punctuation
|
|
'_s' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'_owner' Name
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'allowance' Name
|
|
'[' Punctuation
|
|
'_owner' Name
|
|
']' Punctuation
|
|
'[' Punctuation
|
|
'_spender' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'nonces' Name
|
|
'[' Punctuation
|
|
'_owner' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'nonce' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'1' Literal.Number.Integer
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'Approval' Name.Class
|
|
'(' Punctuation
|
|
'_owner' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_spender' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_value' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'True' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'DOMAIN_SEPARATOR' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'bytes32' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice EIP712 domain separator.\n @return bytes32 Domain Separator set for the current chain.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_domain_separator' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# ------------------------- AMM View Functions -------------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_dx' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Calculate the current input dx given output dy\n @dev Index values can be found via the `coins` public getter method\n @param i Index value for the coin to send\n @param j Index valie of the coin to recieve\n @param dy Amount of `j` being received after exchange\n @return Amount of `i` predicted\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'StableSwapViews' Name
|
|
'(' Punctuation
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'views_implementation' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'get_dx' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dy' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_dy' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dx:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Calculate the current output dy given input dx\n @dev Index values can be found via the `coins` public getter method\n @param i Index value for the coin to send\n @param j Index valie of the coin to recieve\n @param dx Amount of `i` being exchanged\n @return Amount of `j` predicted\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'StableSwapViews' Name
|
|
'(' Punctuation
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'views_implementation' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'get_dy' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'dx' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'calc_withdraw_one_coin' Name.Function
|
|
'(' Punctuation
|
|
'_burn_amount:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Calculate the amount received when withdrawing a single coin\n @param _burn_amount Amount of LP tokens to burn in the withdrawal\n @param i Index value of the coin to withdraw\n @return Amount of coin received\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_calc_withdraw_one_coin' Name
|
|
'(' Punctuation
|
|
'_burn_amount' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'i' Name
|
|
')' Punctuation
|
|
'[' Punctuation
|
|
'0' Literal.Number.Integer
|
|
']' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'totalSupply' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice The total supply of pool LP tokens\n @return self.total_supply, 18 decimals.\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@nonreentrant' Name.Decorator
|
|
'(' Punctuation
|
|
"'" Literal.String.Single
|
|
'lock' Literal.String.Single
|
|
"'" Literal.String.Single
|
|
')' Punctuation
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_virtual_price' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice The current virtual price of the pool LP token\n @dev Useful for calculating profits.\n The method may be vulnerable to donation-style attacks if implementation\n contains rebasing tokens. For integrators, caution is advised.\n @return LP token virtual price normalized to 1e18\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'amp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'xp:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_xp_mem' Name
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'D:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'get_D' Name
|
|
'(' Punctuation
|
|
'xp' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'amp' Name
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'# D is in the units similar to DAI (e.g. converted to precision 1e18)' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'# When balanced, D = n * x_u - total virtual value of the portfolio' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'D' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'PRECISION' Name
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'total_supply' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'calc_token_amount' Name.Function
|
|
'(' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_amounts:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
',' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_is_deposit:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'bool' Keyword.Type
|
|
'\n' Text.Whitespace
|
|
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Calculate addition or reduction in token supply from a deposit or withdrawal\n @param _amounts Amount of each coin being deposited\n @param _is_deposit set True for deposits, False for withdrawals\n @return Expected amount of LP tokens received\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'StableSwapViews' Name
|
|
'(' Punctuation
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'views_implementation' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'calc_token_amount' Name
|
|
'(' Punctuation
|
|
'_amounts' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_is_deposit' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'A' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'/' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'A_precise' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'balances' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Get the current balance of a coin within the\n pool, less the accrued admin fees\n @param i Index value for the coin to query balance of\n @return Token balance\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'[' Punctuation
|
|
'i' Name
|
|
']' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'get_balances' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_balances' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'stored_rates' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'DynArray' Name
|
|
'[' Punctuation
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'MAX_COINS' Name
|
|
']' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_stored_rates' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@view' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'dynamic_fee' Name.Function
|
|
'(' Punctuation
|
|
'i:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'int128' Keyword.Type
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'-' Operator
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Return the fee for swapping between `i` and `j`\n @param i Index value for the coin to send\n @param j Index value of the coin to recieve\n @return Swap fee expressed as an integer with 1e10 precision\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'return' Keyword
|
|
' ' Text.Whitespace
|
|
'StableSwapViews' Name
|
|
'(' Punctuation
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'views_implementation' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
')' Punctuation
|
|
'.' Punctuation
|
|
'dynamic_fee' Name
|
|
'(' Punctuation
|
|
'i' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'j' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'# --------------------------- AMM Admin Functions ----------------------------' Comment.Single
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'ramp_A' Name.Function
|
|
'(' Punctuation
|
|
'_future_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_future_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'admin' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# dev: only owner' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A_time' Name
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'MIN_RAMP_TIME' Name
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_future_time' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'+' Operator
|
|
' ' Text.Whitespace
|
|
'MIN_RAMP_TIME' Name
|
|
' ' Text.Whitespace
|
|
'# dev: insufficient time' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'_initial_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'_future_A_p:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_future_A' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'A_PRECISION' Name
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_future_A' Name
|
|
' ' Text.Whitespace
|
|
'>' Operator
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'and' Name
|
|
' ' Text.Whitespace
|
|
'_future_A' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'MAX_A' Name
|
|
'\n ' Text.Whitespace
|
|
'if' Keyword
|
|
' ' Text.Whitespace
|
|
'_future_A_p' Name
|
|
' ' Text.Whitespace
|
|
'<' Operator
|
|
' ' Text.Whitespace
|
|
'_initial_A:' Name.Variable
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_future_A_p' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'MAX_A_CHANGE' Name
|
|
' ' Text.Whitespace
|
|
'>=' Operator
|
|
' ' Text.Whitespace
|
|
'_initial_A' Name
|
|
'\n ' Text.Whitespace
|
|
'else' Keyword
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_future_A_p' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'_initial_A' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'MAX_A_CHANGE' Name
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_initial_A' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_future_A_p' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_future_time' Name
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'RampA' Name.Class
|
|
'(' Punctuation
|
|
'_initial_A' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_future_A_p' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_future_time' Name
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'stop_ramp_A' Name.Function
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'admin' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# dev: only owner' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'current_A:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'_A' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'current_A' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'current_A' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'initial_A_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'future_A_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
'\n ' Text.Whitespace
|
|
'# now (block.timestamp < t1) is always False, so we return saved A' Comment.Single
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'StopRampA' Name.Class
|
|
'(' Punctuation
|
|
'current_A' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'block.timestamp' Name.Builtin.Pseudo
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'set_new_fee' Name.Function
|
|
'(' Punctuation
|
|
'_new_fee:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_new_offpeg_fee_multiplier:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'admin' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'# set new fee:' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_new_fee' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'MAX_FEE' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'fee' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_new_fee' Name
|
|
'\n\n ' Text.Whitespace
|
|
'# set new offpeg_fee_multiplier:' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'_new_offpeg_fee_multiplier' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'_new_fee' Name
|
|
' ' Text.Whitespace
|
|
'<=' Operator
|
|
' ' Text.Whitespace
|
|
'MAX_FEE' Name
|
|
' ' Text.Whitespace
|
|
'*' Operator
|
|
' ' Text.Whitespace
|
|
'FEE_DENOMINATOR' Name
|
|
' ' Text.Whitespace
|
|
'# dev: offpeg multiplier exceeds maximum' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'offpeg_fee_multiplier' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_new_offpeg_fee_multiplier' Name
|
|
'\n\n ' Text.Whitespace
|
|
'log' Keyword
|
|
' ' Text.Whitespace
|
|
'ApplyNewFee' Name.Class
|
|
'(' Punctuation
|
|
'_new_fee' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_new_offpeg_fee_multiplier' Name
|
|
')' Punctuation
|
|
'\n\n\n' Text.Whitespace
|
|
|
|
'@external' Name.Decorator
|
|
'\n' Text.Whitespace
|
|
|
|
'def' Keyword
|
|
' ' Text.Whitespace
|
|
'set_ma_exp_time' Name.Function
|
|
'(' Punctuation
|
|
'_ma_exp_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_D_ma_time:' Name.Variable
|
|
' ' Text.Whitespace
|
|
'uint256' Keyword.Type
|
|
')' Punctuation
|
|
':' Punctuation
|
|
'\n ' Text.Whitespace
|
|
'"""' Comment.Multiline
|
|
'\n @notice Set the moving average window of the price oracles.\n @param _ma_exp_time Moving average window. It is time_in_seconds / ln(2)\n ' Comment.Multiline
|
|
'"""' Comment.Multiline
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'msg.sender' Name.Builtin.Pseudo
|
|
' ' Text.Whitespace
|
|
'==' Operator
|
|
' ' Text.Whitespace
|
|
'factory' Name
|
|
'.' Punctuation
|
|
'admin' Name
|
|
'(' Punctuation
|
|
')' Punctuation
|
|
' ' Text.Whitespace
|
|
'# dev: only owner' Comment.Single
|
|
'\n ' Text.Whitespace
|
|
'assert' Keyword
|
|
' ' Text.Whitespace
|
|
'0' Literal.Number.Integer
|
|
' ' Text.Whitespace
|
|
'not' Name
|
|
' ' Text.Whitespace
|
|
'in' Keyword
|
|
' ' Text.Whitespace
|
|
'[' Punctuation
|
|
'_ma_exp_time' Name
|
|
',' Punctuation
|
|
' ' Text.Whitespace
|
|
'_D_ma_time' Name
|
|
']' Punctuation
|
|
'\n\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'ma_exp_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_ma_exp_time' Name
|
|
'\n ' Text.Whitespace
|
|
'self' Name.Attribute
|
|
'.' Punctuation
|
|
'D_ma_time' Name
|
|
' ' Text.Whitespace
|
|
'=' Operator
|
|
' ' Text.Whitespace
|
|
'_D_ma_time' Name
|
|
'\n' Text.Whitespace
|