From 44d57a3ebbf35f393495bde3bffcf57403a8e495 Mon Sep 17 00:00:00 2001 From: Dylan Paiton Date: Fri, 5 Jan 2024 13:59:07 -0800 Subject: [PATCH] [hyperdrivepy] add close long, close short, calc present value, and update hyperdrive to 0.4.0 (#49) Co-authored-by: Sheng Lundquist --- .github/workflows/build_linux_wheel.yml | 2 +- .github/workflows/build_wheels.yml | 2 +- .github/workflows/lint.yml | 9 +- .github/workflows/test.yml | 2 +- .pylintrc | 648 --- Cargo.lock | 2 +- README.md | 4 +- crates/hyperdrivepy/Cargo.toml | 2 +- crates/hyperdrivepy/pyproject.toml | 5 +- .../python/hyperdrivepy/hyperdrive_state.py | 246 +- .../IERC4626HyperdriveContract.py | 4939 +++++++++++++++++ ...iveTypes.py => IERC4626HyperdriveTypes.py} | 13 +- .../pypechain_types/IHyperdriveContract.py | 2334 -------- .../hyperdrivepy/pypechain_types/__init__.py | 7 + .../hyperdrivepy/pypechain_types/utilities.py | 109 + .../hyperdrivepy/python/hyperdrivepy/types.py | 11 +- .../hyperdrivepy/python/hyperdrivepy/utils.py | 5 +- crates/hyperdrivepy/setup.py | 2 +- .../src/hyperdrive_state_methods.rs | 109 +- crates/hyperdrivepy/src/pool_config.rs | 9 +- crates/hyperdrivepy/src/pool_info.rs | 2 + crates/hyperdrivepy/src/utils.rs | 8 +- pyproject.toml | 31 +- requirements-dev.txt | 2 +- system_tests/wrapper_tests.py | 64 +- 25 files changed, 5384 insertions(+), 3183 deletions(-) delete mode 100644 .pylintrc create mode 100644 crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py rename crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/{IHyperdriveTypes.py => IERC4626HyperdriveTypes.py} (96%) delete mode 100644 crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveContract.py create mode 100644 crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/utilities.py diff --git a/.github/workflows/build_linux_wheel.yml b/.github/workflows/build_linux_wheel.yml index d385bd2..0fe67cf 100644 --- a/.github/workflows/build_linux_wheel.yml +++ b/.github/workflows/build_linux_wheel.yml @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v0.3.0" + ref: "v0.4.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index d96ce1f..ebdad9c 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v0.3.0" + ref: "v0.4.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c65a00b..728f325 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,7 +30,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v0.3.0" + ref: "v0.4.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} @@ -66,12 +66,7 @@ jobs: - name: run pylint run: | - files="${{ steps.list_files.outputs.files }}" - if [ -n "$files" ]; then - pylint --rcfile=.pylintrc $files - else - echo "No Python files found." - fi + pylint --rcfile=pyproject.toml crates/hyperdrivepy/*.py - name: run pyright run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 67f7c58..c10efec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: uses: actions/checkout@master with: repository: delvtech/hyperdrive - ref: "v0.3.0" + ref: "v0.4.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 21951df..0000000 --- a/.pylintrc +++ /dev/null @@ -1,648 +0,0 @@ -[MAIN] - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Load and enable all available extensions. Use --list-extensions to see a list -# all available extensions. -#enable-all-extensions= - -# In error mode, messages with a category besides ERROR or FATAL are -# suppressed, and no reports are done by default. Error mode is compatible with -# disabling specific errors. -#errors-only= - -# Always return a 0 (non-error) status code, even if lint errors are found. -# This is primarily useful in continuous integration scripts. -#exit-zero= - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. -extension-pkg-allow-list= - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. (This is an alternative name to extension-pkg-allow-list -# for backward compatibility.) -extension-pkg-whitelist= - -# Return non-zero exit code if any of these messages/categories are detected, -# even if score is above --fail-under value. Syntax same as enable. Messages -# specified are enabled, while categories only check already-enabled messages. -fail-on= - -# Specify a score threshold under which the program will exit with error. -fail-under=10 - -# Interpret the stdin as a python script, whose filename needs to be passed as -# the module_or_package argument. -#from-stdin= - -# Files or directories to be skipped. They should be base names, not paths. -ignore=CVS - -# Add files or directories matching the regular expressions patterns to the -# ignore-list. The regex matches against paths and can be in Posix or Windows -# format. Because '\' represents the directory delimiter on Windows systems, it -# can't be used as an escape character. -ignore-paths=docs,.venv,hyperdrive_solidity/.venv - -# Files or directories matching the regular expression patterns are skipped. -# The regex matches against base names, not paths. The default value ignores -# Emacs file locks -ignore-patterns=^\.# - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis). It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use, and will cap the count on Windows to -# avoid hangs. -jobs=1 - -# Control the amount of potential inferred values when inferring a single -# object. This can help the performance when dealing with large functions or -# complex, nested conditions. -limit-inference-results=100 - -# List of plugins (as comma separated values of python module names) to load, -# usually to register additional checkers. -load-plugins= -# TODO: Turn this back on after trading competition -#load-plugins=pylint.extensions.docparams, pylint.extensions.docstyle - -# Pickle collected data for later comparisons. -persistent=yes - -# Minimum Python version to use for version dependent checks. Will default to -# the version used to run pylint. -py-version=3.8 - -# Discover python modules and packages in the file system subtree. -recursive=no - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - -# In verbose mode, extra non-checker-related info will be displayed. -#verbose= - - -[REPORTS] - -# Python expression which should return a score less than or equal to 10. You -# have access to the variables 'fatal', 'error', 'warning', 'refactor', -# 'convention', and 'info' which contain the number of messages in each -# category, as well as 'statement' which is the total number of statements -# analyzed. This score is used by the global evaluation report (RP0004). -evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details. -msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio). You can also give a reporter class, e.g. -# mypackage.mymodule.MyReporterClass. -#output-format= - -# Tells whether to display a full report or only the messages. -reports=no - -# Activate the evaluation score. -score=yes - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, -# UNDEFINED. -confidence=HIGH, - CONTROL_FLOW, - INFERENCE, - INFERENCE_FAILURE, - UNDEFINED - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then re-enable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use "--disable=all --enable=classes -# --disable=W". -disable=raw-checker-failed, - duplicate-code, - bad-inline-option, - locally-disabled, - file-ignored, - suppressed-message, - useless-suppression, - deprecated-pragma, - use-symbolic-message-instead, - consider-using-from-import - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=c-extension-no-member - - -[LOGGING] - -# The type of string formatting that logging methods do. `old` means using % -# formatting, `new` is for `{}` formatting. -logging-format-style=old - -# Logging modules to check that the string format arguments are in logging -# function parameter format. -logging-modules=logging - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes. -max-spelling-suggestions=4 - -# Spelling dictionary name. Available dictionaries: none. To make it work, -# install the 'python-enchant' package. -spelling-dict= - -# List of comma separated words that should be considered directives if they -# appear at the beginning of a comment and should not be checked. -spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains the private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to the private dictionary (see the -# --spelling-private-dict-file option) instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX - -# Regular expression of note tags to take in consideration. -notes-rgx= - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether to warn about missing members when the owner of the attribute -# is inferred to be None. -ignore-none=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of symbolic message names to ignore for Mixin members. -ignored-checks-for-mixins=no-member, - not-async-context-manager, - not-context-manager, - attribute-defined-outside-init - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - -# Regex pattern to define which classes are considered mixins. -mixin-class-rgx=.*[Mm]ixin - -# List of decorators that change the signature of a decorated function. -signature-mutators= - - -[CLASSES] - -# Warn about protected attribute access inside special methods -check-protected-access-in-special-methods=no - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp, - __post_init__ - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=cls - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid defining new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of names allowed to shadow builtins -allowed-redefined-builtins= - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expected to -# not be used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^.*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=120 - -# Maximum number of lines in a module. -max-module-lines=1000 - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[IMPORTS] - -# List of modules that can be imported at any level, not just the top level -# one. -allow-any-import-level= - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Deprecated modules which should not be used, separated by a comma. -deprecated-modules= - -# Output a graph (.gv or any supported image format) of external dependencies -# to the given file (report RP0402 must not be disabled). -ext-import-graph= - -# Output a graph (.gv or any supported image format) of all (i.e. internal and -# external) dependencies to the given file (report RP0402 must not be -# disabled). -import-graph= - -# Output a graph (.gv or any supported image format) of internal dependencies -# to the given file (report RP0402 must not be disabled). -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - -# Couples of modules and preferred modules, separated by a comma. -preferred-modules= - - -[METHOD_ARGS] - -# List of qualified names (i.e., library.method) which require a timeout -# parameter e.g. 'requests.api.get,requests.api.post' -timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when caught. -overgeneral-exceptions=builtins.BaseException, - builtins.Exception - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=sys.exit,argparse.parse_error - - -[SIMILARITIES] - -# Comments are removed from the similarity computation -ignore-comments=yes - -# Docstrings are removed from the similarity computation -ignore-docstrings=yes - -# Imports are removed from the similarity computation -ignore-imports=yes - -# Signatures are removed from the similarity computation -ignore-signatures=yes - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[DESIGN] - -# List of regular expressions of class ancestor names to ignore when counting -# public methods (see R0903) -exclude-too-few-public-methods= - -# List of qualified class names to ignore when counting class parents (see -# R0901) -ignored-parents= - -# Maximum number of arguments for function / method. -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in an if statement (see R0916). -max-bool-expr=5 - -# Maximum number of branch for function / method body. -max-branches=12 - -# Maximum number of locals for function / method body. -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body. -max-returns=6 - -# Maximum number of statements in function / method body. -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[STRING] - -# This flag controls whether inconsistent-quotes generates a warning when the -# character used as a quote delimiter is used inconsistently within a module. -check-quote-consistency=no - -# This flag controls whether the implicit-str-concat should generate a warning -# on implicit string concatenation in sequences defined over several lines. -check-str-concat-over-line-jumps=no - - -[BASIC] - -# Naming style matching correct argument names. -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style. If left empty, argument names will be checked with the set -# naming style. -#argument-rgx= - -# Naming style matching correct attribute names. -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style. If left empty, attribute names will be checked with the set naming -# style. -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma. -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Bad variable names regexes, separated by a comma. If names match any regex, -# they will always be refused -bad-names-rgxs= - -# Naming style matching correct class attribute names. -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style. If left empty, class attribute names will be checked -# with the set naming style. -#class-attribute-rgx= - -# Naming style matching correct class constant names. -class-const-naming-style=UPPER_CASE - -# Regular expression matching correct class constant names. Overrides class- -# const-naming-style. If left empty, class constant names will be checked with -# the set naming style. -#class-const-rgx= - -# Naming style matching correct class names. -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming- -# style. If left empty, class names will be checked with the set naming style. -#class-rgx= - -# Naming style matching correct constant names. -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style. If left empty, constant names will be checked with the set naming -# style. -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming style matching correct function names. -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style. If left empty, function names will be checked with the set -# naming style. -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma. -good-names=i, - j, - k, - ex, - Run, - _ - -# Good variable names regexes, separated by a comma. If names match any regex, -# they will always be accepted -good-names-rgxs= - -# Include a hint for the correct naming format with invalid-name. -include-naming-hint=no - -# Naming style matching correct inline iteration names. -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style. If left empty, inline iteration names will be checked -# with the set naming style. -#inlinevar-rgx= - -# Naming style matching correct method names. -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style. If left empty, method names will be checked with the set naming style. -#method-rgx= - -# Naming style matching correct module names. -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style. If left empty, module names will be checked with the set naming style. -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -# These decorators are taken in consideration only for invalid-name. -property-classes=abc.abstractproperty - -# Regular expression matching correct type variable names. If left empty, type -# variable names will be checked with the set naming style. -#typevar-rgx= - -# Naming style matching correct variable names. -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style. If left empty, variable names will be checked with the set -# naming style. -#variable-rgx= - -# TODO: Turn these back on after trading competition -# [tool.pylint.parameter_documentation] -# Whether to accept totally missing parameter documentation -# in the docstring of a function that has parameters. -# accept-no-param-doc = false - -# Whether to accept totally missing raises documentation -# in the docstring of a function that raises an exception. -# accept-no-raise-doc = true - -# Whether to accept totally missing return documentation in -# the docstring of a function that returns a statement. -# accept-no-return-doc = false - -# Whether to accept totally missing yields documentation -# in the docstring of a generator. -# accept-no-yields-doc = false - -# If the docstring type cannot be guessed the -# specified docstring type will be used. -# default-docstring-type = numpy - -# TODO: Turn these back on after trading competition -[pylint.'test_*.py'] -#disable = missing-param-doc, missing-return-doc, missing-return-type-doc, too-few-public-methods, missing-type-doc -disable = too-few-public-methods \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 488aa88..6f6598c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1579,7 +1579,7 @@ dependencies = [ [[package]] name = "hyperdrivepy" -version = "0.2.0" +version = "0.4.0" dependencies = [ "ethers", "eyre", diff --git a/README.md b/README.md index 9199fcf..f59eab1 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,10 @@ To install the Python package `hyperdrivepy`, which wraps `hyperdrive-rs`, you n ## Build Types PoolInfo and PoolConfig are passed into many of the functions. -These are built from the hyperdrive abi json with pypechain. +These are built from the Hyperdrive abi json with pypechain. From the hyperdrive-sdk project root, run: ```shell pip install --upgrade -r requirements-dev.txt -pypechain hyperdrive/out/IHyperdrive.sol/IHyperdrive.json --output_dir crates/hyperdrive-sdk/python/hyperdrivepy/pypechain_types +pypechain --line_length 120 --output_dir crates/hyperdrivepy/python/hyperdrivepy/pypechain_types hyperdrive/out/IERC4626Hyperdrive.sol/ ``` diff --git a/crates/hyperdrivepy/Cargo.toml b/crates/hyperdrivepy/Cargo.toml index 885b176..d269f67 100644 --- a/crates/hyperdrivepy/Cargo.toml +++ b/crates/hyperdrivepy/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "hyperdrivepy" edition = "2021" -version = "0.2.0" +version = "0.4.0" authors = [ "Dylan Paiton", "Matt Brown", diff --git a/crates/hyperdrivepy/pyproject.toml b/crates/hyperdrivepy/pyproject.toml index 2c0b0f6..94efd52 100644 --- a/crates/hyperdrivepy/pyproject.toml +++ b/crates/hyperdrivepy/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperdrivepy" -version = "0.3.0" +version = "0.4.0" requires-python = ">=3.7" classifiers = [ "Programming Language :: Rust", @@ -12,8 +12,5 @@ classifiers = [ requires = ["setuptools", "wheel", "setuptools-rust"] build-backend = "setuptools.build_meta" -[tool.pylint] -extension-pkg-allow-list="hyperdrivepy" - [tool.setuptools.packages.find] where = ["python", "src"] diff --git a/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py b/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py index ab88c57..8263156 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/hyperdrive_state.py @@ -16,12 +16,12 @@ def get_max_spot_price( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. + Includes attributes like reserve levels and share prices. Returns ------- @@ -41,13 +41,13 @@ def get_spot_price_after_long( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - long_amount : str (FixedPoint) + Includes attributes like reserve levels and share prices. + long_amount: str (FixedPoint) The long amount. Returns @@ -66,12 +66,12 @@ def get_solvency( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. + Includes attributes like reserve levels and share prices. Returns ------- @@ -89,12 +89,12 @@ def get_spot_rate( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. + Includes attributes like reserve levels and share prices. Returns ------- @@ -112,12 +112,12 @@ def get_spot_price( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. + Includes attributes like reserve levels and share prices. Returns ------- @@ -127,7 +127,7 @@ def get_spot_price( return _get_interface(pool_config, pool_info).get_spot_price() -def get_long_amount( +def calculate_open_long( pool_config: types.PoolConfigType, pool_info: types.PoolInfoType, base_amount: str, @@ -136,24 +136,53 @@ def get_long_amount( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - base_amount : str (FixedPoint) + Includes attributes like reserve levels and share prices. + base_amount: str (FixedPoint) The amount to spend, in base. Returns ------- - long_amount : str (FixedPoint) + str (FixedPoint) The amount of bonds purchased. """ - return _get_interface(pool_config, pool_info).get_long_amount(base_amount) + return _get_interface(pool_config, pool_info).calculate_open_long(base_amount) -def get_short_deposit( +def calculate_close_long( + pool_config: types.PoolConfigType, + pool_info: types.PoolInfoType, + bond_amount: str, + normalized_time_remaining: str, +) -> str: + """Calculates the amount of shares that will be returned after fees for closing a long. + + Arguments + --------- + pool_config: PoolConfig + Static configuration for the hyperdrive contract. + Set at deploy time. + pool_info: PoolInfo + Current state information of the hyperdrive contract. + Includes attributes like reserve levels and share prices. + bond_amount: str (FixedPoint) + The amount of bonds to sell. + normalized_time_remaining: str (FixedPoint) + The time remaining before the long reaches maturity, normalized such that 0 is at opening and 1 is at maturity. + + Returns + ------- + str (FixedPoint) + The amount of shares returned. + """ + return _get_interface(pool_config, pool_info).calculate_close_long(bond_amount, normalized_time_remaining) + + +def calculate_open_short( pool_config: types.PoolConfigType, pool_info: types.PoolInfoType, short_amount: str, @@ -164,30 +193,67 @@ def get_short_deposit( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - short_amount : str (FixedPoint) + Includes attributes like reserve levels and share prices. + short_amount: str (FixedPoint) The amount to of bonds to short. - spot_price : str (FixedPoint) + spot_price: str (FixedPoint) The pool's current price for bonds. - open_share_price : str (FixedPoint), optional + open_share_price: str (FixedPoint) | None, optional Optionally provide the open share price for the short. If this is not provided or is None, then we will use the pool's current share price. Returns ------- - short_amount : str (FixedPoint) + str (FixedPoint) The amount of base required to short the bonds (aka the "max loss"). """ if open_share_price is None: # the underlying rust code uses current market share price if this is 0 # zero value is used because the smart contract will return 0 if the checkpoint hasn't been minted open_share_price = "0" - return _get_interface(pool_config, pool_info).get_short_deposit(short_amount, spot_price, open_share_price) + return _get_interface(pool_config, pool_info).calculate_open_short(short_amount, spot_price, open_share_price) + + +def calculate_close_short( + pool_config: types.PoolConfigType, + pool_info: types.PoolInfoType, + bond_amount: str, + open_share_price: str, + close_share_price: str, + normalized_time_remaining: str, +) -> str: + """Gets the amount of shares the trader will receive from closing a short. + + Arguments + --------- + pool_config: PoolConfig + Static configuration for the hyperdrive contract. + Set at deploy time. + pool_info: PoolInfo + Current state information of the hyperdrive contract. + Includes attributes like reserve levels and share prices. + bond_amount: str (FixedPoint) + The amount to of bonds provided. + open_share_price: str (FixedPoint) + The share price when the short was opened. + close_share_price: str (FixedPoint) + The share price when the short was closed. + normalized_time_remaining: str (FixedPoint) + The time remaining before the short reaches maturity, normalized such that 0 is at opening and 1 is at maturity. + + Returns + ------- + str (FixedPoint) + The amount of shares the trader will receive for closing the short. + """ + return _get_interface(pool_config, pool_info).calculate_close_short( + bond_amount, open_share_price, close_share_price, normalized_time_remaining + ) def to_checkpoint( @@ -199,13 +265,13 @@ def to_checkpoint( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - time : str (U256) + Includes attributes like reserve levels and share prices. + time: str (U256) A string representation of any timestamp (in seconds) before or at the present. Returns @@ -227,17 +293,17 @@ def get_max_long( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - budget : str (FixedPont) + Includes attributes like reserve levels and share prices. + budget: str (FixedPont) The account budget in base for making a long. - checkpoint_exposure : str (I256) + checkpoint_exposure: str (I256) The net exposure for the given checkpoint. - maybe_max_iterations : int, optional + maybe_max_iterations: int, optional The number of iterations to use for the Newtonian method. Returns @@ -261,21 +327,21 @@ def get_max_short( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - budget : str (FixedPoint) + Includes attributes like reserve levels and share prices. + budget: str (FixedPoint) The account budget in base for making a short. - open_share_price : str (FixedPoint) + open_share_price: str (FixedPoint) The share price of underlying vault. - checkpoint_exposure : str (FixedPoint) + checkpoint_exposure: str (FixedPoint) The net exposure for the given checkpoint. - maybe_conservative_price : str (FixedPoint), optional + maybe_conservative_price: str (FixedPoint), optional A lower bound on the realized price that the short will pay. - maybe_max_iterations : int, optional + maybe_max_iterations: int, optional The number of iterations to use for the Newtonian method. Returns @@ -303,13 +369,13 @@ def calculate_bonds_out_given_shares_in_down( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - amount_in : str (FixedPoint) + Includes attributes like reserve levels and share prices. + amount_in: str (FixedPoint) The amount of shares going into the pool. Returns @@ -331,13 +397,13 @@ def calculate_shares_in_given_bonds_out_up( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - amount_in : str (FixedPoint) + Includes attributes like reserve levels and share prices. + amount_in: str (FixedPoint) The amount of bonds to target. Returns @@ -359,13 +425,13 @@ def calculate_shares_in_given_bonds_out_down( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - amount_in : str (FixedPoint) + Includes attributes like reserve levels and share prices. + amount_in: str (FixedPoint) The amount of bonds to target. Returns @@ -387,13 +453,13 @@ def calculate_shares_out_given_bonds_in_down( Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - amount_in : str (FixedPoint) + Includes attributes like reserve levels and share prices. + amount_in: str (FixedPoint) The amount of bonds in. Returns @@ -404,55 +470,27 @@ def calculate_shares_out_given_bonds_in_down( return _get_interface(pool_config, pool_info).calculate_shares_out_given_bonds_in_down(amount_in) -def calculate_max_buy( - pool_config: types.PoolConfigType, - pool_info: types.PoolInfoType, -) -> str: - """ - Calculates the maximum amount of bonds that can be purchased with the - specified reserves. We round so that the max buy amount is - underestimated. - - Arguments - --------- - pool_config : PoolConfig - Static configuration for the hyperdrive contract. - Set at deploy time. - pool_info : PoolInfo - Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - - Returns - ------- - str (FixedPoint) - The maximum buy amount. - """ - return _get_interface(pool_config, pool_info).calculate_max_buy() - - -def calculate_max_sell( +def calculate_present_value( pool_config: types.PoolConfigType, pool_info: types.PoolInfoType, - minimum_share_reserves: str, + current_block_timestamp: str, ) -> str: - """Calculates the maximum amount of bonds that can be sold with the - specified reserves. We round so that the max sell amount is - underestimated. + """Calculates the present value of LPs capital in the pool. Arguments --------- - pool_config : PoolConfig + pool_config: PoolConfig Static configuration for the hyperdrive contract. Set at deploy time. - pool_info : PoolInfo + pool_info: PoolInfo Current state information of the hyperdrive contract. - Includes things like reserve levels and share prices. - minimum_share_reserves: str (FixedPoint) - The minimum share reserves to target + Includes attributes like reserve levels and share prices. + current_block_timestamp: str (U256) + The current block timestamp, as an epoch time integer. Returns ------- str (FixedPoint) - The maximum buy amount. + The present value of all LP capital in the pool. """ - return _get_interface(pool_config, pool_info).calculate_max_sell(minimum_share_reserves) + return _get_interface(pool_config, pool_info).calculate_present_value(current_block_timestamp) diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py new file mode 100644 index 0000000..45a2056 --- /dev/null +++ b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py @@ -0,0 +1,4939 @@ +"""A web3.py Contract class for the IERC4626Hyperdrive contract. + +DO NOT EDIT. This file was generated by pypechain. See documentation at +https://github.com/delvtech/pypechain""" + +# contracts have PascalCase names +# pylint: disable=invalid-name + +# contracts control how many attributes and arguments we have in generated code +# pylint: disable=too-many-instance-attributes +# pylint: disable=too-many-arguments + +# we don't need else statement if the other conditionals all have return, +# but it's easier to generate +# pylint: disable=no-else-return + +# This file is bound to get very long depending on contract sizes. +# pylint: disable=too-many-lines + +# methods are overriden with specific arguments instead of generic *args, **kwargs +# pylint: disable=arguments-differ + +from __future__ import annotations + +from typing import Any, Iterable, NamedTuple, Sequence, Type, cast + +from eth_account.signers.local import LocalAccount +from eth_typing import ChecksumAddress, HexStr +from hexbytes import HexBytes +from typing_extensions import Self +from web3 import Web3 +from web3._utils.filters import LogFilter +from web3.contract.contract import ( + Contract, + ContractConstructor, + ContractEvent, + ContractEvents, + ContractFunction, + ContractFunctions, +) +from web3.exceptions import FallbackNotFound +from web3.types import ABI, BlockIdentifier, CallOverride, EventData, TxParams + +from .IERC4626HyperdriveTypes import Checkpoint, Fees, MarketState, Options, PoolConfig, PoolInfo, WithdrawPool +from .utilities import dataclass_to_tuple, rename_returned_types + +structs = { + "Options": Options, + "Checkpoint": Checkpoint, + "MarketState": MarketState, + "Fees": Fees, + "PoolConfig": PoolConfig, + "PoolInfo": PoolInfo, + "WithdrawPool": WithdrawPool, +} + + +class IERC4626HyperdriveDOMAIN_SEPARATORContractFunction(ContractFunction): + """ContractFunction for the DOMAIN_SEPARATOR method.""" + + def __call__(self) -> IERC4626HyperdriveDOMAIN_SEPARATORContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> bytes: + """returns bytes.""" + # Define the expected return types from the smart contract call + + return_types = bytes + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(bytes, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdrivePERMIT_TYPEHASHContractFunction(ContractFunction): + """ContractFunction for the PERMIT_TYPEHASH method.""" + + def __call__(self) -> IERC4626HyperdrivePERMIT_TYPEHASHContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> bytes: + """returns bytes.""" + # Define the expected return types from the smart contract call + + return_types = bytes + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(bytes, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveAddLiquidityContractFunction(ContractFunction): + """ContractFunction for the addLiquidity method.""" + + def __call__( + self, + contribution: int, + minApr: int, + maxApr: int, + options: Options, + ) -> IERC4626HyperdriveAddLiquidityContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(contribution), + dataclass_to_tuple(minApr), + dataclass_to_tuple(maxApr), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveBalanceOfContractFunction(ContractFunction): + """ContractFunction for the balanceOf method.""" + + def __call__(self, tokenId: int, owner: str) -> IERC4626HyperdriveBalanceOfContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(tokenId), dataclass_to_tuple(owner)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveBaseTokenContractFunction(ContractFunction): + """ContractFunction for the baseToken method.""" + + def __call__(self) -> IERC4626HyperdriveBaseTokenContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> str: + """returns str.""" + # Define the expected return types from the smart contract call + + return_types = str + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(str, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveBatchTransferFromContractFunction(ContractFunction): + """ContractFunction for the batchTransferFrom method.""" + + def __call__( + self, + _from: str, + to: str, + ids: list[int], + values: list[int], + ) -> IERC4626HyperdriveBatchTransferFromContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(_from), + dataclass_to_tuple(to), + dataclass_to_tuple(ids), + dataclass_to_tuple(values), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveCheckpointContractFunction(ContractFunction): + """ContractFunction for the checkpoint method.""" + + def __call__(self, checkpointTime: int) -> IERC4626HyperdriveCheckpointContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(checkpointTime)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveCloseLongContractFunction(ContractFunction): + """ContractFunction for the closeLong method.""" + + def __call__( + self, + maturityTime: int, + bondAmount: int, + minOutput: int, + options: Options, + ) -> IERC4626HyperdriveCloseLongContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(maturityTime), + dataclass_to_tuple(bondAmount), + dataclass_to_tuple(minOutput), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveCloseShortContractFunction(ContractFunction): + """ContractFunction for the closeShort method.""" + + def __call__( + self, + maturityTime: int, + bondAmount: int, + minOutput: int, + options: Options, + ) -> IERC4626HyperdriveCloseShortContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(maturityTime), + dataclass_to_tuple(bondAmount), + dataclass_to_tuple(minOutput), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveCollectGovernanceFeeContractFunction(ContractFunction): + """ContractFunction for the collectGovernanceFee method.""" + + def __call__(self, options: Options) -> IERC4626HyperdriveCollectGovernanceFeeContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(options)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveGetCheckpointContractFunction(ContractFunction): + """ContractFunction for the getCheckpoint method.""" + + def __call__(self, checkpointId: int) -> IERC4626HyperdriveGetCheckpointContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(checkpointId)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> Checkpoint: + """returns Checkpoint.""" + # Define the expected return types from the smart contract call + + return_types = Checkpoint + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(Checkpoint, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveGetCheckpointExposureContractFunction(ContractFunction): + """ContractFunction for the getCheckpointExposure method.""" + + def __call__(self, checkpointTime: int) -> IERC4626HyperdriveGetCheckpointExposureContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(checkpointTime)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveGetMarketStateContractFunction(ContractFunction): + """ContractFunction for the getMarketState method.""" + + def __call__(self) -> IERC4626HyperdriveGetMarketStateContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> MarketState: + """returns MarketState.""" + # Define the expected return types from the smart contract call + + return_types = MarketState + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast( + MarketState, + rename_returned_types(structs, return_types, raw_values), + ) + + +class IERC4626HyperdriveGetPoolConfigContractFunction(ContractFunction): + """ContractFunction for the getPoolConfig method.""" + + def __call__(self) -> IERC4626HyperdriveGetPoolConfigContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> PoolConfig: + """returns PoolConfig.""" + # Define the expected return types from the smart contract call + + return_types = PoolConfig + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(PoolConfig, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveGetPoolInfoContractFunction(ContractFunction): + """ContractFunction for the getPoolInfo method.""" + + def __call__(self) -> IERC4626HyperdriveGetPoolInfoContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> PoolInfo: + """returns PoolInfo.""" + # Define the expected return types from the smart contract call + + return_types = PoolInfo + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(PoolInfo, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveGetUncollectedGovernanceFeesContractFunction(ContractFunction): + """ContractFunction for the getUncollectedGovernanceFees method.""" + + def __call__(self) -> IERC4626HyperdriveGetUncollectedGovernanceFeesContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveGetWithdrawPoolContractFunction(ContractFunction): + """ContractFunction for the getWithdrawPool method.""" + + def __call__(self) -> IERC4626HyperdriveGetWithdrawPoolContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> WithdrawPool: + """returns WithdrawPool.""" + # Define the expected return types from the smart contract call + + return_types = WithdrawPool + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast( + WithdrawPool, + rename_returned_types(structs, return_types, raw_values), + ) + + +class IERC4626HyperdriveInitializeContractFunction(ContractFunction): + """ContractFunction for the initialize method.""" + + def __call__( + self, + contribution: int, + apr: int, + options: Options, + ) -> IERC4626HyperdriveInitializeContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(contribution), + dataclass_to_tuple(apr), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveIsApprovedForAllContractFunction(ContractFunction): + """ContractFunction for the isApprovedForAll method.""" + + def __call__(self, owner: str, spender: str) -> IERC4626HyperdriveIsApprovedForAllContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(owner), dataclass_to_tuple(spender)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> bool: + """returns bool.""" + # Define the expected return types from the smart contract call + + return_types = bool + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(bool, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveIsSweepableContractFunction(ContractFunction): + """ContractFunction for the isSweepable method.""" + + def __call__(self, target: str) -> IERC4626HyperdriveIsSweepableContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(target)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> bool: + """returns bool.""" + # Define the expected return types from the smart contract call + + return_types = bool + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(bool, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveLoadContractFunction(ContractFunction): + """ContractFunction for the load method.""" + + def __call__(self, slots: list[int]) -> IERC4626HyperdriveLoadContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(slots)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> list[bytes]: + """returns list[bytes].""" + # Define the expected return types from the smart contract call + + return_types = list[bytes] + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast( + list[bytes], + rename_returned_types(structs, return_types, raw_values), + ) + + +class IERC4626HyperdriveNameContractFunction(ContractFunction): + """ContractFunction for the name method.""" + + def __call__(self, _id: int) -> IERC4626HyperdriveNameContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(_id)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> str: + """returns str.""" + # Define the expected return types from the smart contract call + + return_types = str + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(str, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveNoncesContractFunction(ContractFunction): + """ContractFunction for the nonces method.""" + + def __call__(self, owner: str) -> IERC4626HyperdriveNoncesContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(owner)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveOpenLongContractFunction(ContractFunction): + """ContractFunction for the openLong method.""" + + class ReturnValues(NamedTuple): + """The return named tuple for OpenLong.""" + + maturityTime: int + bondProceeds: int + + def __call__( + self, + baseAmount: int, + minOutput: int, + minSharePrice: int, + options: Options, + ) -> IERC4626HyperdriveOpenLongContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(baseAmount), + dataclass_to_tuple(minOutput), + dataclass_to_tuple(minSharePrice), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> ReturnValues: + """returns ReturnValues.""" + # Define the expected return types from the smart contract call + + return_types = [int, int] + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return self.ReturnValues(*rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveOpenShortContractFunction(ContractFunction): + """ContractFunction for the openShort method.""" + + class ReturnValues(NamedTuple): + """The return named tuple for OpenShort.""" + + maturityTime: int + traderDeposit: int + + def __call__( + self, + bondAmount: int, + maxDeposit: int, + minSharePrice: int, + options: Options, + ) -> IERC4626HyperdriveOpenShortContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(bondAmount), + dataclass_to_tuple(maxDeposit), + dataclass_to_tuple(minSharePrice), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> ReturnValues: + """returns ReturnValues.""" + # Define the expected return types from the smart contract call + + return_types = [int, int] + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return self.ReturnValues(*rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdrivePauseContractFunction(ContractFunction): + """ContractFunction for the pause method.""" + + def __call__(self, status: bool) -> IERC4626HyperdrivePauseContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(status)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdrivePerTokenApprovalsContractFunction(ContractFunction): + """ContractFunction for the perTokenApprovals method.""" + + def __call__( + self, + tokenId: int, + owner: str, + spender: str, + ) -> IERC4626HyperdrivePerTokenApprovalsContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(tokenId), + dataclass_to_tuple(owner), + dataclass_to_tuple(spender), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdrivePermitForAllContractFunction(ContractFunction): + """ContractFunction for the permitForAll method.""" + + def __call__( + self, + owner: str, + spender: str, + approved: bool, + deadline: int, + v: int, + r: bytes, + s: bytes, + ) -> IERC4626HyperdrivePermitForAllContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(owner), + dataclass_to_tuple(spender), + dataclass_to_tuple(approved), + dataclass_to_tuple(deadline), + dataclass_to_tuple(v), + dataclass_to_tuple(r), + dataclass_to_tuple(s), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdrivePoolContractFunction(ContractFunction): + """ContractFunction for the pool method.""" + + def __call__(self) -> IERC4626HyperdrivePoolContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> str: + """returns str.""" + # Define the expected return types from the smart contract call + + return_types = str + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(str, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveRedeemWithdrawalSharesContractFunction(ContractFunction): + """ContractFunction for the redeemWithdrawalShares method.""" + + class ReturnValues(NamedTuple): + """The return named tuple for RedeemWithdrawalShares.""" + + proceeds: int + sharesRedeemed: int + + def __call__( + self, + shares: int, + minOutput: int, + options: Options, + ) -> IERC4626HyperdriveRedeemWithdrawalSharesContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(shares), + dataclass_to_tuple(minOutput), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> ReturnValues: + """returns ReturnValues.""" + # Define the expected return types from the smart contract call + + return_types = [int, int] + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return self.ReturnValues(*rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveRemoveLiquidityContractFunction(ContractFunction): + """ContractFunction for the removeLiquidity method.""" + + class ReturnValues(NamedTuple): + """The return named tuple for RemoveLiquidity.""" + + baseProceeds: int + withdrawalShares: int + + def __call__( + self, + shares: int, + minOutput: int, + options: Options, + ) -> IERC4626HyperdriveRemoveLiquidityContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(shares), + dataclass_to_tuple(minOutput), + dataclass_to_tuple(options), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> ReturnValues: + """returns ReturnValues.""" + # Define the expected return types from the smart contract call + + return_types = [int, int] + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return self.ReturnValues(*rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveSetApprovalContractFunction(ContractFunction): + """ContractFunction for the setApproval method.""" + + def __call__( + self, + tokenID: int, + operator: str, + amount: int, + ) -> IERC4626HyperdriveSetApprovalContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(tokenID), + dataclass_to_tuple(operator), + dataclass_to_tuple(amount), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveSetApprovalBridgeContractFunction(ContractFunction): + """ContractFunction for the setApprovalBridge method.""" + + def __call__( + self, + tokenID: int, + operator: str, + amount: int, + caller: str, + ) -> IERC4626HyperdriveSetApprovalBridgeContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(tokenID), + dataclass_to_tuple(operator), + dataclass_to_tuple(amount), + dataclass_to_tuple(caller), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveSetApprovalForAllContractFunction(ContractFunction): + """ContractFunction for the setApprovalForAll method.""" + + def __call__( + self, + operator: str, + approved: bool, + ) -> IERC4626HyperdriveSetApprovalForAllContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(operator), dataclass_to_tuple(approved)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveSetGovernanceContractFunction(ContractFunction): + """ContractFunction for the setGovernance method.""" + + def __call__(self, who: str) -> IERC4626HyperdriveSetGovernanceContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(who)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveSetPauserContractFunction(ContractFunction): + """ContractFunction for the setPauser method.""" + + def __call__(self, who: str, status: bool) -> IERC4626HyperdriveSetPauserContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(who), dataclass_to_tuple(status)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveSweepContractFunction(ContractFunction): + """ContractFunction for the sweep method.""" + + def __call__(self, target: str) -> IERC4626HyperdriveSweepContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(target)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveSymbolContractFunction(ContractFunction): + """ContractFunction for the symbol method.""" + + def __call__(self, _id: int) -> IERC4626HyperdriveSymbolContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(_id)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> str: + """returns str.""" + # Define the expected return types from the smart contract call + + return_types = str + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(str, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveTarget0ContractFunction(ContractFunction): + """ContractFunction for the target0 method.""" + + def __call__(self) -> IERC4626HyperdriveTarget0ContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> str: + """returns str.""" + # Define the expected return types from the smart contract call + + return_types = str + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(str, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveTarget1ContractFunction(ContractFunction): + """ContractFunction for the target1 method.""" + + def __call__(self) -> IERC4626HyperdriveTarget1ContractFunction: # type: ignore + clone = super().__call__() + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> str: + """returns str.""" + # Define the expected return types from the smart contract call + + return_types = str + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(str, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveTotalSupplyContractFunction(ContractFunction): + """ContractFunction for the totalSupply method.""" + + def __call__(self, _id: int) -> IERC4626HyperdriveTotalSupplyContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(_id)) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> int: + """returns int.""" + # Define the expected return types from the smart contract call + + return_types = int + + # Call the function + + raw_values = super().call(transaction, block_identifier, state_override, ccip_read_enabled) + return cast(int, rename_returned_types(structs, return_types, raw_values)) + + +class IERC4626HyperdriveTransferFromContractFunction(ContractFunction): + """ContractFunction for the transferFrom method.""" + + def __call__( + self, + tokenID: int, + _from: str, + to: str, + amount: int, + ) -> IERC4626HyperdriveTransferFromContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(tokenID), + dataclass_to_tuple(_from), + dataclass_to_tuple(to), + dataclass_to_tuple(amount), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveTransferFromBridgeContractFunction(ContractFunction): + """ContractFunction for the transferFromBridge method.""" + + def __call__( + self, + tokenID: int, + _from: str, + to: str, + amount: int, + caller: str, + ) -> IERC4626HyperdriveTransferFromBridgeContractFunction: # type: ignore + clone = super().__call__( + dataclass_to_tuple(tokenID), + dataclass_to_tuple(_from), + dataclass_to_tuple(to), + dataclass_to_tuple(amount), + dataclass_to_tuple(caller), + ) + self.kwargs = clone.kwargs + self.args = clone.args + return self + + def call( + self, + transaction: TxParams | None = None, + block_identifier: BlockIdentifier = "latest", + state_override: CallOverride | None = None, + ccip_read_enabled: bool | None = None, + ) -> None: + """returns None.""" + # Define the expected return types from the smart contract call + + # Call the function + + +class IERC4626HyperdriveContractFunctions(ContractFunctions): + """ContractFunctions for the IERC4626Hyperdrive contract.""" + + DOMAIN_SEPARATOR: IERC4626HyperdriveDOMAIN_SEPARATORContractFunction + + PERMIT_TYPEHASH: IERC4626HyperdrivePERMIT_TYPEHASHContractFunction + + addLiquidity: IERC4626HyperdriveAddLiquidityContractFunction + + balanceOf: IERC4626HyperdriveBalanceOfContractFunction + + baseToken: IERC4626HyperdriveBaseTokenContractFunction + + batchTransferFrom: IERC4626HyperdriveBatchTransferFromContractFunction + + checkpoint: IERC4626HyperdriveCheckpointContractFunction + + closeLong: IERC4626HyperdriveCloseLongContractFunction + + closeShort: IERC4626HyperdriveCloseShortContractFunction + + collectGovernanceFee: IERC4626HyperdriveCollectGovernanceFeeContractFunction + + getCheckpoint: IERC4626HyperdriveGetCheckpointContractFunction + + getCheckpointExposure: IERC4626HyperdriveGetCheckpointExposureContractFunction + + getMarketState: IERC4626HyperdriveGetMarketStateContractFunction + + getPoolConfig: IERC4626HyperdriveGetPoolConfigContractFunction + + getPoolInfo: IERC4626HyperdriveGetPoolInfoContractFunction + + getUncollectedGovernanceFees: IERC4626HyperdriveGetUncollectedGovernanceFeesContractFunction + + getWithdrawPool: IERC4626HyperdriveGetWithdrawPoolContractFunction + + initialize: IERC4626HyperdriveInitializeContractFunction + + isApprovedForAll: IERC4626HyperdriveIsApprovedForAllContractFunction + + isSweepable: IERC4626HyperdriveIsSweepableContractFunction + + load: IERC4626HyperdriveLoadContractFunction + + name: IERC4626HyperdriveNameContractFunction + + nonces: IERC4626HyperdriveNoncesContractFunction + + openLong: IERC4626HyperdriveOpenLongContractFunction + + openShort: IERC4626HyperdriveOpenShortContractFunction + + pause: IERC4626HyperdrivePauseContractFunction + + perTokenApprovals: IERC4626HyperdrivePerTokenApprovalsContractFunction + + permitForAll: IERC4626HyperdrivePermitForAllContractFunction + + pool: IERC4626HyperdrivePoolContractFunction + + redeemWithdrawalShares: IERC4626HyperdriveRedeemWithdrawalSharesContractFunction + + removeLiquidity: IERC4626HyperdriveRemoveLiquidityContractFunction + + setApproval: IERC4626HyperdriveSetApprovalContractFunction + + setApprovalBridge: IERC4626HyperdriveSetApprovalBridgeContractFunction + + setApprovalForAll: IERC4626HyperdriveSetApprovalForAllContractFunction + + setGovernance: IERC4626HyperdriveSetGovernanceContractFunction + + setPauser: IERC4626HyperdriveSetPauserContractFunction + + sweep: IERC4626HyperdriveSweepContractFunction + + symbol: IERC4626HyperdriveSymbolContractFunction + + target0: IERC4626HyperdriveTarget0ContractFunction + + target1: IERC4626HyperdriveTarget1ContractFunction + + totalSupply: IERC4626HyperdriveTotalSupplyContractFunction + + transferFrom: IERC4626HyperdriveTransferFromContractFunction + + transferFromBridge: IERC4626HyperdriveTransferFromBridgeContractFunction + + def __init__( + self, + abi: ABI, + w3: "Web3", + address: ChecksumAddress | None = None, + decode_tuples: bool | None = False, + ) -> None: + super().__init__(abi, w3, address, decode_tuples) + self.DOMAIN_SEPARATOR = IERC4626HyperdriveDOMAIN_SEPARATORContractFunction.factory( + "DOMAIN_SEPARATOR", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="DOMAIN_SEPARATOR", + ) + self.PERMIT_TYPEHASH = IERC4626HyperdrivePERMIT_TYPEHASHContractFunction.factory( + "PERMIT_TYPEHASH", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="PERMIT_TYPEHASH", + ) + self.addLiquidity = IERC4626HyperdriveAddLiquidityContractFunction.factory( + "addLiquidity", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="addLiquidity", + ) + self.balanceOf = IERC4626HyperdriveBalanceOfContractFunction.factory( + "balanceOf", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="balanceOf", + ) + self.baseToken = IERC4626HyperdriveBaseTokenContractFunction.factory( + "baseToken", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="baseToken", + ) + self.batchTransferFrom = IERC4626HyperdriveBatchTransferFromContractFunction.factory( + "batchTransferFrom", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="batchTransferFrom", + ) + self.checkpoint = IERC4626HyperdriveCheckpointContractFunction.factory( + "checkpoint", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="checkpoint", + ) + self.closeLong = IERC4626HyperdriveCloseLongContractFunction.factory( + "closeLong", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="closeLong", + ) + self.closeShort = IERC4626HyperdriveCloseShortContractFunction.factory( + "closeShort", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="closeShort", + ) + self.collectGovernanceFee = IERC4626HyperdriveCollectGovernanceFeeContractFunction.factory( + "collectGovernanceFee", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="collectGovernanceFee", + ) + self.getCheckpoint = IERC4626HyperdriveGetCheckpointContractFunction.factory( + "getCheckpoint", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getCheckpoint", + ) + self.getCheckpointExposure = IERC4626HyperdriveGetCheckpointExposureContractFunction.factory( + "getCheckpointExposure", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getCheckpointExposure", + ) + self.getMarketState = IERC4626HyperdriveGetMarketStateContractFunction.factory( + "getMarketState", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getMarketState", + ) + self.getPoolConfig = IERC4626HyperdriveGetPoolConfigContractFunction.factory( + "getPoolConfig", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getPoolConfig", + ) + self.getPoolInfo = IERC4626HyperdriveGetPoolInfoContractFunction.factory( + "getPoolInfo", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getPoolInfo", + ) + self.getUncollectedGovernanceFees = IERC4626HyperdriveGetUncollectedGovernanceFeesContractFunction.factory( + "getUncollectedGovernanceFees", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getUncollectedGovernanceFees", + ) + self.getWithdrawPool = IERC4626HyperdriveGetWithdrawPoolContractFunction.factory( + "getWithdrawPool", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="getWithdrawPool", + ) + self.initialize = IERC4626HyperdriveInitializeContractFunction.factory( + "initialize", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="initialize", + ) + self.isApprovedForAll = IERC4626HyperdriveIsApprovedForAllContractFunction.factory( + "isApprovedForAll", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="isApprovedForAll", + ) + self.isSweepable = IERC4626HyperdriveIsSweepableContractFunction.factory( + "isSweepable", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="isSweepable", + ) + self.load = IERC4626HyperdriveLoadContractFunction.factory( + "load", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="load", + ) + self.name = IERC4626HyperdriveNameContractFunction.factory( + "name", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="name", + ) + self.nonces = IERC4626HyperdriveNoncesContractFunction.factory( + "nonces", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="nonces", + ) + self.openLong = IERC4626HyperdriveOpenLongContractFunction.factory( + "openLong", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="openLong", + ) + self.openShort = IERC4626HyperdriveOpenShortContractFunction.factory( + "openShort", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="openShort", + ) + self.pause = IERC4626HyperdrivePauseContractFunction.factory( + "pause", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="pause", + ) + self.perTokenApprovals = IERC4626HyperdrivePerTokenApprovalsContractFunction.factory( + "perTokenApprovals", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="perTokenApprovals", + ) + self.permitForAll = IERC4626HyperdrivePermitForAllContractFunction.factory( + "permitForAll", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="permitForAll", + ) + self.pool = IERC4626HyperdrivePoolContractFunction.factory( + "pool", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="pool", + ) + self.redeemWithdrawalShares = IERC4626HyperdriveRedeemWithdrawalSharesContractFunction.factory( + "redeemWithdrawalShares", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="redeemWithdrawalShares", + ) + self.removeLiquidity = IERC4626HyperdriveRemoveLiquidityContractFunction.factory( + "removeLiquidity", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="removeLiquidity", + ) + self.setApproval = IERC4626HyperdriveSetApprovalContractFunction.factory( + "setApproval", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="setApproval", + ) + self.setApprovalBridge = IERC4626HyperdriveSetApprovalBridgeContractFunction.factory( + "setApprovalBridge", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="setApprovalBridge", + ) + self.setApprovalForAll = IERC4626HyperdriveSetApprovalForAllContractFunction.factory( + "setApprovalForAll", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="setApprovalForAll", + ) + self.setGovernance = IERC4626HyperdriveSetGovernanceContractFunction.factory( + "setGovernance", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="setGovernance", + ) + self.setPauser = IERC4626HyperdriveSetPauserContractFunction.factory( + "setPauser", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="setPauser", + ) + self.sweep = IERC4626HyperdriveSweepContractFunction.factory( + "sweep", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="sweep", + ) + self.symbol = IERC4626HyperdriveSymbolContractFunction.factory( + "symbol", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="symbol", + ) + self.target0 = IERC4626HyperdriveTarget0ContractFunction.factory( + "target0", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="target0", + ) + self.target1 = IERC4626HyperdriveTarget1ContractFunction.factory( + "target1", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="target1", + ) + self.totalSupply = IERC4626HyperdriveTotalSupplyContractFunction.factory( + "totalSupply", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="totalSupply", + ) + self.transferFrom = IERC4626HyperdriveTransferFromContractFunction.factory( + "transferFrom", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="transferFrom", + ) + self.transferFromBridge = IERC4626HyperdriveTransferFromBridgeContractFunction.factory( + "transferFromBridge", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="transferFromBridge", + ) + + +class IERC4626HyperdriveAddLiquidityContractEvent(ContractEvent): + """ContractEvent for AddLiquidity.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveAddLiquidityContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveAddLiquidityContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveAddLiquidityContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveAddLiquidityContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveApprovalContractEvent(ContractEvent): + """ContractEvent for Approval.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveApprovalContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveApprovalContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveApprovalContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveApprovalContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveApprovalForAllContractEvent(ContractEvent): + """ContractEvent for ApprovalForAll.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveApprovalForAllContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveApprovalForAllContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveApprovalForAllContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveApprovalForAllContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveCloseLongContractEvent(ContractEvent): + """ContractEvent for CloseLong.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveCloseLongContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveCloseLongContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveCloseLongContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveCloseLongContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveCloseShortContractEvent(ContractEvent): + """ContractEvent for CloseShort.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveCloseShortContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveCloseShortContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveCloseShortContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveCloseShortContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveCollectGovernanceFeeContractEvent(ContractEvent): + """ContractEvent for CollectGovernanceFee.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveCollectGovernanceFeeContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveCollectGovernanceFeeContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveCollectGovernanceFeeContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveCollectGovernanceFeeContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveCreateCheckpointContractEvent(ContractEvent): + """ContractEvent for CreateCheckpoint.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveCreateCheckpointContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveCreateCheckpointContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveCreateCheckpointContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveCreateCheckpointContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveInitializeContractEvent(ContractEvent): + """ContractEvent for Initialize.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveInitializeContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveInitializeContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveInitializeContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveInitializeContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveOpenLongContractEvent(ContractEvent): + """ContractEvent for OpenLong.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveOpenLongContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveOpenLongContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveOpenLongContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveOpenLongContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveOpenShortContractEvent(ContractEvent): + """ContractEvent for OpenShort.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveOpenShortContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveOpenShortContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveOpenShortContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveOpenShortContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveRedeemWithdrawalSharesContractEvent(ContractEvent): + """ContractEvent for RedeemWithdrawalShares.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveRedeemWithdrawalSharesContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveRedeemWithdrawalSharesContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveRedeemWithdrawalSharesContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveRedeemWithdrawalSharesContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveRemoveLiquidityContractEvent(ContractEvent): + """ContractEvent for RemoveLiquidity.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveRemoveLiquidityContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveRemoveLiquidityContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveRemoveLiquidityContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveRemoveLiquidityContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveTransferSingleContractEvent(ContractEvent): + """ContractEvent for TransferSingle.""" + + # super() get_logs and create_filter methods are generic, while our version adds values & types + # pylint: disable=arguments-differ + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # pylint: disable=useless-parent-delegation + def __init__(self, *argument_names: tuple[str]) -> None: + super().__init__(*argument_names) + + def get_logs( # type: ignore + self: "IERC4626HyperdriveTransferSingleContractEvent", + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + @classmethod + def get_logs( # type: ignore + cls: Type["IERC4626HyperdriveTransferSingleContractEvent"], + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier | None = None, + block_hash: HexBytes | None = None, + ) -> Iterable[EventData]: + return cast( + Iterable[EventData], + super().get_logs( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + block_hash=block_hash, + ), + ) + + def create_filter( # type: ignore + self: "IERC4626HyperdriveTransferSingleContractEvent", + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + @classmethod + def create_filter( # type: ignore + cls: Type["IERC4626HyperdriveTransferSingleContractEvent"], + *, # PEP 3102 + argument_filters: dict[str, Any] | None = None, + fromBlock: BlockIdentifier | None = None, + toBlock: BlockIdentifier = "latest", + address: ChecksumAddress | None = None, + topics: Sequence[Any] | None = None, + ) -> LogFilter: + return cast( + LogFilter, + super().create_filter( + argument_filters=argument_filters, + fromBlock=fromBlock, + toBlock=toBlock, + address=address, + topics=topics, + ), + ) + + +class IERC4626HyperdriveContractEvents(ContractEvents): + """ContractEvents for the IERC4626Hyperdrive contract.""" + + AddLiquidity: IERC4626HyperdriveAddLiquidityContractEvent + + Approval: IERC4626HyperdriveApprovalContractEvent + + ApprovalForAll: IERC4626HyperdriveApprovalForAllContractEvent + + CloseLong: IERC4626HyperdriveCloseLongContractEvent + + CloseShort: IERC4626HyperdriveCloseShortContractEvent + + CollectGovernanceFee: IERC4626HyperdriveCollectGovernanceFeeContractEvent + + CreateCheckpoint: IERC4626HyperdriveCreateCheckpointContractEvent + + Initialize: IERC4626HyperdriveInitializeContractEvent + + OpenLong: IERC4626HyperdriveOpenLongContractEvent + + OpenShort: IERC4626HyperdriveOpenShortContractEvent + + RedeemWithdrawalShares: IERC4626HyperdriveRedeemWithdrawalSharesContractEvent + + RemoveLiquidity: IERC4626HyperdriveRemoveLiquidityContractEvent + + TransferSingle: IERC4626HyperdriveTransferSingleContractEvent + + def __init__( + self, + abi: ABI, + w3: "Web3", + address: ChecksumAddress | None = None, + ) -> None: + super().__init__(abi, w3, address) + self.AddLiquidity = cast( + IERC4626HyperdriveAddLiquidityContractEvent, + IERC4626HyperdriveAddLiquidityContractEvent.factory( + "AddLiquidity", + w3=w3, + contract_abi=abi, + address=address, + event_name="AddLiquidity", + ), + ) + self.Approval = cast( + IERC4626HyperdriveApprovalContractEvent, + IERC4626HyperdriveApprovalContractEvent.factory( + "Approval", + w3=w3, + contract_abi=abi, + address=address, + event_name="Approval", + ), + ) + self.ApprovalForAll = cast( + IERC4626HyperdriveApprovalForAllContractEvent, + IERC4626HyperdriveApprovalForAllContractEvent.factory( + "ApprovalForAll", + w3=w3, + contract_abi=abi, + address=address, + event_name="ApprovalForAll", + ), + ) + self.CloseLong = cast( + IERC4626HyperdriveCloseLongContractEvent, + IERC4626HyperdriveCloseLongContractEvent.factory( + "CloseLong", + w3=w3, + contract_abi=abi, + address=address, + event_name="CloseLong", + ), + ) + self.CloseShort = cast( + IERC4626HyperdriveCloseShortContractEvent, + IERC4626HyperdriveCloseShortContractEvent.factory( + "CloseShort", + w3=w3, + contract_abi=abi, + address=address, + event_name="CloseShort", + ), + ) + self.CollectGovernanceFee = cast( + IERC4626HyperdriveCollectGovernanceFeeContractEvent, + IERC4626HyperdriveCollectGovernanceFeeContractEvent.factory( + "CollectGovernanceFee", + w3=w3, + contract_abi=abi, + address=address, + event_name="CollectGovernanceFee", + ), + ) + self.CreateCheckpoint = cast( + IERC4626HyperdriveCreateCheckpointContractEvent, + IERC4626HyperdriveCreateCheckpointContractEvent.factory( + "CreateCheckpoint", + w3=w3, + contract_abi=abi, + address=address, + event_name="CreateCheckpoint", + ), + ) + self.Initialize = cast( + IERC4626HyperdriveInitializeContractEvent, + IERC4626HyperdriveInitializeContractEvent.factory( + "Initialize", + w3=w3, + contract_abi=abi, + address=address, + event_name="Initialize", + ), + ) + self.OpenLong = cast( + IERC4626HyperdriveOpenLongContractEvent, + IERC4626HyperdriveOpenLongContractEvent.factory( + "OpenLong", + w3=w3, + contract_abi=abi, + address=address, + event_name="OpenLong", + ), + ) + self.OpenShort = cast( + IERC4626HyperdriveOpenShortContractEvent, + IERC4626HyperdriveOpenShortContractEvent.factory( + "OpenShort", + w3=w3, + contract_abi=abi, + address=address, + event_name="OpenShort", + ), + ) + self.RedeemWithdrawalShares = cast( + IERC4626HyperdriveRedeemWithdrawalSharesContractEvent, + IERC4626HyperdriveRedeemWithdrawalSharesContractEvent.factory( + "RedeemWithdrawalShares", + w3=w3, + contract_abi=abi, + address=address, + event_name="RedeemWithdrawalShares", + ), + ) + self.RemoveLiquidity = cast( + IERC4626HyperdriveRemoveLiquidityContractEvent, + IERC4626HyperdriveRemoveLiquidityContractEvent.factory( + "RemoveLiquidity", + w3=w3, + contract_abi=abi, + address=address, + event_name="RemoveLiquidity", + ), + ) + self.TransferSingle = cast( + IERC4626HyperdriveTransferSingleContractEvent, + IERC4626HyperdriveTransferSingleContractEvent.factory( + "TransferSingle", + w3=w3, + contract_abi=abi, + address=address, + event_name="TransferSingle", + ), + ) + + +ierc4626hyperdrive_abi: ABI = cast( + ABI, + [ + { + "type": "function", + "name": "DOMAIN_SEPARATOR", + "inputs": [], + "outputs": [{"name": "", "type": "bytes32", "internalType": "bytes32"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "PERMIT_TYPEHASH", + "inputs": [], + "outputs": [{"name": "", "type": "bytes32", "internalType": "bytes32"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "addLiquidity", + "inputs": [ + { + "name": "_contribution", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minApr", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_maxApr", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [ + { + "name": "lpShares", + "type": "uint256", + "internalType": "uint256", + } + ], + "stateMutability": "payable", + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256", + }, + {"name": "owner", "type": "address", "internalType": "address"}, + ], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "baseToken", + "inputs": [], + "outputs": [{"name": "", "type": "address", "internalType": "address"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "batchTransferFrom", + "inputs": [ + {"name": "from", "type": "address", "internalType": "address"}, + {"name": "to", "type": "address", "internalType": "address"}, + { + "name": "ids", + "type": "uint256[]", + "internalType": "uint256[]", + }, + { + "name": "values", + "type": "uint256[]", + "internalType": "uint256[]", + }, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "checkpoint", + "inputs": [ + { + "name": "_checkpointTime", + "type": "uint256", + "internalType": "uint256", + } + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "closeLong", + "inputs": [ + { + "name": "_maturityTime", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_bondAmount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minOutput", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "closeShort", + "inputs": [ + { + "name": "_maturityTime", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_bondAmount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minOutput", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "collectGovernanceFee", + "inputs": [ + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + } + ], + "outputs": [ + { + "name": "proceeds", + "type": "uint256", + "internalType": "uint256", + } + ], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "getCheckpoint", + "inputs": [ + { + "name": "_checkpointId", + "type": "uint256", + "internalType": "uint256", + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.Checkpoint", + "components": [ + { + "name": "sharePrice", + "type": "uint128", + "internalType": "uint128", + } + ], + } + ], + "stateMutability": "view", + }, + { + "type": "function", + "name": "getCheckpointExposure", + "inputs": [ + { + "name": "_checkpointTime", + "type": "uint256", + "internalType": "uint256", + } + ], + "outputs": [{"name": "", "type": "int256", "internalType": "int256"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "getMarketState", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.MarketState", + "components": [ + { + "name": "shareReserves", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "bondReserves", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "shareAdjustment", + "type": "int128", + "internalType": "int128", + }, + { + "name": "zombieShareReserves", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "longExposure", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "longsOutstanding", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "shortsOutstanding", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "longAverageMaturityTime", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "shortAverageMaturityTime", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "isInitialized", + "type": "bool", + "internalType": "bool", + }, + { + "name": "isPaused", + "type": "bool", + "internalType": "bool", + }, + ], + } + ], + "stateMutability": "view", + }, + { + "type": "function", + "name": "getPoolConfig", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.PoolConfig", + "components": [ + { + "name": "baseToken", + "type": "address", + "internalType": "contract IERC20", + }, + { + "name": "linkerFactory", + "type": "address", + "internalType": "address", + }, + { + "name": "linkerCodeHash", + "type": "bytes32", + "internalType": "bytes32", + }, + { + "name": "initialSharePrice", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "minimumShareReserves", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "minimumTransactionAmount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "positionDuration", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "checkpointDuration", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "timeStretch", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "governance", + "type": "address", + "internalType": "address", + }, + { + "name": "feeCollector", + "type": "address", + "internalType": "address", + }, + { + "name": "fees", + "type": "tuple", + "internalType": "struct IHyperdrive.Fees", + "components": [ + { + "name": "curve", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "flat", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "governanceLP", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "governanceZombie", + "type": "uint256", + "internalType": "uint256", + }, + ], + }, + ], + } + ], + "stateMutability": "view", + }, + { + "type": "function", + "name": "getPoolInfo", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.PoolInfo", + "components": [ + { + "name": "shareReserves", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "shareAdjustment", + "type": "int256", + "internalType": "int256", + }, + { + "name": "zombieShareReserves", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "bondReserves", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "lpTotalSupply", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "longsOutstanding", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "longAverageMaturityTime", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "shortsOutstanding", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "shortAverageMaturityTime", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "withdrawalSharesReadyToWithdraw", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "withdrawalSharesProceeds", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "lpSharePrice", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "longExposure", + "type": "uint256", + "internalType": "uint256", + }, + ], + } + ], + "stateMutability": "view", + }, + { + "type": "function", + "name": "getUncollectedGovernanceFees", + "inputs": [], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "getWithdrawPool", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.WithdrawPool", + "components": [ + { + "name": "readyToWithdraw", + "type": "uint128", + "internalType": "uint128", + }, + { + "name": "proceeds", + "type": "uint128", + "internalType": "uint128", + }, + ], + } + ], + "stateMutability": "view", + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_contribution", + "type": "uint256", + "internalType": "uint256", + }, + {"name": "_apr", "type": "uint256", "internalType": "uint256"}, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [ + { + "name": "lpShares", + "type": "uint256", + "internalType": "uint256", + } + ], + "stateMutability": "payable", + }, + { + "type": "function", + "name": "isApprovedForAll", + "inputs": [ + {"name": "owner", "type": "address", "internalType": "address"}, + { + "name": "spender", + "type": "address", + "internalType": "address", + }, + ], + "outputs": [{"name": "", "type": "bool", "internalType": "bool"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "isSweepable", + "inputs": [ + { + "name": "_target", + "type": "address", + "internalType": "address", + } + ], + "outputs": [{"name": "", "type": "bool", "internalType": "bool"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "load", + "inputs": [ + { + "name": "_slots", + "type": "uint256[]", + "internalType": "uint256[]", + } + ], + "outputs": [{"name": "", "type": "bytes32[]", "internalType": "bytes32[]"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "name", + "inputs": [{"name": "id", "type": "uint256", "internalType": "uint256"}], + "outputs": [{"name": "", "type": "string", "internalType": "string"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "nonces", + "inputs": [{"name": "owner", "type": "address", "internalType": "address"}], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "openLong", + "inputs": [ + { + "name": "_baseAmount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minOutput", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minSharePrice", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [ + { + "name": "maturityTime", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "bondProceeds", + "type": "uint256", + "internalType": "uint256", + }, + ], + "stateMutability": "payable", + }, + { + "type": "function", + "name": "openShort", + "inputs": [ + { + "name": "_bondAmount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_maxDeposit", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minSharePrice", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [ + { + "name": "maturityTime", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "traderDeposit", + "type": "uint256", + "internalType": "uint256", + }, + ], + "stateMutability": "payable", + }, + { + "type": "function", + "name": "pause", + "inputs": [{"name": "_status", "type": "bool", "internalType": "bool"}], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "perTokenApprovals", + "inputs": [ + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256", + }, + {"name": "owner", "type": "address", "internalType": "address"}, + { + "name": "spender", + "type": "address", + "internalType": "address", + }, + ], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "permitForAll", + "inputs": [ + {"name": "owner", "type": "address", "internalType": "address"}, + { + "name": "spender", + "type": "address", + "internalType": "address", + }, + {"name": "_approved", "type": "bool", "internalType": "bool"}, + { + "name": "deadline", + "type": "uint256", + "internalType": "uint256", + }, + {"name": "v", "type": "uint8", "internalType": "uint8"}, + {"name": "r", "type": "bytes32", "internalType": "bytes32"}, + {"name": "s", "type": "bytes32", "internalType": "bytes32"}, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "pool", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract IERC4626", + } + ], + "stateMutability": "view", + }, + { + "type": "function", + "name": "redeemWithdrawalShares", + "inputs": [ + { + "name": "_shares", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minOutput", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [ + { + "name": "proceeds", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "sharesRedeemed", + "type": "uint256", + "internalType": "uint256", + }, + ], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "removeLiquidity", + "inputs": [ + { + "name": "_shares", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_minOutput", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address", + }, + { + "name": "asBase", + "type": "bool", + "internalType": "bool", + }, + { + "name": "extraData", + "type": "bytes", + "internalType": "bytes", + }, + ], + }, + ], + "outputs": [ + { + "name": "baseProceeds", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "withdrawalShares", + "type": "uint256", + "internalType": "uint256", + }, + ], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "setApproval", + "inputs": [ + { + "name": "tokenID", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "operator", + "type": "address", + "internalType": "address", + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256", + }, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "setApprovalBridge", + "inputs": [ + { + "name": "tokenID", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "operator", + "type": "address", + "internalType": "address", + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "caller", + "type": "address", + "internalType": "address", + }, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "setApprovalForAll", + "inputs": [ + { + "name": "operator", + "type": "address", + "internalType": "address", + }, + {"name": "approved", "type": "bool", "internalType": "bool"}, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "setGovernance", + "inputs": [{"name": "_who", "type": "address", "internalType": "address"}], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "setPauser", + "inputs": [ + {"name": "who", "type": "address", "internalType": "address"}, + {"name": "status", "type": "bool", "internalType": "bool"}, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "sweep", + "inputs": [ + { + "name": "_target", + "type": "address", + "internalType": "contract IERC20", + } + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "symbol", + "inputs": [{"name": "id", "type": "uint256", "internalType": "uint256"}], + "outputs": [{"name": "", "type": "string", "internalType": "string"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "target0", + "inputs": [], + "outputs": [{"name": "", "type": "address", "internalType": "address"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "target1", + "inputs": [], + "outputs": [{"name": "", "type": "address", "internalType": "address"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "totalSupply", + "inputs": [{"name": "id", "type": "uint256", "internalType": "uint256"}], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], + "stateMutability": "view", + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "tokenID", + "type": "uint256", + "internalType": "uint256", + }, + {"name": "from", "type": "address", "internalType": "address"}, + {"name": "to", "type": "address", "internalType": "address"}, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256", + }, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "function", + "name": "transferFromBridge", + "inputs": [ + { + "name": "tokenID", + "type": "uint256", + "internalType": "uint256", + }, + {"name": "from", "type": "address", "internalType": "address"}, + {"name": "to", "type": "address", "internalType": "address"}, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256", + }, + { + "name": "caller", + "type": "address", + "internalType": "address", + }, + ], + "outputs": [], + "stateMutability": "nonpayable", + }, + { + "type": "event", + "name": "AddLiquidity", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "lpAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "lpSharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "spender", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "value", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "ApprovalForAll", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "operator", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "approved", + "type": "bool", + "indexed": False, + "internalType": "bool", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "CloseLong", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "assetId", + "type": "uint256", + "indexed": True, + "internalType": "uint256", + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "CloseShort", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "assetId", + "type": "uint256", + "indexed": True, + "internalType": "uint256", + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "CollectGovernanceFee", + "inputs": [ + { + "name": "collector", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "baseFees", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "CreateCheckpoint", + "inputs": [ + { + "name": "checkpointTime", + "type": "uint256", + "indexed": True, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "maturedShorts", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "maturedLongs", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "lpSharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "Initialize", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "lpAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "apr", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "OpenLong", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "assetId", + "type": "uint256", + "indexed": True, + "internalType": "uint256", + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "OpenShort", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "assetId", + "type": "uint256", + "indexed": True, + "internalType": "uint256", + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "RedeemWithdrawalShares", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "withdrawalShareAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "RemoveLiquidity", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "lpAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "baseAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "sharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "withdrawalShareAmount", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "lpSharePrice", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + { + "type": "event", + "name": "TransferSingle", + "inputs": [ + { + "name": "operator", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "from", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "to", + "type": "address", + "indexed": True, + "internalType": "address", + }, + { + "name": "id", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + { + "name": "value", + "type": "uint256", + "indexed": False, + "internalType": "uint256", + }, + ], + "anonymous": False, + }, + {"type": "error", "name": "AlreadyClosed", "inputs": []}, + {"type": "error", "name": "ApprovalFailed", "inputs": []}, + {"type": "error", "name": "BatchInputLengthMismatch", "inputs": []}, + {"type": "error", "name": "BelowMinimumContribution", "inputs": []}, + {"type": "error", "name": "BelowMinimumShareReserves", "inputs": []}, + {"type": "error", "name": "BondMatured", "inputs": []}, + {"type": "error", "name": "BondNotMatured", "inputs": []}, + { + "type": "error", + "name": "CallFailed", + "inputs": [ + { + "name": "underlyingError", + "type": "bytes4", + "internalType": "bytes4", + } + ], + }, + {"type": "error", "name": "EndIndexTooLarge", "inputs": []}, + {"type": "error", "name": "ExpiredDeadline", "inputs": []}, + {"type": "error", "name": "FeeTooHigh", "inputs": []}, + { + "type": "error", + "name": "FixedPointMath_InvalidExponent", + "inputs": [], + }, + {"type": "error", "name": "FixedPointMath_InvalidInput", "inputs": []}, + {"type": "error", "name": "FixedPointMath_NegativeInput", "inputs": []}, + { + "type": "error", + "name": "FixedPointMath_NegativeOrZeroInput", + "inputs": [], + }, + { + "type": "error", + "name": "HyperdriveDeployerAlreadyAdded", + "inputs": [], + }, + { + "type": "error", + "name": "HyperdriveDeployerIndexMismatch", + "inputs": [], + }, + {"type": "error", "name": "HyperdriveDeployerNotAdded", "inputs": []}, + {"type": "error", "name": "InputLengthMismatch", "inputs": []}, + {"type": "error", "name": "InsufficientLiquidity", "inputs": []}, + {"type": "error", "name": "InsufficientPrice", "inputs": []}, + {"type": "error", "name": "InvalidApr", "inputs": []}, + {"type": "error", "name": "InvalidBaseToken", "inputs": []}, + {"type": "error", "name": "InvalidCheckpointDuration", "inputs": []}, + {"type": "error", "name": "InvalidCheckpointTime", "inputs": []}, + {"type": "error", "name": "InvalidContribution", "inputs": []}, + {"type": "error", "name": "InvalidDeployer", "inputs": []}, + {"type": "error", "name": "InvalidERC20Bridge", "inputs": []}, + {"type": "error", "name": "InvalidFeeAmounts", "inputs": []}, + {"type": "error", "name": "InvalidFeeDestination", "inputs": []}, + {"type": "error", "name": "InvalidForwarderAddress", "inputs": []}, + {"type": "error", "name": "InvalidIndexes", "inputs": []}, + {"type": "error", "name": "InvalidInitialSharePrice", "inputs": []}, + {"type": "error", "name": "InvalidMaturityTime", "inputs": []}, + {"type": "error", "name": "InvalidMinimumShareReserves", "inputs": []}, + {"type": "error", "name": "InvalidPositionDuration", "inputs": []}, + { + "type": "error", + "name": "InvalidRecipient", + "inputs": [ + { + "name": "recipient", + "type": "address", + "internalType": "address", + } + ], + }, + {"type": "error", "name": "InvalidShareReserves", "inputs": []}, + {"type": "error", "name": "InvalidSignature", "inputs": []}, + {"type": "error", "name": "InvalidTimestamp", "inputs": []}, + {"type": "error", "name": "InvalidToken", "inputs": []}, + {"type": "error", "name": "InvalidTradeSize", "inputs": []}, + {"type": "error", "name": "MaxFeeTooHigh", "inputs": []}, + {"type": "error", "name": "MinimumSharePrice", "inputs": []}, + {"type": "error", "name": "MinimumTransactionAmount", "inputs": []}, + {"type": "error", "name": "MintPercentTooHigh", "inputs": []}, + {"type": "error", "name": "NegativeInterest", "inputs": []}, + {"type": "error", "name": "NegativePresentValue", "inputs": []}, + {"type": "error", "name": "NoAssetsToWithdraw", "inputs": []}, + {"type": "error", "name": "NonPayableInitialization", "inputs": []}, + {"type": "error", "name": "NotPayable", "inputs": []}, + {"type": "error", "name": "OutputLimit", "inputs": []}, + {"type": "error", "name": "Paused", "inputs": []}, + {"type": "error", "name": "PoolAlreadyInitialized", "inputs": []}, + {"type": "error", "name": "QueryOutOfRange", "inputs": []}, + {"type": "error", "name": "RestrictedZeroAddress", "inputs": []}, + { + "type": "error", + "name": "ReturnData", + "inputs": [{"name": "data", "type": "bytes", "internalType": "bytes"}], + }, + { + "type": "error", + "name": "ShareReservesDeltaExceedsBondReservesDelta", + "inputs": [], + }, + {"type": "error", "name": "TransferFailed", "inputs": []}, + {"type": "error", "name": "Unauthorized", "inputs": []}, + {"type": "error", "name": "UnexpectedAssetId", "inputs": []}, + {"type": "error", "name": "UnexpectedSender", "inputs": []}, + {"type": "error", "name": "UnexpectedSuccess", "inputs": []}, + {"type": "error", "name": "UnsafeCastToInt128", "inputs": []}, + {"type": "error", "name": "UnsafeCastToUint128", "inputs": []}, + {"type": "error", "name": "UnsupportedToken", "inputs": []}, + {"type": "error", "name": "ZeroLpTotalSupply", "inputs": []}, + ], +) +# pylint: disable=line-too-long +ierc4626hyperdrive_bytecode = HexStr("0x") + + +class IERC4626HyperdriveContract(Contract): + """A web3.py Contract class for the IERC4626Hyperdrive contract.""" + + abi: ABI = ierc4626hyperdrive_abi + bytecode: bytes = HexBytes(ierc4626hyperdrive_bytecode) + + def __init__(self, address: ChecksumAddress | None = None) -> None: + try: + # Initialize parent Contract class + super().__init__(address=address) + self.functions = IERC4626HyperdriveContractFunctions(ierc4626hyperdrive_abi, self.w3, address) # type: ignore + self.events = IERC4626HyperdriveContractEvents(ierc4626hyperdrive_abi, self.w3, address) # type: ignore + + except FallbackNotFound: + print("Fallback function not found. Continuing...") + + events: IERC4626HyperdriveContractEvents + + functions: IERC4626HyperdriveContractFunctions + + @classmethod + def constructor(cls) -> ContractConstructor: # type: ignore + """Creates a transaction with the contract's constructor function. + + Parameters + ---------- + + w3 : Web3 + A web3 instance. + account : LocalAccount + The account to use to deploy the contract. + + Returns + ------- + Self + A deployed instance of the contract. + + """ + + return super().constructor() + + @classmethod + def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self: + """Deploys and instance of the contract. + + Parameters + ---------- + w3 : Web3 + A web3 instance. + account : LocalAccount + The account to use to deploy the contract. + + Returns + ------- + Self + A deployed instance of the contract. + """ + deployer = cls.factory(w3=w3) + constructor_fn = deployer.constructor() + + # if an address is supplied, try to use a web3 default account + if isinstance(account, str): + tx_hash = constructor_fn.transact({"from": account}) + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + + deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore + return deployed_contract + + # otherwise use the account provided. + deployment_tx = constructor_fn.build_transaction() + current_nonce = w3.eth.get_transaction_count(account.address) + deployment_tx.update({"nonce": current_nonce}) + + # Sign the transaction with local account private key + signed_tx = account.sign_transaction(deployment_tx) + + # Send the signed transaction and wait for receipt + tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction) + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + + deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore + return deployed_contract + + @classmethod + def factory(cls, w3: Web3, class_name: str | None = None, **kwargs: Any) -> Type[Self]: + """Deploys and instance of the contract. + + Parameters + ---------- + w3 : Web3 + A web3 instance. + class_name: str | None + The instance class name. + + Returns + ------- + Self + A deployed instance of the contract. + """ + contract = super().factory(w3, class_name, **kwargs) + contract.functions = IERC4626HyperdriveContractFunctions(ierc4626hyperdrive_abi, w3, None) + + return contract diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveTypes.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py similarity index 96% rename from crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveTypes.py rename to crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py index c2120f4..475882f 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveTypes.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py @@ -1,4 +1,8 @@ -"""Dataclasses for all structs in the IHyperdrive contract.""" +"""Dataclasses for all structs in the IERC4626Hyperdrive contract. + +DO NOT EDIT. This file was generated by pypechain. See documentation at +https://github.com/delvtech/pypechain """ + # super() call methods are generic, while our version adds values & types # pylint: disable=arguments-differ # contracts have PascalCase names @@ -32,7 +36,6 @@ class Checkpoint: """Checkpoint struct.""" sharePrice: int - exposure: int @dataclass @@ -42,6 +45,7 @@ class MarketState: shareReserves: int bondReserves: int shareAdjustment: int + zombieShareReserves: int longExposure: int longsOutstanding: int shortsOutstanding: int @@ -57,7 +61,8 @@ class Fees: curve: int flat: int - governance: int + governanceLP: int + governanceZombie: int @dataclass @@ -70,7 +75,6 @@ class PoolConfig: initialSharePrice: int minimumShareReserves: int minimumTransactionAmount: int - precisionThreshold: int positionDuration: int checkpointDuration: int timeStretch: int @@ -85,6 +89,7 @@ class PoolInfo: shareReserves: int shareAdjustment: int + zombieShareReserves: int bondReserves: int lpTotalSupply: int sharePrice: int diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveContract.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveContract.py deleted file mode 100644 index b394001..0000000 --- a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IHyperdriveContract.py +++ /dev/null @@ -1,2334 +0,0 @@ -"""A web3.py Contract class for the IHyperdrive contract.""" - -# contracts have PascalCase names -# pylint: disable=invalid-name - -# contracts control how many attributes and arguments we have in generated code -# pylint: disable=too-many-instance-attributes -# pylint: disable=too-many-arguments - -# we don't need else statement if the other conditionals all have return, -# but it's easier to generate -# pylint: disable=no-else-return - -# This file is bound to get very long depending on contract sizes. -# pylint: disable=too-many-lines - -from __future__ import annotations -from typing import cast - -from eth_typing import ChecksumAddress -from web3.types import ABI -from web3.contract.contract import Contract, ContractFunction, ContractFunctions -from web3.exceptions import FallbackNotFound - - -class IHyperdriveDOMAIN_SEPARATORContractFunction(ContractFunction): - """ContractFunction for the DOMAIN_SEPARATOR method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveDOMAIN_SEPARATORContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdrivePERMIT_TYPEHASHContractFunction(ContractFunction): - """ContractFunction for the PERMIT_TYPEHASH method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdrivePERMIT_TYPEHASHContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveAddLiquidityContractFunction(ContractFunction): - """ContractFunction for the addLiquidity method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, _contribution: int, _minApr: int, _maxApr: int, _options: tuple - ) -> "IHyperdriveAddLiquidityContractFunction": - super().__call__(_contribution, _minApr, _maxApr, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveBalanceOfContractFunction(ContractFunction): - """ContractFunction for the balanceOf method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, tokenId: int, owner: str) -> "IHyperdriveBalanceOfContractFunction": - super().__call__(tokenId, owner) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveBaseTokenContractFunction(ContractFunction): - """ContractFunction for the baseToken method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveBaseTokenContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveBatchTransferFromContractFunction(ContractFunction): - """ContractFunction for the batchTransferFrom method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, _from: str, to: str, ids: list[int], values: list[int] - ) -> "IHyperdriveBatchTransferFromContractFunction": - super().__call__(_from, to, ids, values) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveCheckpointContractFunction(ContractFunction): - """ContractFunction for the checkpoint method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _checkpointTime: int) -> "IHyperdriveCheckpointContractFunction": - super().__call__(_checkpointTime) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveCloseLongContractFunction(ContractFunction): - """ContractFunction for the closeLong method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, - _maturityTime: int, - _bondAmount: int, - _minOutput: int, - _options: tuple, - ) -> "IHyperdriveCloseLongContractFunction": - super().__call__(_maturityTime, _bondAmount, _minOutput, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveCloseShortContractFunction(ContractFunction): - """ContractFunction for the closeShort method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, - _maturityTime: int, - _bondAmount: int, - _minOutput: int, - _options: tuple, - ) -> "IHyperdriveCloseShortContractFunction": - super().__call__(_maturityTime, _bondAmount, _minOutput, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveCollectGovernanceFeeContractFunction(ContractFunction): - """ContractFunction for the collectGovernanceFee method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _options: tuple) -> "IHyperdriveCollectGovernanceFeeContractFunction": - super().__call__(_options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveGetCheckpointContractFunction(ContractFunction): - """ContractFunction for the getCheckpoint method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _checkpointId: int) -> "IHyperdriveGetCheckpointContractFunction": - super().__call__(_checkpointId) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveGetMarketStateContractFunction(ContractFunction): - """ContractFunction for the getMarketState method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveGetMarketStateContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveGetPoolConfigContractFunction(ContractFunction): - """ContractFunction for the getPoolConfig method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveGetPoolConfigContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveGetPoolInfoContractFunction(ContractFunction): - """ContractFunction for the getPoolInfo method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveGetPoolInfoContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveGetUncollectedGovernanceFeesContractFunction(ContractFunction): - """ContractFunction for the getUncollectedGovernanceFees method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, - ) -> "IHyperdriveGetUncollectedGovernanceFeesContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveGetWithdrawPoolContractFunction(ContractFunction): - """ContractFunction for the getWithdrawPool method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveGetWithdrawPoolContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveInitializeContractFunction(ContractFunction): - """ContractFunction for the initialize method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _contribution: int, _apr: int, _options: tuple) -> "IHyperdriveInitializeContractFunction": - super().__call__(_contribution, _apr, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveIsApprovedForAllContractFunction(ContractFunction): - """ContractFunction for the isApprovedForAll method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, owner: str, spender: str) -> "IHyperdriveIsApprovedForAllContractFunction": - super().__call__(owner, spender) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveLoadContractFunction(ContractFunction): - """ContractFunction for the load method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _slots: list[int]) -> "IHyperdriveLoadContractFunction": - super().__call__(_slots) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveNameContractFunction(ContractFunction): - """ContractFunction for the name method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _id: int) -> "IHyperdriveNameContractFunction": - super().__call__(_id) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveNoncesContractFunction(ContractFunction): - """ContractFunction for the nonces method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, owner: str) -> "IHyperdriveNoncesContractFunction": - super().__call__(owner) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveOpenLongContractFunction(ContractFunction): - """ContractFunction for the openLong method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, - _baseAmount: int, - _minOutput: int, - _minSharePrice: int, - _options: tuple, - ) -> "IHyperdriveOpenLongContractFunction": - super().__call__(_baseAmount, _minOutput, _minSharePrice, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveOpenShortContractFunction(ContractFunction): - """ContractFunction for the openShort method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, - _bondAmount: int, - _maxDeposit: int, - _minSharePrice: int, - _options: tuple, - ) -> "IHyperdriveOpenShortContractFunction": - super().__call__(_bondAmount, _maxDeposit, _minSharePrice, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdrivePauseContractFunction(ContractFunction): - """ContractFunction for the pause method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _status: bool) -> "IHyperdrivePauseContractFunction": - super().__call__(_status) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdrivePerTokenApprovalsContractFunction(ContractFunction): - """ContractFunction for the perTokenApprovals method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, tokenId: int, owner: str, spender: str) -> "IHyperdrivePerTokenApprovalsContractFunction": - super().__call__(tokenId, owner, spender) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdrivePermitForAllContractFunction(ContractFunction): - """ContractFunction for the permitForAll method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, - owner: str, - spender: str, - _approved: bool, - deadline: int, - v: int, - r: bytes, - s: bytes, - ) -> "IHyperdrivePermitForAllContractFunction": - super().__call__(owner, spender, _approved, deadline, v, r, s) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveRedeemWithdrawalSharesContractFunction(ContractFunction): - """ContractFunction for the redeemWithdrawalShares method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, _shares: int, _minOutput: int, _options: tuple - ) -> "IHyperdriveRedeemWithdrawalSharesContractFunction": - super().__call__(_shares, _minOutput, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveRemoveLiquidityContractFunction(ContractFunction): - """ContractFunction for the removeLiquidity method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _shares: int, _minOutput: int, _options: tuple) -> "IHyperdriveRemoveLiquidityContractFunction": - super().__call__(_shares, _minOutput, _options) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveSetApprovalContractFunction(ContractFunction): - """ContractFunction for the setApproval method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, tokenID: int, operator: str, amount: int) -> "IHyperdriveSetApprovalContractFunction": - super().__call__(tokenID, operator, amount) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveSetApprovalBridgeContractFunction(ContractFunction): - """ContractFunction for the setApprovalBridge method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, tokenID: int, operator: str, amount: int, caller: str - ) -> "IHyperdriveSetApprovalBridgeContractFunction": - super().__call__(tokenID, operator, amount, caller) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveSetApprovalForAllContractFunction(ContractFunction): - """ContractFunction for the setApprovalForAll method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, operator: str, approved: bool) -> "IHyperdriveSetApprovalForAllContractFunction": - super().__call__(operator, approved) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveSetGovernanceContractFunction(ContractFunction): - """ContractFunction for the setGovernance method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _who: str) -> "IHyperdriveSetGovernanceContractFunction": - super().__call__(_who) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveSetPauserContractFunction(ContractFunction): - """ContractFunction for the setPauser method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, who: str, status: bool) -> "IHyperdriveSetPauserContractFunction": - super().__call__(who, status) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveSymbolContractFunction(ContractFunction): - """ContractFunction for the symbol method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _id: int) -> "IHyperdriveSymbolContractFunction": - super().__call__(_id) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveTarget0ContractFunction(ContractFunction): - """ContractFunction for the target0 method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveTarget0ContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveTarget1ContractFunction(ContractFunction): - """ContractFunction for the target1 method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self) -> "IHyperdriveTarget1ContractFunction": - super().__call__() - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveTotalSupplyContractFunction(ContractFunction): - """ContractFunction for the totalSupply method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, _id: int) -> "IHyperdriveTotalSupplyContractFunction": - super().__call__(_id) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveTransferFromContractFunction(ContractFunction): - """ContractFunction for the transferFrom method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__(self, tokenID: int, _from: str, to: str, amount: int) -> "IHyperdriveTransferFromContractFunction": - super().__call__(tokenID, _from, to, amount) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveTransferFromBridgeContractFunction(ContractFunction): - """ContractFunction for the transferFromBridge method.""" - - # super() call methods are generic, while our version adds values & types - # pylint: disable=arguments-differ - - def __call__( - self, tokenID: int, _from: str, to: str, amount: int, caller: str - ) -> "IHyperdriveTransferFromBridgeContractFunction": - super().__call__(tokenID, _from, to, amount, caller) - return self - - # TODO: add call def so we can get return types for the calls - # def call() - - -class IHyperdriveContractFunctions(ContractFunctions): - """ContractFunctions for the IHyperdrive contract.""" - - DOMAIN_SEPARATOR: IHyperdriveDOMAIN_SEPARATORContractFunction - - PERMIT_TYPEHASH: IHyperdrivePERMIT_TYPEHASHContractFunction - - addLiquidity: IHyperdriveAddLiquidityContractFunction - - balanceOf: IHyperdriveBalanceOfContractFunction - - baseToken: IHyperdriveBaseTokenContractFunction - - batchTransferFrom: IHyperdriveBatchTransferFromContractFunction - - checkpoint: IHyperdriveCheckpointContractFunction - - closeLong: IHyperdriveCloseLongContractFunction - - closeShort: IHyperdriveCloseShortContractFunction - - collectGovernanceFee: IHyperdriveCollectGovernanceFeeContractFunction - - getCheckpoint: IHyperdriveGetCheckpointContractFunction - - getMarketState: IHyperdriveGetMarketStateContractFunction - - getPoolConfig: IHyperdriveGetPoolConfigContractFunction - - getPoolInfo: IHyperdriveGetPoolInfoContractFunction - - getUncollectedGovernanceFees: IHyperdriveGetUncollectedGovernanceFeesContractFunction - - getWithdrawPool: IHyperdriveGetWithdrawPoolContractFunction - - initialize: IHyperdriveInitializeContractFunction - - isApprovedForAll: IHyperdriveIsApprovedForAllContractFunction - - load: IHyperdriveLoadContractFunction - - name: IHyperdriveNameContractFunction - - nonces: IHyperdriveNoncesContractFunction - - openLong: IHyperdriveOpenLongContractFunction - - openShort: IHyperdriveOpenShortContractFunction - - pause: IHyperdrivePauseContractFunction - - perTokenApprovals: IHyperdrivePerTokenApprovalsContractFunction - - permitForAll: IHyperdrivePermitForAllContractFunction - - redeemWithdrawalShares: IHyperdriveRedeemWithdrawalSharesContractFunction - - removeLiquidity: IHyperdriveRemoveLiquidityContractFunction - - setApproval: IHyperdriveSetApprovalContractFunction - - setApprovalBridge: IHyperdriveSetApprovalBridgeContractFunction - - setApprovalForAll: IHyperdriveSetApprovalForAllContractFunction - - setGovernance: IHyperdriveSetGovernanceContractFunction - - setPauser: IHyperdriveSetPauserContractFunction - - symbol: IHyperdriveSymbolContractFunction - - target0: IHyperdriveTarget0ContractFunction - - target1: IHyperdriveTarget1ContractFunction - - totalSupply: IHyperdriveTotalSupplyContractFunction - - transferFrom: IHyperdriveTransferFromContractFunction - - transferFromBridge: IHyperdriveTransferFromBridgeContractFunction - - -ihyperdrive_abi: ABI = cast( - ABI, - [ - {"inputs": [], "name": "AlreadyClosed", "type": "error"}, - {"inputs": [], "name": "ApprovalFailed", "type": "error"}, - { - "inputs": [], - "name": "BaseBufferExceedsShareReserves", - "type": "error", - }, - {"inputs": [], "name": "BatchInputLengthMismatch", "type": "error"}, - {"inputs": [], "name": "BelowMinimumContribution", "type": "error"}, - {"inputs": [], "name": "BelowMinimumShareReserves", "type": "error"}, - {"inputs": [], "name": "BondMatured", "type": "error"}, - {"inputs": [], "name": "BondNotMatured", "type": "error"}, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "underlyingError", - "type": "bytes4", - } - ], - "name": "CallFailed", - "type": "error", - }, - {"inputs": [], "name": "EndIndexTooLarge", "type": "error"}, - {"inputs": [], "name": "ExpiredDeadline", "type": "error"}, - {"inputs": [], "name": "FeeTooHigh", "type": "error"}, - { - "inputs": [], - "name": "FixedPointMath_InvalidExponent", - "type": "error", - }, - {"inputs": [], "name": "FixedPointMath_InvalidInput", "type": "error"}, - {"inputs": [], "name": "FixedPointMath_NegativeInput", "type": "error"}, - { - "inputs": [], - "name": "FixedPointMath_NegativeOrZeroInput", - "type": "error", - }, - {"inputs": [], "name": "InputLengthMismatch", "type": "error"}, - {"inputs": [], "name": "InsufficientPrice", "type": "error"}, - {"inputs": [], "name": "InvalidApr", "type": "error"}, - {"inputs": [], "name": "InvalidBaseToken", "type": "error"}, - {"inputs": [], "name": "InvalidCheckpointDuration", "type": "error"}, - {"inputs": [], "name": "InvalidCheckpointTime", "type": "error"}, - {"inputs": [], "name": "InvalidContribution", "type": "error"}, - {"inputs": [], "name": "InvalidERC20Bridge", "type": "error"}, - {"inputs": [], "name": "InvalidFeeAmounts", "type": "error"}, - {"inputs": [], "name": "InvalidFeeDestination", "type": "error"}, - {"inputs": [], "name": "InvalidForwarderAddress", "type": "error"}, - {"inputs": [], "name": "InvalidIndexes", "type": "error"}, - {"inputs": [], "name": "InvalidInitialSharePrice", "type": "error"}, - {"inputs": [], "name": "InvalidMaturityTime", "type": "error"}, - {"inputs": [], "name": "InvalidMinimumShareReserves", "type": "error"}, - {"inputs": [], "name": "InvalidPositionDuration", "type": "error"}, - {"inputs": [], "name": "InvalidShareReserves", "type": "error"}, - {"inputs": [], "name": "InvalidSignature", "type": "error"}, - {"inputs": [], "name": "InvalidTimestamp", "type": "error"}, - {"inputs": [], "name": "InvalidToken", "type": "error"}, - {"inputs": [], "name": "InvalidTradeSize", "type": "error"}, - {"inputs": [], "name": "MaxFeeTooHigh", "type": "error"}, - {"inputs": [], "name": "MinimumSharePrice", "type": "error"}, - {"inputs": [], "name": "MinimumTransactionAmount", "type": "error"}, - {"inputs": [], "name": "MintPercentTooHigh", "type": "error"}, - {"inputs": [], "name": "NegativeInterest", "type": "error"}, - {"inputs": [], "name": "NegativePresentValue", "type": "error"}, - {"inputs": [], "name": "NoAssetsToWithdraw", "type": "error"}, - {"inputs": [], "name": "NonPayableInitialization", "type": "error"}, - {"inputs": [], "name": "NotPayable", "type": "error"}, - {"inputs": [], "name": "OutputLimit", "type": "error"}, - {"inputs": [], "name": "Paused", "type": "error"}, - {"inputs": [], "name": "PoolAlreadyInitialized", "type": "error"}, - {"inputs": [], "name": "QueryOutOfRange", "type": "error"}, - {"inputs": [], "name": "RestrictedZeroAddress", "type": "error"}, - { - "inputs": [{"internalType": "bytes", "name": "data", "type": "bytes"}], - "name": "ReturnData", - "type": "error", - }, - { - "inputs": [], - "name": "ShareReservesDeltaExceedsBondReservesDelta", - "type": "error", - }, - {"inputs": [], "name": "TransferFailed", "type": "error"}, - {"inputs": [], "name": "Unauthorized", "type": "error"}, - {"inputs": [], "name": "UnexpectedAssetId", "type": "error"}, - {"inputs": [], "name": "UnexpectedSender", "type": "error"}, - {"inputs": [], "name": "UnexpectedSuccess", "type": "error"}, - {"inputs": [], "name": "UnsafeCastToInt128", "type": "error"}, - {"inputs": [], "name": "UnsafeCastToUint128", "type": "error"}, - {"inputs": [], "name": "UnsupportedToken", "type": "error"}, - {"inputs": [], "name": "ZeroLpTotalSupply", "type": "error"}, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "provider", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "lpAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "lpSharePrice", - "type": "uint256", - }, - ], - "name": "AddLiquidity", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "owner", - "type": "address", - }, - { - "indexed": True, - "internalType": "address", - "name": "spender", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "value", - "type": "uint256", - }, - ], - "name": "Approval", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "account", - "type": "address", - }, - { - "indexed": True, - "internalType": "address", - "name": "operator", - "type": "address", - }, - { - "indexed": False, - "internalType": "bool", - "name": "approved", - "type": "bool", - }, - ], - "name": "ApprovalForAll", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "trader", - "type": "address", - }, - { - "indexed": True, - "internalType": "uint256", - "name": "assetId", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "maturityTime", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "bondAmount", - "type": "uint256", - }, - ], - "name": "CloseLong", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "trader", - "type": "address", - }, - { - "indexed": True, - "internalType": "uint256", - "name": "assetId", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "maturityTime", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "bondAmount", - "type": "uint256", - }, - ], - "name": "CloseShort", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "collector", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseFees", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - ], - "name": "CollectGovernanceFee", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "uint256", - "name": "checkpointTime", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "maturedShorts", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "maturedLongs", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "lpSharePrice", - "type": "uint256", - }, - ], - "name": "CreateCheckpoint", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "provider", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "lpAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "apr", - "type": "uint256", - }, - ], - "name": "Initialize", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "trader", - "type": "address", - }, - { - "indexed": True, - "internalType": "uint256", - "name": "assetId", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "maturityTime", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "bondAmount", - "type": "uint256", - }, - ], - "name": "OpenLong", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "trader", - "type": "address", - }, - { - "indexed": True, - "internalType": "uint256", - "name": "assetId", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "maturityTime", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "bondAmount", - "type": "uint256", - }, - ], - "name": "OpenShort", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "provider", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "withdrawalShareAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - ], - "name": "RedeemWithdrawalShares", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "provider", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "lpAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "baseAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "withdrawalShareAmount", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "lpSharePrice", - "type": "uint256", - }, - ], - "name": "RemoveLiquidity", - "type": "event", - }, - { - "anonymous": False, - "inputs": [ - { - "indexed": True, - "internalType": "address", - "name": "operator", - "type": "address", - }, - { - "indexed": True, - "internalType": "address", - "name": "from", - "type": "address", - }, - { - "indexed": True, - "internalType": "address", - "name": "to", - "type": "address", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "id", - "type": "uint256", - }, - { - "indexed": False, - "internalType": "uint256", - "name": "value", - "type": "uint256", - }, - ], - "name": "TransferSingle", - "type": "event", - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_contribution", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minApr", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_maxApr", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "addLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "lpShares", - "type": "uint256", - } - ], - "stateMutability": "payable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256", - }, - {"internalType": "address", "name": "owner", "type": "address"}, - ], - "name": "balanceOf", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "baseToken", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - {"internalType": "address", "name": "from", "type": "address"}, - {"internalType": "address", "name": "to", "type": "address"}, - { - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]", - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]", - }, - ], - "name": "batchTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_checkpointTime", - "type": "uint256", - } - ], - "name": "checkpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maturityTime", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_bondAmount", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minOutput", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "closeLong", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maturityTime", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_bondAmount", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minOutput", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "closeShort", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - } - ], - "name": "collectGovernanceFee", - "outputs": [ - { - "internalType": "uint256", - "name": "proceeds", - "type": "uint256", - } - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_checkpointId", - "type": "uint256", - } - ], - "name": "getCheckpoint", - "outputs": [ - { - "components": [ - { - "internalType": "uint128", - "name": "sharePrice", - "type": "uint128", - }, - { - "internalType": "int128", - "name": "exposure", - "type": "int128", - }, - ], - "internalType": "struct IHyperdrive.Checkpoint", - "name": "", - "type": "tuple", - } - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "getMarketState", - "outputs": [ - { - "components": [ - { - "internalType": "uint128", - "name": "shareReserves", - "type": "uint128", - }, - { - "internalType": "uint128", - "name": "bondReserves", - "type": "uint128", - }, - { - "internalType": "int128", - "name": "shareAdjustment", - "type": "int128", - }, - { - "internalType": "uint128", - "name": "longExposure", - "type": "uint128", - }, - { - "internalType": "uint128", - "name": "longsOutstanding", - "type": "uint128", - }, - { - "internalType": "uint128", - "name": "shortsOutstanding", - "type": "uint128", - }, - { - "internalType": "uint128", - "name": "longAverageMaturityTime", - "type": "uint128", - }, - { - "internalType": "uint128", - "name": "shortAverageMaturityTime", - "type": "uint128", - }, - { - "internalType": "bool", - "name": "isInitialized", - "type": "bool", - }, - { - "internalType": "bool", - "name": "isPaused", - "type": "bool", - }, - ], - "internalType": "struct IHyperdrive.MarketState", - "name": "", - "type": "tuple", - } - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "getPoolConfig", - "outputs": [ - { - "components": [ - { - "internalType": "contract IERC20", - "name": "baseToken", - "type": "address", - }, - { - "internalType": "address", - "name": "linkerFactory", - "type": "address", - }, - { - "internalType": "bytes32", - "name": "linkerCodeHash", - "type": "bytes32", - }, - { - "internalType": "uint256", - "name": "initialSharePrice", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "minimumShareReserves", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "minimumTransactionAmount", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "precisionThreshold", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "positionDuration", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "checkpointDuration", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "timeStretch", - "type": "uint256", - }, - { - "internalType": "address", - "name": "governance", - "type": "address", - }, - { - "internalType": "address", - "name": "feeCollector", - "type": "address", - }, - { - "components": [ - { - "internalType": "uint256", - "name": "curve", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "flat", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "governance", - "type": "uint256", - }, - ], - "internalType": "struct IHyperdrive.Fees", - "name": "fees", - "type": "tuple", - }, - ], - "internalType": "struct IHyperdrive.PoolConfig", - "name": "", - "type": "tuple", - } - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "getPoolInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "shareReserves", - "type": "uint256", - }, - { - "internalType": "int256", - "name": "shareAdjustment", - "type": "int256", - }, - { - "internalType": "uint256", - "name": "bondReserves", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "lpTotalSupply", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "sharePrice", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "longsOutstanding", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "longAverageMaturityTime", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "shortsOutstanding", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "shortAverageMaturityTime", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "withdrawalSharesReadyToWithdraw", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "withdrawalSharesProceeds", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "lpSharePrice", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "longExposure", - "type": "uint256", - }, - ], - "internalType": "struct IHyperdrive.PoolInfo", - "name": "", - "type": "tuple", - } - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "getUncollectedGovernanceFees", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "getWithdrawPool", - "outputs": [ - { - "components": [ - { - "internalType": "uint128", - "name": "readyToWithdraw", - "type": "uint128", - }, - { - "internalType": "uint128", - "name": "proceeds", - "type": "uint128", - }, - ], - "internalType": "struct IHyperdrive.WithdrawPool", - "name": "", - "type": "tuple", - } - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_contribution", - "type": "uint256", - }, - {"internalType": "uint256", "name": "_apr", "type": "uint256"}, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "initialize", - "outputs": [ - { - "internalType": "uint256", - "name": "lpShares", - "type": "uint256", - } - ], - "stateMutability": "payable", - "type": "function", - }, - { - "inputs": [ - {"internalType": "address", "name": "owner", "type": "address"}, - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - ], - "name": "isApprovedForAll", - "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "_slots", - "type": "uint256[]", - } - ], - "name": "load", - "outputs": [{"internalType": "bytes32[]", "name": "", "type": "bytes32[]"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [{"internalType": "uint256", "name": "id", "type": "uint256"}], - "name": "name", - "outputs": [{"internalType": "string", "name": "", "type": "string"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [{"internalType": "address", "name": "owner", "type": "address"}], - "name": "nonces", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_baseAmount", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minOutput", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minSharePrice", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "openLong", - "outputs": [ - { - "internalType": "uint256", - "name": "maturityTime", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "bondProceeds", - "type": "uint256", - }, - ], - "stateMutability": "payable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bondAmount", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_maxDeposit", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minSharePrice", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "openShort", - "outputs": [ - { - "internalType": "uint256", - "name": "maturityTime", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "traderDeposit", - "type": "uint256", - }, - ], - "stateMutability": "payable", - "type": "function", - }, - { - "inputs": [{"internalType": "bool", "name": "_status", "type": "bool"}], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256", - }, - {"internalType": "address", "name": "owner", "type": "address"}, - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - ], - "name": "perTokenApprovals", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - {"internalType": "address", "name": "owner", "type": "address"}, - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - {"internalType": "bool", "name": "_approved", "type": "bool"}, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256", - }, - {"internalType": "uint8", "name": "v", "type": "uint8"}, - {"internalType": "bytes32", "name": "r", "type": "bytes32"}, - {"internalType": "bytes32", "name": "s", "type": "bytes32"}, - ], - "name": "permitForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_shares", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minOutput", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "redeemWithdrawalShares", - "outputs": [ - { - "internalType": "uint256", - "name": "proceeds", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "sharesRedeemed", - "type": "uint256", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_shares", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "_minOutput", - "type": "uint256", - }, - { - "components": [ - { - "internalType": "address", - "name": "destination", - "type": "address", - }, - { - "internalType": "bool", - "name": "asBase", - "type": "bool", - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes", - }, - ], - "internalType": "struct IHyperdrive.Options", - "name": "_options", - "type": "tuple", - }, - ], - "name": "removeLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "baseProceeds", - "type": "uint256", - }, - { - "internalType": "uint256", - "name": "withdrawalShares", - "type": "uint256", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256", - }, - { - "internalType": "address", - "name": "operator", - "type": "address", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "setApproval", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256", - }, - { - "internalType": "address", - "name": "operator", - "type": "address", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - { - "internalType": "address", - "name": "caller", - "type": "address", - }, - ], - "name": "setApprovalBridge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address", - }, - {"internalType": "bool", "name": "approved", "type": "bool"}, - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [{"internalType": "address", "name": "_who", "type": "address"}], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - {"internalType": "address", "name": "who", "type": "address"}, - {"internalType": "bool", "name": "status", "type": "bool"}, - ], - "name": "setPauser", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [{"internalType": "uint256", "name": "id", "type": "uint256"}], - "name": "symbol", - "outputs": [{"internalType": "string", "name": "", "type": "string"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "target0", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "target1", - "outputs": [{"internalType": "address", "name": "", "type": "address"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [{"internalType": "uint256", "name": "id", "type": "uint256"}], - "name": "totalSupply", - "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256", - }, - {"internalType": "address", "name": "from", "type": "address"}, - {"internalType": "address", "name": "to", "type": "address"}, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256", - }, - {"internalType": "address", "name": "from", "type": "address"}, - {"internalType": "address", "name": "to", "type": "address"}, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - { - "internalType": "address", - "name": "caller", - "type": "address", - }, - ], - "name": "transferFromBridge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - ], -) - - -class IHyperdriveContract(Contract): - """A web3.py Contract class for the IHyperdrive contract.""" - - abi: ABI = ihyperdrive_abi - - def __init__(self, address: ChecksumAddress | None = None) -> None: - try: - # Initialize parent Contract class - super().__init__(address=address) - - except FallbackNotFound: - print("Fallback function not found. Continuing...") - - # TODO: add events - # events: ERC20ContractEvents - - functions: IHyperdriveContractFunctions diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/__init__.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/__init__.py index e69de29..99b82f7 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/__init__.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/__init__.py @@ -0,0 +1,7 @@ +"""Export all types from generated files. + +DO NOT EDIT. This file was generated by pypechain. See documentation at +https://github.com/delvtech/pypechain""" + +from .IERC4626HyperdriveContract import * +from .IERC4626HyperdriveTypes import * diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/utilities.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/utilities.py new file mode 100644 index 0000000..3c3b5c6 --- /dev/null +++ b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/utilities.py @@ -0,0 +1,109 @@ +"""Utility functions for the pypechain generated files. + +DO NOT EDIT. This file was generated by pypechain. See documentation at +https://github.com/delvtech/pypechain""" +from __future__ import annotations + +from dataclasses import fields, is_dataclass +from typing import Any, Tuple, TypeVar, cast + +T = TypeVar("T") + + +def tuple_to_dataclass(cls: type[T], structs: dict[str, Any], tuple_data: Any | Tuple[Any, ...]) -> T: + """ + Converts a tuple (including nested tuples) to a dataclass instance. If cls is not a dataclass, + then the data will just be passed through this function. + + Arguments + --------- + cls: type[T] + The dataclass type to which the tuple data is to be converted. + tuple_data: Any | Tuple[Any, ...] + A tuple (or nested tuple) of values to convert into a dataclass instance. + + Returns + ------- + T + Either an instance of cls populated with data from tuple_data or tuple_data itself. + """ + if not is_dataclass(cls): + return cast(T, tuple_data) + + field_types = {field.name: field.type for field in fields(cls)} + field_values = {} + + for (field_name, field_type), value in zip(field_types.items(), tuple_data): + field_type = structs.get(field_type, field_type) + if is_dataclass(field_type): + # Recursively convert nested tuples to nested dataclasses + field_values[field_name] = tuple_to_dataclass(field_type, structs, value) + elif isinstance(value, tuple) and not getattr(field_type, "_name", None) == "Tuple": + # If it's a tuple and the field is not intended to be a tuple, assume it's a nested dataclass + field_values[field_name] = tuple_to_dataclass(field_type, structs, value) + else: + # Otherwise, set the primitive value directly + field_values[field_name] = value + + return cls(**field_values) + + +def dataclass_to_tuple(instance: Any) -> Any: + """Convert a dataclass instance to a tuple, handling nested dataclasses. + If the input is not a dataclass, return the original value. + + Parameters + ---------- + instance : Any + The dataclass instance to convert to a tuple. If it is not it passes through. + + Returns + ------- + Any + either a tuple or the orginial value + """ + if not is_dataclass(instance): + return instance + + def convert_value(value: Any) -> Any: + """Convert nested dataclasses to tuples recursively, or return the original value.""" + if is_dataclass(value): + return dataclass_to_tuple(value) + return value + + return tuple(convert_value(getattr(instance, field.name)) for field in fields(instance)) + + +def rename_returned_types( + structs: dict[str, Any], return_types: list[Any] | Any, raw_values: list[str | int | tuple] | str | int | tuple +) -> tuple: + """Convert structs in the return value to known dataclasses. + + Parameters + ---------- + return_types : list[str] | str + The type or list of types returned from a contract. + raw_values : list[str | int | tuple] | str | int | tuple + The actual returned values from the contract. + + Returns + ------- + tup + _description_ + """ + # cover case of multiple return values + if isinstance(return_types, list): + # Ensure raw_values is a tuple for consistency + if not isinstance(raw_values, list): + raw_values = (raw_values,) + + # Convert the tuple to the dataclass instance using the utility function + converted_values = tuple( + tuple_to_dataclass(return_type, structs, value) for return_type, value in zip(return_types, raw_values) + ) + + return converted_values + + # cover case of single return value + converted_value = tuple_to_dataclass(return_types, structs, raw_values) + return converted_value diff --git a/crates/hyperdrivepy/python/hyperdrivepy/types.py b/crates/hyperdrivepy/python/hyperdrivepy/types.py index ed1e591..1243ad0 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/types.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/types.py @@ -3,6 +3,7 @@ # pylint: disable=invalid-name # We do not define the number of instance attributes # pylint: disable=too-many-instance-attributes +# pylint: disable=too-few-public-methods from __future__ import annotations from dataclasses import dataclass @@ -15,7 +16,8 @@ class Fees: curve: str flat: str - governance: str + governanceLP: str + governanceZombie: str @dataclass @@ -28,7 +30,6 @@ class PoolConfig: initialSharePrice: str minimumShareReserves: str minimumTransactionAmount: str - precisionThreshold: str positionDuration: str checkpointDuration: str timeStretch: str @@ -43,6 +44,7 @@ class PoolInfo: shareReserves: str shareAdjustment: str + zombieShareReserves: str bondReserves: str lpTotalSupply: str sharePrice: str @@ -84,7 +86,8 @@ class FeesType(Protocol): curve: int flat: int - governance: int + governanceLP: int + governanceZombie: int class PoolConfigType(Protocol): @@ -96,7 +99,6 @@ class PoolConfigType(Protocol): initialSharePrice: int minimumShareReserves: int minimumTransactionAmount: int - precisionThreshold: int positionDuration: int checkpointDuration: int timeStretch: int @@ -111,6 +113,7 @@ class PoolInfoType(Protocol): shareReserves: int shareAdjustment: int + zombieShareReserves: int lpTotalSupply: int sharePrice: int longsOutstanding: int diff --git a/crates/hyperdrivepy/python/hyperdrivepy/utils.py b/crates/hyperdrivepy/python/hyperdrivepy/utils.py index b9a39e0..52bb879 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/utils.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/utils.py @@ -23,7 +23,6 @@ def _serialize_pool_config( initialSharePrice=str(pool_config.initialSharePrice), minimumShareReserves=str(pool_config.minimumShareReserves), minimumTransactionAmount=str(pool_config.minimumTransactionAmount), - precisionThreshold=str(pool_config.precisionThreshold), positionDuration=str(pool_config.positionDuration), checkpointDuration=str(pool_config.checkpointDuration), timeStretch=str(pool_config.timeStretch), @@ -32,7 +31,8 @@ def _serialize_pool_config( fees=types.Fees( curve=str(pool_config.fees.curve), flat=str(pool_config.fees.flat), - governance=str(pool_config.fees.governance), + governanceLP=str(pool_config.fees.governanceLP), + governanceZombie=str(pool_config.fees.governanceZombie), ), ) @@ -41,6 +41,7 @@ def _serialize_pool_info(pool_info: types.PoolInfoType) -> types.PoolInfo: return types.PoolInfo( shareReserves=str(pool_info.shareReserves), shareAdjustment=str(pool_info.shareAdjustment), + zombieShareReserves=str(pool_info.zombieShareReserves), bondReserves=str(pool_info.bondReserves), lpTotalSupply=str(pool_info.lpTotalSupply), sharePrice=str(pool_info.sharePrice), diff --git a/crates/hyperdrivepy/setup.py b/crates/hyperdrivepy/setup.py index 5f87dab..e3e61d2 100644 --- a/crates/hyperdrivepy/setup.py +++ b/crates/hyperdrivepy/setup.py @@ -4,7 +4,7 @@ setup( name="hyperdrivepy", - version="0.3.0", + version="0.4.0", packages=["hyperdrivepy"], package_dir={"": "python"}, rust_extensions=[ diff --git a/crates/hyperdrivepy/src/hyperdrive_state_methods.rs b/crates/hyperdrivepy/src/hyperdrive_state_methods.rs index c182e2d..8b4c3a9 100644 --- a/crates/hyperdrivepy/src/hyperdrive_state_methods.rs +++ b/crates/hyperdrivepy/src/hyperdrive_state_methods.rs @@ -43,15 +43,6 @@ impl HyperdriveState { return Ok(result); } - pub fn get_long_amount(&self, base_amount: &str) -> PyResult { - let base_amount_fp = FixedPoint::from(U256::from_dec_str(base_amount).map_err(|_| { - PyErr::new::("Failed to convert base_amount string to U256") - })?); - let result_fp = self.state.get_long_amount(base_amount_fp); - let result = U256::from(result_fp).to_string(); - return Ok(result); - } - pub fn get_spot_price(&self) -> PyResult { let result_fp = self.state.get_spot_price(); let result = U256::from(result_fp).to_string(); @@ -64,7 +55,37 @@ impl HyperdriveState { return Ok(result); } - pub fn get_short_deposit( + pub fn calculate_open_long(&self, base_amount: &str) -> PyResult { + let base_amount_fp = FixedPoint::from(U256::from_dec_str(base_amount).map_err(|_| { + PyErr::new::("Failed to convert base_amount string to U256") + })?); + let result_fp = self.state.calculate_open_long(base_amount_fp); + let result = U256::from(result_fp).to_string(); + return Ok(result); + } + + pub fn calculate_close_long( + &self, + bond_amount: &str, + normalized_time_remaining: &str, + ) -> PyResult { + let bond_amount_fp = FixedPoint::from(U256::from_dec_str(bond_amount).map_err(|_| { + PyErr::new::("Failed to convert bond_amount string to U256") + })?); + let normalized_time_remaining_fp = + FixedPoint::from(U256::from_dec_str(normalized_time_remaining).map_err(|_| { + PyErr::new::( + "Failed to convert normalized_time_remaining string to U256", + ) + })?); + let result_fp = self + .state + .calculate_close_long(bond_amount_fp, normalized_time_remaining_fp); + let result = U256::from(result_fp).to_string(); + return Ok(result); + } + + pub fn calculate_open_short( &self, short_amount: &str, spot_price: &str, @@ -82,12 +103,46 @@ impl HyperdriveState { })?); let result_fp = self .state - .get_short_deposit(short_amount_fp, spot_price_fp, open_share_price_fp) + .calculate_open_short(short_amount_fp, spot_price_fp, open_share_price_fp) .unwrap(); let result = U256::from(result_fp).to_string(); return Ok(result); } + pub fn calculate_close_short( + &self, + bond_amount: &str, + open_share_price: &str, + close_share_price: &str, + normalized_time_remaining: &str, + ) -> PyResult { + let bond_amount_fp = FixedPoint::from(U256::from_dec_str(bond_amount).map_err(|_| { + PyErr::new::("Failed to convert bond_amount string to U256") + })?); + let open_share_price_fp = + FixedPoint::from(U256::from_dec_str(open_share_price).map_err(|_| { + PyErr::new::("Failed to convert open_share_price string to U256") + })?); + let close_share_price_fp = + FixedPoint::from(U256::from_dec_str(close_share_price).map_err(|_| { + PyErr::new::("Failed to convert close_share_price string to U256") + })?); + let normalized_time_remaining_fp = + FixedPoint::from(U256::from_dec_str(normalized_time_remaining).map_err(|_| { + PyErr::new::( + "Failed to convert normalized_time_remaining string to U256", + ) + })?); + let result_fp = self.state.calculate_close_short( + bond_amount_fp, + open_share_price_fp, + close_share_price_fp, + normalized_time_remaining_fp, + ); + let result = U256::from(result_fp).to_string(); + return Ok(result); + } + pub fn calculate_bonds_out_given_shares_in_down(&self, amount_in: &str) -> PyResult { let amount_in_fp = FixedPoint::from(U256::from_dec_str(amount_in).map_err(|_| { PyErr::new::("Failed to convert amount_in string to U256") @@ -132,24 +187,6 @@ impl HyperdriveState { return Ok(result); } - pub fn calculate_max_buy(&self) -> PyResult { - let result_fp = self.state.calculate_max_buy(); - let result = U256::from(result_fp).to_string(); - return Ok(result); - } - - pub fn calculate_max_sell(&self, minimum_share_reserves: &str) -> PyResult { - let minimum_share_reserves_fp = - FixedPoint::from(U256::from_dec_str(minimum_share_reserves).map_err(|_| { - PyErr::new::( - "Failed to convert minimum_share_reserves string to U256", - ) - })?); - let result_fp = self.state.calculate_max_sell(minimum_share_reserves_fp); - let result = U256::from(result_fp).to_string(); - return Ok(result); - } - pub fn to_checkpoint(&self, time: &str) -> PyResult { let time_int = U256::from_dec_str(time) .map_err(|_| PyErr::new::("Failed to convert time string to U256"))?; @@ -217,4 +254,18 @@ impl HyperdriveState { let result = U256::from(result_fp).to_string(); return Ok(result); } + + pub fn calculate_present_value(&self, current_block_timestamp: &str) -> PyResult { + let current_block_timestamp_int = + U256::from_dec_str(current_block_timestamp).map_err(|_| { + PyErr::new::( + "Failed to convert current_block_timestamp string to U256", + ) + })?; + let result_fp = self + .state + .calculate_present_value(current_block_timestamp_int); + let result = U256::from(result_fp).to_string(); + return Ok(result); + } } diff --git a/crates/hyperdrivepy/src/pool_config.rs b/crates/hyperdrivepy/src/pool_config.rs index 8f34be1..3005b75 100644 --- a/crates/hyperdrivepy/src/pool_config.rs +++ b/crates/hyperdrivepy/src/pool_config.rs @@ -1,4 +1,7 @@ -use crate::{extract_address_from_attr, extract_bytes32_from_attr, extract_fees_from_attr, extract_u256_from_attr}; +use crate::{ + extract_address_from_attr, extract_bytes32_from_attr, extract_fees_from_attr, + extract_u256_from_attr, +}; use hyperdrive_wrappers::wrappers::i_hyperdrive::PoolConfig; use pyo3::prelude::*; @@ -15,12 +18,11 @@ impl PyPoolConfig { impl FromPyObject<'_> for PyPoolConfig { fn extract(ob: &PyAny) -> PyResult { let base_token = extract_address_from_attr(ob, "baseToken")?; - let linker_factory= extract_address_from_attr(ob, "linkerFactory")?; + let linker_factory = extract_address_from_attr(ob, "linkerFactory")?; let linker_code_hash = extract_bytes32_from_attr(ob, "linkerCodeHash")?; let initial_share_price = extract_u256_from_attr(ob, "initialSharePrice")?; let minimum_share_reserves = extract_u256_from_attr(ob, "minimumShareReserves")?; let minimum_transaction_amount = extract_u256_from_attr(ob, "minimumTransactionAmount")?; - let precision_threshold = extract_u256_from_attr(ob, "precisionThreshold")?; let position_duration = extract_u256_from_attr(ob, "positionDuration")?; let checkpoint_duration = extract_u256_from_attr(ob, "checkpointDuration")?; let time_stretch = extract_u256_from_attr(ob, "timeStretch")?; @@ -35,7 +37,6 @@ impl FromPyObject<'_> for PyPoolConfig { initial_share_price, minimum_share_reserves, minimum_transaction_amount, - precision_threshold, position_duration, checkpoint_duration, time_stretch, diff --git a/crates/hyperdrivepy/src/pool_info.rs b/crates/hyperdrivepy/src/pool_info.rs index 86313e3..2618ffa 100644 --- a/crates/hyperdrivepy/src/pool_info.rs +++ b/crates/hyperdrivepy/src/pool_info.rs @@ -16,6 +16,7 @@ impl FromPyObject<'_> for PyPoolInfo { fn extract(ob: &PyAny) -> PyResult { let share_reserves = extract_u256_from_attr(ob, "shareReserves")?; let share_adjustment = extract_i256_from_attr(ob, "shareAdjustment")?; + let zombie_share_reserves = extract_u256_from_attr(ob, "zombieShareReserves")?; let bond_reserves = extract_u256_from_attr(ob, "bondReserves")?; let lp_total_supply = extract_u256_from_attr(ob, "lpTotalSupply")?; let share_price = extract_u256_from_attr(ob, "sharePrice")?; @@ -32,6 +33,7 @@ impl FromPyObject<'_> for PyPoolInfo { let pool_info = PoolInfo { share_reserves, share_adjustment, + zombie_share_reserves, bond_reserves, lp_total_supply, share_price, diff --git a/crates/hyperdrivepy/src/utils.rs b/crates/hyperdrivepy/src/utils.rs index 70917b5..4646f52 100644 --- a/crates/hyperdrivepy/src/utils.rs +++ b/crates/hyperdrivepy/src/utils.rs @@ -1,4 +1,4 @@ -use ethers::core::types::{Address, I256, U256, H256}; +use ethers::core::types::{Address, H256, I256, U256}; use hyperdrive_wrappers::wrappers::i_hyperdrive::Fees; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; @@ -39,11 +39,13 @@ pub fn extract_fees_from_attr(ob: &PyAny, attr: &str) -> PyResult { let curve = extract_u256_from_attr(&fees_obj, "curve")?; let flat = extract_u256_from_attr(&fees_obj, "flat")?; - let governance = extract_u256_from_attr(&fees_obj, "governance")?; + let governance_lp = extract_u256_from_attr(&fees_obj, "governanceLP")?; + let governance_zombie = extract_u256_from_attr(&fees_obj, "governanceZombie")?; Ok(Fees { curve, flat, - governance, + governance_lp, + governance_zombie, }) } diff --git a/pyproject.toml b/pyproject.toml index ba81b28..89d3ea4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperdrivepy" -version = "0.3.0" +version = "0.4.0" authors = [ { name = "Dylan Paiton", email = "dylan@delv.tech" }, { name = "Matthew Brown", email = "matt@delv.tech" }, @@ -21,12 +21,29 @@ max-line-length = "120" line-length = "120" extend-exclude = "\\.ipynb" -[tool.pylint] -exclude = ["hyperdrive", ".venv", ".vscode", "docs"] - -[tool.pylance] -exclude = ["hyperdrive", ".venv", ".vscode", "docs"] +[tool.pylint.MASTER] +ignore = [ + "hyperdrive", + ".venv", + ".vscode", + "docs", + "pypechain_types" +] +notes = ["FIXME"] +max-line-length = 120 +ignore-docstrings = 'no' +ignore-imports = 'no' +disable='duplicate-code' +extension-pkg-allow-list="hyperdrivepy" [tool.pyright] -exclude = ["hyperdrive", ".venv", ".vscode", "docs"] +include = ["crates/hyperdrivepy"] +exclude = [ + "hyperdrive", + ".venv", + ".vscode", + "docs", + "**/pypechain_types", + "**/__pycache__" +] reportMissingImports = false \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 5575b63..44576eb 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,7 +4,7 @@ cibuildwheel jinja2 platformdirs pylint -pypechain +pypechain[all] pyright pytest setuptools diff --git a/system_tests/wrapper_tests.py b/system_tests/wrapper_tests.py index 40b676a..15bcf41 100644 --- a/system_tests/wrapper_tests.py +++ b/system_tests/wrapper_tests.py @@ -1,7 +1,7 @@ """Tests for hyperdrive_math.rs wrappers""" import hyperdrivepy import pytest -from hyperdrivepy.pypechain_types.IHyperdriveTypes import Fees, PoolConfig, PoolInfo +from hyperdrivepy.pypechain_types.IERC4626HyperdriveTypes import Fees, PoolConfig, PoolInfo POOL_CONFIG = PoolConfig( baseToken="0x1234567890abcdef1234567890abcdef12345678", @@ -10,19 +10,19 @@ initialSharePrice=1 * 10**18, # 1e18 minimumShareReserves=1 * 10**17, # 0.1e18 minimumTransactionAmount=1 * 10**16, # 0.001e18 - precisionThreshold=1 * 10**14, positionDuration=604_800, checkpointDuration=86_400, timeStretch=1 * 10**17, # 0.1e18 governance="0xabcdef1234567890abcdef1234567890abcdef12", feeCollector="0xfedcba0987654321fedcba0987654321fedcba09", - fees=Fees(curve=0, flat=0, governance=0), + fees=Fees(curve=0, flat=0, governanceLP=0, governanceZombie=0), ) POOL_INFO = PoolInfo( shareReserves=1_000_000 * 10**18, shareAdjustment=0, + zombieShareReserves=0, bondReserves=2_000_000 * 10**18, lpTotalSupply=3_000_000 * 10**18, sharePrice=1 * 10**18, @@ -151,42 +151,51 @@ def test_calculate_shares_out_given_bonds_in_down(): assert int(out) > 0 -def test_calculate_max_buy(): - """Test calculate_max_buy.""" - out = hyperdrivepy.calculate_max_buy(POOL_CONFIG, POOL_INFO) - assert int(out) > 0 - - -def test_calculate_max_sell(): - """Test calculate_max_buy.""" - minimum_share_reserves = str(10 * 10**18) - out = hyperdrivepy.calculate_max_sell(POOL_CONFIG, POOL_INFO, minimum_share_reserves) - assert int(out) > 0 - - -def test_get_long_amount(): - """Test for get_long_amount.""" +def test_calculate_open_long(): + """Test for calculate_open_long.""" base_amount = str(500 * 10**18) - long_amount = hyperdrivepy.get_long_amount(POOL_CONFIG, POOL_INFO, base_amount) + long_amount = hyperdrivepy.calculate_open_long(POOL_CONFIG, POOL_INFO, base_amount) assert int(long_amount) > 0 -def test_get_short_deposit(): - """Test for get_long_amount.""" +def test_calculate_close_long(): + """Test for calculate_close_long.""" + bond_amount = str(500 * 10**18) + normalized_time_remaining = str(9 * 10**17) + shares_returned = hyperdrivepy.calculate_close_long(POOL_CONFIG, POOL_INFO, bond_amount, normalized_time_remaining) + assert int(shares_returned) > 0 + + +def test_calculate_open_short(): + """Test for calculate_open_short.""" short_amount = str(50 * 10**18) spot_price = hyperdrivepy.get_spot_price(POOL_CONFIG, POOL_INFO) open_share_price = str(9 * 10**17) - base_required = hyperdrivepy.get_short_deposit(POOL_CONFIG, POOL_INFO, short_amount, spot_price, open_share_price) + base_required = hyperdrivepy.calculate_open_short( + POOL_CONFIG, POOL_INFO, short_amount, spot_price, open_share_price + ) assert int(base_required) > 0 - base_required_default_share_price = hyperdrivepy.get_short_deposit( + base_required_default_share_price = hyperdrivepy.calculate_open_short( POOL_CONFIG, POOL_INFO, short_amount, spot_price, None ) assert int(base_required_default_share_price) > 0 - assert base_required_default_share_price == hyperdrivepy.get_short_deposit( + assert base_required_default_share_price == hyperdrivepy.calculate_open_short( POOL_CONFIG, POOL_INFO, short_amount, spot_price, "0" ) +def test_calculate_close_short(): + """Test for calculate_close_short.""" + short_amount = str(50 * 10**18) + open_share_price = str(8 * 10**17) + close_share_price = str(9 * 10**17) + normalized_time_remaining = str(9 * 10**17) + shares_received = hyperdrivepy.calculate_close_short( + POOL_CONFIG, POOL_INFO, short_amount, open_share_price, close_share_price, normalized_time_remaining + ) + assert int(shares_received) > 0 + + def test_max_long(): """Test get_max_long.""" budget = "1000000000000000000" # 1 base @@ -275,3 +284,10 @@ def test_max_short_fail_conversion(): conservative_price, max_iterations, ) + + +def test_calculate_present_value(): + """Test calculate_present_value.""" + current_block_timestamp = str(1000) + present_value = hyperdrivepy.calculate_present_value(POOL_CONFIG, POOL_INFO, current_block_timestamp) + assert int(present_value) > 0