diff --git a/.github/workflows/build_linux_wheel.yml b/.github/workflows/build_linux_wheel.yml index 51315a1..3b76fd4 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.8.0" + ref: "v0.9.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 413dd3b..b05218b 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.8.0" + ref: "v0.9.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ca2445d..13c580e 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.8.0" + ref: "v0.9.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 26b2db5..5290e9d 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.8.0" + ref: "v0.9.0" path: "./hyperdrive" ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }} diff --git a/Cargo.lock b/Cargo.lock index 0134950..3d35423 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1588,7 +1588,7 @@ dependencies = [ [[package]] name = "hyperdrivepy" -version = "0.8.0" +version = "0.9.0" dependencies = [ "ethers", "eyre", diff --git a/crates/hyperdrivepy/Cargo.toml b/crates/hyperdrivepy/Cargo.toml index 134b2fa..04b424c 100644 --- a/crates/hyperdrivepy/Cargo.toml +++ b/crates/hyperdrivepy/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "hyperdrivepy" edition = "2021" -version = "0.8.0" +version = "0.9.0" authors = [ "Dylan Paiton", "Matt Brown", diff --git a/crates/hyperdrivepy/pyproject.toml b/crates/hyperdrivepy/pyproject.toml index f040bea..5c7e3e4 100644 --- a/crates/hyperdrivepy/pyproject.toml +++ b/crates/hyperdrivepy/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperdrivepy" -version = "0.8.0" +version = "0.9.0" requires-python = ">=3.7" classifiers = [ "Programming Language :: Rust", diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py index 755e3f1..02d30b0 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveContract.py @@ -61,33 +61,6 @@ } -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.""" @@ -366,6 +339,33 @@ def call( return cast(int, rename_returned_types(structs, return_types, raw_values)) +class IERC4626HyperdriveDomainSeparatorContractFunction(ContractFunction): + """ContractFunction for the domainSeparator method.""" + + def __call__(self) -> IERC4626HyperdriveDomainSeparatorContractFunction: # 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 IERC4626HyperdriveGetCheckpointContractFunction(ContractFunction): """ContractFunction for the getCheckpoint method.""" @@ -666,8 +666,8 @@ def call( class IERC4626HyperdriveNameContractFunction(ContractFunction): """ContractFunction for the name method.""" - def __call__(self, _id: int) -> IERC4626HyperdriveNameContractFunction: # type: ignore - clone = super().__call__(dataclass_to_tuple(_id)) + def __call__(self, tokenId: int) -> IERC4626HyperdriveNameContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(tokenId)) self.kwargs = clone.kwargs self.args = clone.args return self @@ -723,8 +723,8 @@ class IERC4626HyperdriveOpenLongContractFunction(ContractFunction): class ReturnValues(NamedTuple): """The return named tuple for OpenLong.""" - maturityTime: int - bondProceeds: int + arg1: int + arg2: int def __call__(self, amount: int, minOutput: int, minVaultSharePrice: int, options: Options) -> IERC4626HyperdriveOpenLongContractFunction: # type: ignore clone = super().__call__( @@ -761,8 +761,8 @@ class IERC4626HyperdriveOpenShortContractFunction(ContractFunction): class ReturnValues(NamedTuple): """The return named tuple for OpenShort.""" - maturityTime: int - traderDeposit: int + arg1: int + arg2: int def __call__(self, bondAmount: int, maxDeposit: int, minVaultSharePrice: int, options: Options) -> IERC4626HyperdriveOpenShortContractFunction: # type: ignore clone = super().__call__( @@ -878,8 +878,8 @@ class IERC4626HyperdriveRedeemWithdrawalSharesContractFunction(ContractFunction) class ReturnValues(NamedTuple): """The return named tuple for RedeemWithdrawalShares.""" - proceeds: int - withdrawalSharesRedeemed: int + arg1: int + arg2: int def __call__(self, withdrawalShares: int, minOutputPerShare: int, options: Options) -> IERC4626HyperdriveRedeemWithdrawalSharesContractFunction: # type: ignore clone = super().__call__( @@ -913,8 +913,8 @@ class IERC4626HyperdriveRemoveLiquidityContractFunction(ContractFunction): class ReturnValues(NamedTuple): """The return named tuple for RemoveLiquidity.""" - proceeds: int - withdrawalShares: int + arg1: int + arg2: int def __call__(self, lpShares: int, minOutputPerShare: int, options: Options) -> IERC4626HyperdriveRemoveLiquidityContractFunction: # type: ignore clone = super().__call__( @@ -1082,8 +1082,8 @@ def call( class IERC4626HyperdriveSymbolContractFunction(ContractFunction): """ContractFunction for the symbol method.""" - def __call__(self, _id: int) -> IERC4626HyperdriveSymbolContractFunction: # type: ignore - clone = super().__call__(dataclass_to_tuple(_id)) + def __call__(self, tokenId: int) -> IERC4626HyperdriveSymbolContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(tokenId)) self.kwargs = clone.kwargs self.args = clone.args return self @@ -1244,8 +1244,8 @@ def call( class IERC4626HyperdriveTotalSupplyContractFunction(ContractFunction): """ContractFunction for the totalSupply method.""" - def __call__(self, _id: int) -> IERC4626HyperdriveTotalSupplyContractFunction: # type: ignore - clone = super().__call__(dataclass_to_tuple(_id)) + def __call__(self, tokenId: int) -> IERC4626HyperdriveTotalSupplyContractFunction: # type: ignore + clone = super().__call__(dataclass_to_tuple(tokenId)) self.kwargs = clone.kwargs self.args = clone.args return self @@ -1350,8 +1350,6 @@ def call( class IERC4626HyperdriveContractFunctions(ContractFunctions): """ContractFunctions for the IERC4626Hyperdrive contract.""" - DOMAIN_SEPARATOR: IERC4626HyperdriveDOMAIN_SEPARATORContractFunction - PERMIT_TYPEHASH: IERC4626HyperdrivePERMIT_TYPEHASHContractFunction addLiquidity: IERC4626HyperdriveAddLiquidityContractFunction @@ -1372,6 +1370,8 @@ class IERC4626HyperdriveContractFunctions(ContractFunctions): decimals: IERC4626HyperdriveDecimalsContractFunction + domainSeparator: IERC4626HyperdriveDomainSeparatorContractFunction + getCheckpoint: IERC4626HyperdriveGetCheckpointContractFunction getCheckpointExposure: IERC4626HyperdriveGetCheckpointExposureContractFunction @@ -1452,14 +1452,6 @@ def __init__( 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, @@ -1540,6 +1532,14 @@ def __init__( decode_tuples=decode_tuples, function_identifier="decimals", ) + self.domainSeparator = IERC4626HyperdriveDomainSeparatorContractFunction.factory( + "domainSeparator", + w3=w3, + contract_abi=abi, + address=address, + decode_tuples=decode_tuples, + function_identifier="domainSeparator", + ) self.getCheckpoint = IERC4626HyperdriveGetCheckpointContractFunction.factory( "getCheckpoint", w3=w3, @@ -3357,6 +3357,63 @@ def decode_error_data( # type: ignore return decoded +class IERC4626HyperdriveDistributeExcessIdleFailedContractError: + """ContractError for DistributeExcessIdleFailed.""" + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # 4 byte error selector + selector: str + # error signature, i.e. CustomError(uint256,bool) + signature: str + + # pylint: disable=useless-parent-delegation + def __init__( + self: "IERC4626HyperdriveDistributeExcessIdleFailedContractError", + ) -> None: + self.selector = "0x8bdf918d" + self.signature = "DistributeExcessIdleFailed()" + + def decode_error_data( # type: ignore + self: "IERC4626HyperdriveDistributeExcessIdleFailedContractError", + data: HexBytes, + # TODO: instead of returning a tuple, return a dataclass with the input names and types just like we do for functions + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "DistributeExcessIdleFailed" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + @classmethod + def decode_error_data( # type: ignore + cls: Type["IERC4626HyperdriveDistributeExcessIdleFailedContractError"], + data: HexBytes, + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "DistributeExcessIdleFailed" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + class IERC4626HyperdriveExpInvalidExponentContractError: """ContractError for ExpInvalidExponent.""" @@ -3927,6 +3984,120 @@ def decode_error_data( # type: ignore return decoded +class IERC4626HyperdriveInvalidLPSharePriceContractError: + """ContractError for InvalidLPSharePrice.""" + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # 4 byte error selector + selector: str + # error signature, i.e. CustomError(uint256,bool) + signature: str + + # pylint: disable=useless-parent-delegation + def __init__( + self: "IERC4626HyperdriveInvalidLPSharePriceContractError", + ) -> None: + self.selector = "0xabeba7ee" + self.signature = "InvalidLPSharePrice()" + + def decode_error_data( # type: ignore + self: "IERC4626HyperdriveInvalidLPSharePriceContractError", + data: HexBytes, + # TODO: instead of returning a tuple, return a dataclass with the input names and types just like we do for functions + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "InvalidLPSharePrice" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + @classmethod + def decode_error_data( # type: ignore + cls: Type["IERC4626HyperdriveInvalidLPSharePriceContractError"], + data: HexBytes, + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "InvalidLPSharePrice" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + +class IERC4626HyperdriveInvalidPresentValueContractError: + """ContractError for InvalidPresentValue.""" + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # 4 byte error selector + selector: str + # error signature, i.e. CustomError(uint256,bool) + signature: str + + # pylint: disable=useless-parent-delegation + def __init__( + self: "IERC4626HyperdriveInvalidPresentValueContractError", + ) -> None: + self.selector = "0xaa2c6516" + self.signature = "InvalidPresentValue()" + + def decode_error_data( # type: ignore + self: "IERC4626HyperdriveInvalidPresentValueContractError", + data: HexBytes, + # TODO: instead of returning a tuple, return a dataclass with the input names and types just like we do for functions + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "InvalidPresentValue" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + @classmethod + def decode_error_data( # type: ignore + cls: Type["IERC4626HyperdriveInvalidPresentValueContractError"], + data: HexBytes, + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "InvalidPresentValue" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + class IERC4626HyperdriveInvalidShareReservesContractError: """ContractError for InvalidShareReserves.""" @@ -4269,63 +4440,6 @@ def decode_error_data( # type: ignore return decoded -class IERC4626HyperdriveNegativePresentValueContractError: - """ContractError for NegativePresentValue.""" - - # @combomethod destroys return types, so we are redefining functions as both class and instance - # pylint: disable=function-redefined - - # 4 byte error selector - selector: str - # error signature, i.e. CustomError(uint256,bool) - signature: str - - # pylint: disable=useless-parent-delegation - def __init__( - self: "IERC4626HyperdriveNegativePresentValueContractError", - ) -> None: - self.selector = "0xaeeb825d" - self.signature = "NegativePresentValue()" - - def decode_error_data( # type: ignore - self: "IERC4626HyperdriveNegativePresentValueContractError", - data: HexBytes, - # TODO: instead of returning a tuple, return a dataclass with the input names and types just like we do for functions - ) -> tuple[Any, ...]: - """Decodes error data returns from a smart contract.""" - error_abi = cast( - ABIFunction, - [ - item - for item in ierc4626hyperdrive_abi - if item.get("name") == "NegativePresentValue" and item.get("type") == "error" - ][0], - ) - types = get_abi_input_types(error_abi) - abi_codec = ABICodec(default_registry) - decoded = abi_codec.decode(types, data) - return decoded - - @classmethod - def decode_error_data( # type: ignore - cls: Type["IERC4626HyperdriveNegativePresentValueContractError"], - data: HexBytes, - ) -> tuple[Any, ...]: - """Decodes error data returns from a smart contract.""" - error_abi = cast( - ABIFunction, - [ - item - for item in ierc4626hyperdrive_abi - if item.get("name") == "NegativePresentValue" and item.get("type") == "error" - ][0], - ) - types = get_abi_input_types(error_abi) - abi_codec = ABICodec(default_registry) - decoded = abi_codec.decode(types, data) - return decoded - - class IERC4626HyperdriveNotPayableContractError: """ContractError for NotPayable.""" @@ -4953,6 +5067,63 @@ def decode_error_data( # type: ignore return decoded +class IERC4626HyperdriveUnsafeCastToInt256ContractError: + """ContractError for UnsafeCastToInt256.""" + + # @combomethod destroys return types, so we are redefining functions as both class and instance + # pylint: disable=function-redefined + + # 4 byte error selector + selector: str + # error signature, i.e. CustomError(uint256,bool) + signature: str + + # pylint: disable=useless-parent-delegation + def __init__( + self: "IERC4626HyperdriveUnsafeCastToInt256ContractError", + ) -> None: + self.selector = "0x72dd4e02" + self.signature = "UnsafeCastToInt256()" + + def decode_error_data( # type: ignore + self: "IERC4626HyperdriveUnsafeCastToInt256ContractError", + data: HexBytes, + # TODO: instead of returning a tuple, return a dataclass with the input names and types just like we do for functions + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "UnsafeCastToInt256" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + @classmethod + def decode_error_data( # type: ignore + cls: Type["IERC4626HyperdriveUnsafeCastToInt256ContractError"], + data: HexBytes, + ) -> tuple[Any, ...]: + """Decodes error data returns from a smart contract.""" + error_abi = cast( + ABIFunction, + [ + item + for item in ierc4626hyperdrive_abi + if item.get("name") == "UnsafeCastToInt256" and item.get("type") == "error" + ][0], + ) + types = get_abi_input_types(error_abi) + abi_codec = ABICodec(default_registry) + decoded = abi_codec.decode(types, data) + return decoded + + class IERC4626HyperdriveUnsafeCastToUint112ContractError: """ContractError for UnsafeCastToUint112.""" @@ -5133,6 +5304,8 @@ class IERC4626HyperdriveContractErrors: DecreasedPresentValueWhenAddingLiquidity: IERC4626HyperdriveDecreasedPresentValueWhenAddingLiquidityContractError + DistributeExcessIdleFailed: IERC4626HyperdriveDistributeExcessIdleFailedContractError + ExpInvalidExponent: IERC4626HyperdriveExpInvalidExponentContractError ExpiredDeadline: IERC4626HyperdriveExpiredDeadlineContractError @@ -5153,6 +5326,10 @@ class IERC4626HyperdriveContractErrors: InvalidInitialVaultSharePrice: IERC4626HyperdriveInvalidInitialVaultSharePriceContractError + InvalidLPSharePrice: IERC4626HyperdriveInvalidLPSharePriceContractError + + InvalidPresentValue: IERC4626HyperdriveInvalidPresentValueContractError + InvalidShareReserves: IERC4626HyperdriveInvalidShareReservesContractError InvalidSignature: IERC4626HyperdriveInvalidSignatureContractError @@ -5165,8 +5342,6 @@ class IERC4626HyperdriveContractErrors: MinimumTransactionAmount: IERC4626HyperdriveMinimumTransactionAmountContractError - NegativePresentValue: IERC4626HyperdriveNegativePresentValueContractError - NotPayable: IERC4626HyperdriveNotPayableContractError OutputLimit: IERC4626HyperdriveOutputLimitContractError @@ -5189,6 +5364,8 @@ class IERC4626HyperdriveContractErrors: UnsafeCastToInt128: IERC4626HyperdriveUnsafeCastToInt128ContractError + UnsafeCastToInt256: IERC4626HyperdriveUnsafeCastToInt256ContractError + UnsafeCastToUint112: IERC4626HyperdriveUnsafeCastToUint112ContractError UnsafeCastToUint128: IERC4626HyperdriveUnsafeCastToUint128ContractError @@ -5203,6 +5380,7 @@ def __init__( self.DecreasedPresentValueWhenAddingLiquidity = ( IERC4626HyperdriveDecreasedPresentValueWhenAddingLiquidityContractError() ) + self.DistributeExcessIdleFailed = IERC4626HyperdriveDistributeExcessIdleFailedContractError() self.ExpInvalidExponent = IERC4626HyperdriveExpInvalidExponentContractError() self.ExpiredDeadline = IERC4626HyperdriveExpiredDeadlineContractError() self.InsufficientBalance = IERC4626HyperdriveInsufficientBalanceContractError() @@ -5213,13 +5391,14 @@ def __init__( self.InvalidERC20Bridge = IERC4626HyperdriveInvalidERC20BridgeContractError() self.InvalidFeeDestination = IERC4626HyperdriveInvalidFeeDestinationContractError() self.InvalidInitialVaultSharePrice = IERC4626HyperdriveInvalidInitialVaultSharePriceContractError() + self.InvalidLPSharePrice = IERC4626HyperdriveInvalidLPSharePriceContractError() + self.InvalidPresentValue = IERC4626HyperdriveInvalidPresentValueContractError() self.InvalidShareReserves = IERC4626HyperdriveInvalidShareReservesContractError() self.InvalidSignature = IERC4626HyperdriveInvalidSignatureContractError() self.InvalidTimestamp = IERC4626HyperdriveInvalidTimestampContractError() self.LnInvalidInput = IERC4626HyperdriveLnInvalidInputContractError() self.MinimumSharePrice = IERC4626HyperdriveMinimumSharePriceContractError() self.MinimumTransactionAmount = IERC4626HyperdriveMinimumTransactionAmountContractError() - self.NegativePresentValue = IERC4626HyperdriveNegativePresentValueContractError() self.NotPayable = IERC4626HyperdriveNotPayableContractError() self.OutputLimit = IERC4626HyperdriveOutputLimitContractError() self.PoolAlreadyInitialized = IERC4626HyperdrivePoolAlreadyInitializedContractError() @@ -5231,6 +5410,7 @@ def __init__( self.Unauthorized = IERC4626HyperdriveUnauthorizedContractError() self.UnexpectedSuccess = IERC4626HyperdriveUnexpectedSuccessContractError() self.UnsafeCastToInt128 = IERC4626HyperdriveUnsafeCastToInt128ContractError() + self.UnsafeCastToInt256 = IERC4626HyperdriveUnsafeCastToInt256ContractError() self.UnsafeCastToUint112 = IERC4626HyperdriveUnsafeCastToUint112ContractError() self.UnsafeCastToUint128 = IERC4626HyperdriveUnsafeCastToUint128ContractError() self.UnsupportedToken = IERC4626HyperdriveUnsupportedTokenContractError() @@ -5239,6 +5419,7 @@ def __init__( self.BatchInputLengthMismatch, self.BelowMinimumContribution, self.DecreasedPresentValueWhenAddingLiquidity, + self.DistributeExcessIdleFailed, self.ExpInvalidExponent, self.ExpiredDeadline, self.InsufficientBalance, @@ -5249,13 +5430,14 @@ def __init__( self.InvalidERC20Bridge, self.InvalidFeeDestination, self.InvalidInitialVaultSharePrice, + self.InvalidLPSharePrice, + self.InvalidPresentValue, self.InvalidShareReserves, self.InvalidSignature, self.InvalidTimestamp, self.LnInvalidInput, self.MinimumSharePrice, self.MinimumTransactionAmount, - self.NegativePresentValue, self.NotPayable, self.OutputLimit, self.PoolAlreadyInitialized, @@ -5267,6 +5449,7 @@ def __init__( self.Unauthorized, self.UnexpectedSuccess, self.UnsafeCastToInt128, + self.UnsafeCastToInt256, self.UnsafeCastToUint112, self.UnsafeCastToUint128, self.UnsupportedToken, @@ -5285,13 +5468,6 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: ierc4626hyperdrive_abi: ABI = cast( ABI, [ - { - "type": "function", - "name": "DOMAIN_SEPARATOR", - "inputs": [], - "outputs": [{"name": "", "type": "bytes32", "internalType": "bytes32"}], - "stateMutability": "view", - }, { "type": "function", "name": "PERMIT_TYPEHASH", @@ -5318,7 +5494,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: ], }, ], - "outputs": [{"name": "lpShares", "type": "uint256", "internalType": "uint256"}], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], "stateMutability": "payable", }, { @@ -5424,6 +5600,13 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: "outputs": [{"name": "", "type": "uint8", "internalType": "uint8"}], "stateMutability": "view", }, + { + "type": "function", + "name": "domainSeparator", + "inputs": [], + "outputs": [{"name": "", "type": "bytes32", "internalType": "bytes32"}], + "stateMutability": "view", + }, { "type": "function", "name": "getCheckpoint", @@ -5580,7 +5763,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: ], }, ], - "outputs": [{"name": "lpShares", "type": "uint256", "internalType": "uint256"}], + "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], "stateMutability": "payable", }, { @@ -5610,7 +5793,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: { "type": "function", "name": "name", - "inputs": [{"name": "id", "type": "uint256", "internalType": "uint256"}], + "inputs": [{"name": "tokenId", "type": "uint256", "internalType": "uint256"}], "outputs": [{"name": "", "type": "string", "internalType": "string"}], "stateMutability": "view", }, @@ -5640,8 +5823,8 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: }, ], "outputs": [ - {"name": "maturityTime", "type": "uint256", "internalType": "uint256"}, - {"name": "bondProceeds", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, ], "stateMutability": "payable", }, @@ -5664,8 +5847,8 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: }, ], "outputs": [ - {"name": "maturityTime", "type": "uint256", "internalType": "uint256"}, - {"name": "traderDeposit", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, ], "stateMutability": "payable", }, @@ -5720,8 +5903,8 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: }, ], "outputs": [ - {"name": "proceeds", "type": "uint256", "internalType": "uint256"}, - {"name": "withdrawalSharesRedeemed", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, ], "stateMutability": "nonpayable", }, @@ -5743,8 +5926,8 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: }, ], "outputs": [ - {"name": "proceeds", "type": "uint256", "internalType": "uint256"}, - {"name": "withdrawalShares", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, + {"name": "", "type": "uint256", "internalType": "uint256"}, ], "stateMutability": "nonpayable", }, @@ -5808,7 +5991,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: { "type": "function", "name": "symbol", - "inputs": [{"name": "id", "type": "uint256", "internalType": "uint256"}], + "inputs": [{"name": "tokenId", "type": "uint256", "internalType": "uint256"}], "outputs": [{"name": "", "type": "string", "internalType": "string"}], "stateMutability": "view", }, @@ -5850,7 +6033,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: { "type": "function", "name": "totalSupply", - "inputs": [{"name": "id", "type": "uint256", "internalType": "uint256"}], + "inputs": [{"name": "tokenId", "type": "uint256", "internalType": "uint256"}], "outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}], "stateMutability": "view", }, @@ -6025,7 +6208,10 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: { "type": "event", "name": "PauserUpdated", - "inputs": [{"name": "newPauser", "type": "address", "indexed": True, "internalType": "address"}], + "inputs": [ + {"name": "newPauser", "type": "address", "indexed": True, "internalType": "address"}, + {"name": "status", "type": "bool", "indexed": False, "internalType": "bool"}, + ], "anonymous": False, }, { @@ -6069,6 +6255,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: {"type": "error", "name": "BatchInputLengthMismatch", "inputs": []}, {"type": "error", "name": "BelowMinimumContribution", "inputs": []}, {"type": "error", "name": "DecreasedPresentValueWhenAddingLiquidity", "inputs": []}, + {"type": "error", "name": "DistributeExcessIdleFailed", "inputs": []}, {"type": "error", "name": "ExpInvalidExponent", "inputs": []}, {"type": "error", "name": "ExpiredDeadline", "inputs": []}, {"type": "error", "name": "InsufficientBalance", "inputs": []}, @@ -6085,13 +6272,14 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: {"type": "error", "name": "InvalidERC20Bridge", "inputs": []}, {"type": "error", "name": "InvalidFeeDestination", "inputs": []}, {"type": "error", "name": "InvalidInitialVaultSharePrice", "inputs": []}, + {"type": "error", "name": "InvalidLPSharePrice", "inputs": []}, + {"type": "error", "name": "InvalidPresentValue", "inputs": []}, {"type": "error", "name": "InvalidShareReserves", "inputs": []}, {"type": "error", "name": "InvalidSignature", "inputs": []}, {"type": "error", "name": "InvalidTimestamp", "inputs": []}, {"type": "error", "name": "LnInvalidInput", "inputs": []}, {"type": "error", "name": "MinimumSharePrice", "inputs": []}, {"type": "error", "name": "MinimumTransactionAmount", "inputs": []}, - {"type": "error", "name": "NegativePresentValue", "inputs": []}, {"type": "error", "name": "NotPayable", "inputs": []}, {"type": "error", "name": "OutputLimit", "inputs": []}, {"type": "error", "name": "PoolAlreadyInitialized", "inputs": []}, @@ -6103,6 +6291,7 @@ def decode_custom_error(self, data: str) -> tuple[Any, ...]: {"type": "error", "name": "Unauthorized", "inputs": []}, {"type": "error", "name": "UnexpectedSuccess", "inputs": []}, {"type": "error", "name": "UnsafeCastToInt128", "inputs": []}, + {"type": "error", "name": "UnsafeCastToInt256", "inputs": []}, {"type": "error", "name": "UnsafeCastToUint112", "inputs": []}, {"type": "error", "name": "UnsafeCastToUint128", "inputs": []}, {"type": "error", "name": "UnsupportedToken", "inputs": []}, diff --git a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py index 2706f7a..17ec5a6 100644 --- a/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py +++ b/crates/hyperdrivepy/python/hyperdrivepy/pypechain_types/IERC4626HyperdriveTypes.py @@ -178,6 +178,7 @@ anonymous=False, inputs=[ ABIEventParams(indexed=True, name="newPauser", type="address"), + ABIEventParams(indexed=False, name="status", type="bool"), ], name="PauserUpdated", type="event", @@ -265,6 +266,13 @@ class ErrorParams: signature="DecreasedPresentValueWhenAddingLiquidity()", ) +DistributeExcessIdleFailedError = ErrorInfo( + inputs=[], + name="DistributeExcessIdleFailed", + selector="0x8bdf918d", + signature="DistributeExcessIdleFailed()", +) + ExpInvalidExponentError = ErrorInfo( inputs=[], name="ExpInvalidExponent", @@ -337,6 +345,20 @@ class ErrorParams: signature="InvalidInitialVaultSharePrice()", ) +InvalidLPSharePriceError = ErrorInfo( + inputs=[], + name="InvalidLPSharePrice", + selector="0xabeba7ee", + signature="InvalidLPSharePrice()", +) + +InvalidPresentValueError = ErrorInfo( + inputs=[], + name="InvalidPresentValue", + selector="0xaa2c6516", + signature="InvalidPresentValue()", +) + InvalidShareReservesError = ErrorInfo( inputs=[], name="InvalidShareReserves", @@ -379,13 +401,6 @@ class ErrorParams: signature="MinimumTransactionAmount()", ) -NegativePresentValueError = ErrorInfo( - inputs=[], - name="NegativePresentValue", - selector="0xaeeb825d", - signature="NegativePresentValue()", -) - NotPayableError = ErrorInfo( inputs=[], name="NotPayable", @@ -465,6 +480,13 @@ class ErrorParams: signature="UnsafeCastToInt128()", ) +UnsafeCastToInt256Error = ErrorInfo( + inputs=[], + name="UnsafeCastToInt256", + selector="0x72dd4e02", + signature="UnsafeCastToInt256()", +) + UnsafeCastToUint112Error = ErrorInfo( inputs=[], name="UnsafeCastToUint112", diff --git a/crates/hyperdrivepy/setup.py b/crates/hyperdrivepy/setup.py index eec124c..7f9e85f 100644 --- a/crates/hyperdrivepy/setup.py +++ b/crates/hyperdrivepy/setup.py @@ -5,7 +5,7 @@ setup( name="hyperdrivepy", - version="0.8.0", + version="0.9.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 d437418..c725f18 100644 --- a/crates/hyperdrivepy/src/hyperdrive_state_methods.rs +++ b/crates/hyperdrivepy/src/hyperdrive_state_methods.rs @@ -158,9 +158,10 @@ impl HyperdriveState { let amount_in_fp = FixedPoint::from(U256::from_dec_str(amount_in).map_err(|_| { PyErr::new::("Failed to convert amount_in string to U256") })?); + // We unwrap the error here to throw panic error if this fails let result_fp = self .state - .calculate_shares_in_given_bonds_out_up(amount_in_fp); + .calculate_shares_in_given_bonds_out_up_safe(amount_in_fp).unwrap(); let result = U256::from(result_fp).to_string(); return Ok(result); } diff --git a/pyproject.toml b/pyproject.toml index 89d3ea4..dcf7068 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperdrivepy" -version = "0.4.0" +version = "0.9.0" authors = [ { name = "Dylan Paiton", email = "dylan@delv.tech" }, { name = "Matthew Brown", email = "matt@delv.tech" },