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

Commit

Permalink
Update for hyperdrive v0.7.0 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui authored Jan 29, 2024
1 parent ee5e623 commit f8a2cb5
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_linux_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v0.6.0"
ref: "v0.7.0"
path: "./hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v0.6.0"
ref: "v0.7.0"
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 @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v0.6.0"
ref: "v0.7.0"
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 @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@master
with:
repository: delvtech/hyperdrive
ref: "v0.6.0"
ref: "v0.7.0"
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 = "0.6.0"
version = "0.7.0"
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 = "0.6.0"
version = "0.7.0"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Rust",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,33 @@ def call(
return cast(bool, rename_returned_types(structs, return_types, raw_values))


class IERC4626HyperdriveIsPauserContractFunction(ContractFunction):
"""ContractFunction for the isPauser method."""

def __call__(self, account: str) -> IERC4626HyperdriveIsPauserContractFunction: # type: ignore
clone = super().__call__(dataclass_to_tuple(account))
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."""

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


class IERC4626HyperdriveTarget4ContractFunction(ContractFunction):
"""ContractFunction for the target4 method."""

def __call__(self) -> IERC4626HyperdriveTarget4ContractFunction: # 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."""

Expand Down Expand Up @@ -1299,6 +1353,8 @@ class IERC4626HyperdriveContractFunctions(ContractFunctions):

isApprovedForAll: IERC4626HyperdriveIsApprovedForAllContractFunction

isPauser: IERC4626HyperdriveIsPauserContractFunction

load: IERC4626HyperdriveLoadContractFunction

name: IERC4626HyperdriveNameContractFunction
Expand Down Expand Up @@ -1341,6 +1397,8 @@ class IERC4626HyperdriveContractFunctions(ContractFunctions):

target3: IERC4626HyperdriveTarget3ContractFunction

target4: IERC4626HyperdriveTarget4ContractFunction

totalSupply: IERC4626HyperdriveTotalSupplyContractFunction

transferFrom: IERC4626HyperdriveTransferFromContractFunction
Expand Down Expand Up @@ -1509,6 +1567,14 @@ def __init__(
decode_tuples=decode_tuples,
function_identifier="isApprovedForAll",
)
self.isPauser = IERC4626HyperdriveIsPauserContractFunction.factory(
"isPauser",
w3=w3,
contract_abi=abi,
address=address,
decode_tuples=decode_tuples,
function_identifier="isPauser",
)
self.load = IERC4626HyperdriveLoadContractFunction.factory(
"load",
w3=w3,
Expand Down Expand Up @@ -1677,6 +1743,14 @@ def __init__(
decode_tuples=decode_tuples,
function_identifier="target3",
)
self.target4 = IERC4626HyperdriveTarget4ContractFunction.factory(
"target4",
w3=w3,
contract_abi=abi,
address=address,
decode_tuples=decode_tuples,
function_identifier="target4",
)
self.totalSupply = IERC4626HyperdriveTotalSupplyContractFunction.factory(
"totalSupply",
w3=w3,
Expand Down Expand Up @@ -2547,6 +2621,82 @@ def create_filter( # type: ignore
)


class IERC4626HyperdrivePauseStatusUpdatedContractEvent(ContractEvent):
"""ContractEvent for PauseStatusUpdated."""

# 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: "IERC4626HyperdrivePauseStatusUpdatedContractEvent",
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["IERC4626HyperdrivePauseStatusUpdatedContractEvent"],
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: "IERC4626HyperdrivePauseStatusUpdatedContractEvent",
*, # 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["IERC4626HyperdrivePauseStatusUpdatedContractEvent"],
*, # 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 IERC4626HyperdrivePauserUpdatedContractEvent(ContractEvent):
"""ContractEvent for PauserUpdated."""

Expand Down Expand Up @@ -2876,6 +3026,8 @@ class IERC4626HyperdriveContractEvents(ContractEvents):

OpenShort: IERC4626HyperdriveOpenShortContractEvent

PauseStatusUpdated: IERC4626HyperdrivePauseStatusUpdatedContractEvent

PauserUpdated: IERC4626HyperdrivePauserUpdatedContractEvent

RedeemWithdrawalShares: IERC4626HyperdriveRedeemWithdrawalSharesContractEvent
Expand Down Expand Up @@ -2957,6 +3109,12 @@ def __init__(
"OpenShort", w3=w3, contract_abi=abi, address=address, event_name="OpenShort"
),
)
self.PauseStatusUpdated = cast(
IERC4626HyperdrivePauseStatusUpdatedContractEvent,
IERC4626HyperdrivePauseStatusUpdatedContractEvent.factory(
"PauseStatusUpdated", w3=w3, contract_abi=abi, address=address, event_name="PauseStatusUpdated"
),
)
self.PauserUpdated = cast(
IERC4626HyperdrivePauserUpdatedContractEvent,
IERC4626HyperdrivePauserUpdatedContractEvent.factory(
Expand Down Expand Up @@ -3287,6 +3445,13 @@ def __init__(
"outputs": [{"name": "", "type": "bool", "internalType": "bool"}],
"stateMutability": "view",
},
{
"type": "function",
"name": "isPauser",
"inputs": [{"name": "_account", "type": "address", "internalType": "address"}],
"outputs": [{"name": "", "type": "bool", "internalType": "bool"}],
"stateMutability": "view",
},
{
"type": "function",
"name": "load",
Expand Down Expand Up @@ -3527,6 +3692,13 @@ def __init__(
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
"stateMutability": "view",
},
{
"type": "function",
"name": "target4",
"inputs": [],
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
"stateMutability": "view",
},
{
"type": "function",
"name": "totalSupply",
Expand Down Expand Up @@ -3689,6 +3861,12 @@ def __init__(
],
"anonymous": False,
},
{
"type": "event",
"name": "PauseStatusUpdated",
"inputs": [{"name": "isPaused", "type": "bool", "indexed": False, "internalType": "bool"}],
"anonymous": False,
},
{
"type": "event",
"name": "PauserUpdated",
Expand Down Expand Up @@ -3733,8 +3911,10 @@ def __init__(
},
{"type": "error", "name": "BatchInputLengthMismatch", "inputs": []},
{"type": "error", "name": "BelowMinimumContribution", "inputs": []},
{"type": "error", "name": "DecreasedPresentValueWhenAddingLiquidity", "inputs": []},
{"type": "error", "name": "ExpInvalidExponent", "inputs": []},
{"type": "error", "name": "ExpiredDeadline", "inputs": []},
{"type": "error", "name": "InsufficientBalance", "inputs": []},
{
"type": "error",
"name": "InsufficientLiquidity",
Expand All @@ -3744,14 +3924,10 @@ def __init__(
},
{"type": "error", "name": "InvalidApr", "inputs": []},
{"type": "error", "name": "InvalidBaseToken", "inputs": []},
{"type": "error", "name": "InvalidCheckpointDuration", "inputs": []},
{"type": "error", "name": "InvalidCheckpointTime", "inputs": []},
{"type": "error", "name": "InvalidERC20Bridge", "inputs": []},
{"type": "error", "name": "InvalidFeeAmounts", "inputs": []},
{"type": "error", "name": "InvalidFeeDestination", "inputs": []},
{"type": "error", "name": "InvalidInitialVaultSharePrice", "inputs": []},
{"type": "error", "name": "InvalidMinimumShareReserves", "inputs": []},
{"type": "error", "name": "InvalidPositionDuration", "inputs": []},
{"type": "error", "name": "InvalidShareReserves", "inputs": []},
{"type": "error", "name": "InvalidSignature", "inputs": []},
{"type": "error", "name": "InvalidTimestamp", "inputs": []},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@
type="event",
)

PauseStatusUpdated = ABIEvent(
anonymous=False,
inputs=[
ABIEventParams(indexed=False, name="isPaused", type="bool"),
],
name="PauseStatusUpdated",
type="event",
)

PauserUpdated = ABIEvent(
anonymous=False,
inputs=[
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="0.6.0",
version="0.7.0",
packages=["hyperdrivepy"],
package_dir={"": "python"},
rust_extensions=[
Expand Down

0 comments on commit f8a2cb5

Please sign in to comment.