Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
Hyperdrivepy to v1.0.3 (#98)
Browse files Browse the repository at this point in the history
Update for Hyperdrive v1.0.2
  • Loading branch information
slundqui authored Apr 19, 2024
1 parent 78b3341 commit a150d9d
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v1.0.1"
ref: "v1.0.2"
path: "./hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v1.0.1"
ref: "v1.0.2"
path: "./hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v1.0.1"
ref: "v1.0.2"
path: "./hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v1.0.1"
ref: "v1.0.2"
path: "./hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/hyperdrivepy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "hyperdrivepy"
edition = "2021"
version = "1.0.2"
version = "1.0.3"
authors = [
"Dylan Paiton",
"Matt Brown",
Expand Down
2 changes: 1 addition & 1 deletion crates/hyperdrivepy/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hyperdrivepy"
version = "1.0.2"
version = "1.0.3"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Rust",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from __future__ import annotations

from typing import Any, Iterable, NamedTuple, Sequence, Type, cast
from typing import Any, Iterable, NamedTuple, Sequence, Type, cast, overload

from eth_abi.codec import ABICodec
from eth_abi.registry import registry as default_registry
Expand Down Expand Up @@ -663,14 +663,12 @@ def call(
return cast(list[bytes], rename_returned_types(structs, return_types, raw_values))


class IHyperdriveNameContractFunction(ContractFunction):
class IHyperdriveNameContractFunction0(ContractFunction):
"""ContractFunction for the name method."""

def __call__(self, tokenId: int) -> IHyperdriveNameContractFunction: # type: ignore
clone = super().__call__(dataclass_to_tuple(tokenId))
self.kwargs = clone.kwargs
self.args = clone.args
return self
super().__call__() # type: ignore
return cast(IHyperdriveNameContractFunction, self)

def call(
self,
Expand All @@ -685,11 +683,58 @@ def 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 IHyperdriveNameContractFunction1(ContractFunction):
"""ContractFunction for the name method."""

def __call__(self) -> IHyperdriveNameContractFunction: # type: ignore
super().__call__() # type: ignore
return cast(IHyperdriveNameContractFunction, 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 IHyperdriveNameContractFunction(ContractFunction):
"""ContractFunction for the name method."""

# super() call methods are generic, while our version adds values & types
# pylint: disable=arguments-differ# disable this warning when there is overloading
# pylint: disable=function-redefined

@overload
def __call__(self, tokenId: int) -> IHyperdriveNameContractFunction0: # type: ignore
...

@overload
def __call__(self) -> IHyperdriveNameContractFunction1: # type: ignore
...

def __call__(self, *args) -> IHyperdriveNameContractFunction: # type: ignore
clone = super().__call__(*(dataclass_to_tuple(arg) for arg in args))
self.kwargs = clone.kwargs
self.args = clone.args
return self # type: ignore


class IHyperdriveNoncesContractFunction(ContractFunction):
"""ContractFunction for the nonces method."""

Expand Down Expand Up @@ -1391,6 +1436,33 @@ def call(
return cast(str, rename_returned_types(structs, return_types, raw_values))


class IHyperdriveVersionContractFunction(ContractFunction):
"""ContractFunction for the version method."""

def __call__(self) -> IHyperdriveVersionContractFunction: # 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 IHyperdriveContractFunctions(ContractFunctions):
"""ContractFunctions for the IHyperdrive contract."""

Expand Down Expand Up @@ -1492,6 +1564,8 @@ class IHyperdriveContractFunctions(ContractFunctions):

vaultSharesToken: IHyperdriveVaultSharesTokenContractFunction

version: IHyperdriveVersionContractFunction

def __init__(
self,
abi: ABI,
Expand Down Expand Up @@ -1892,6 +1966,14 @@ def __init__(
decode_tuples=decode_tuples,
function_identifier="vaultSharesToken",
)
self.version = IHyperdriveVersionContractFunction.factory(
"version",
w3=w3,
contract_abi=abi,
address=address,
decode_tuples=decode_tuples,
function_identifier="version",
)


class IHyperdriveAddLiquidityContractEvent(ContractEvent):
Expand Down Expand Up @@ -5989,6 +6071,13 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]:
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
"stateMutability": "view",
},
{
"type": "function",
"name": "name",
"inputs": [],
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
"stateMutability": "pure",
},
{
"type": "function",
"name": "nonces",
Expand Down Expand Up @@ -6275,6 +6364,13 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]:
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
"stateMutability": "view",
},
{
"type": "function",
"name": "version",
"inputs": [],
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
"stateMutability": "pure",
},
{
"type": "event",
"name": "AddLiquidity",
Expand Down
2 changes: 1 addition & 1 deletion crates/hyperdrivepy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="hyperdrivepy",
version="1.0.2",
version="1.0.3",
packages=["hyperdrivepy"],
package_dir={"": "python"},
rust_extensions=[
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hyperdrivepy"
version = "1.0.2"
version = "1.0.3"
authors = [
{ name = "Dylan Paiton", email = "dylan@delv.tech" },
{ name = "Matthew Brown", email = "matt@delv.tech" },
Expand Down

0 comments on commit a150d9d

Please sign in to comment.