From 81f3ea9c7eb9fc012b6b5e4d8ecf28b8644d9fa2 Mon Sep 17 00:00:00 2001 From: Pedro Yves Fracari Date: Thu, 18 Apr 2024 09:35:19 -0300 Subject: [PATCH] remove codegen example --- cow_py/codegen/example/VaultABI.json | 1179 ------------------------- cow_py/codegen/example/Vault_types.py | 237 ----- 2 files changed, 1416 deletions(-) delete mode 100644 cow_py/codegen/example/VaultABI.json delete mode 100644 cow_py/codegen/example/Vault_types.py diff --git a/cow_py/codegen/example/VaultABI.json b/cow_py/codegen/example/VaultABI.json deleted file mode 100644 index b27c70a..0000000 --- a/cow_py/codegen/example/VaultABI.json +++ /dev/null @@ -1,1179 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IAuthorizer", - "name": "authorizer", - "type": "address" - }, - { - "internalType": "contract IWETH", - "name": "weth", - "type": "address" - }, - { - "internalType": "uint256", - "name": "pauseWindowDuration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bufferPeriodDuration", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IAuthorizer", - "name": "newAuthorizer", - "type": "address" - } - ], - "name": "AuthorizerChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ExternalBalanceTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IFlashLoanRecipient", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeAmount", - "type": "uint256" - } - ], - "name": "FlashLoan", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "int256", - "name": "delta", - "type": "int256" - } - ], - "name": "InternalBalanceChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "paused", - "type": "bool" - } - ], - "name": "PausedStateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "liquidityProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "int256[]", - "name": "deltas", - "type": "int256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "protocolFeeAmounts", - "type": "uint256[]" - } - ], - "name": "PoolBalanceChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "assetManager", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "int256", - "name": "cashDelta", - "type": "int256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "managedDelta", - "type": "int256" - } - ], - "name": "PoolBalanceManaged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "poolAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "enum IVault.PoolSpecialization", - "name": "specialization", - "type": "uint8" - } - ], - "name": "PoolRegistered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "relayer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "RelayerApprovalChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "contract IERC20", - "name": "tokenIn", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IERC20", - "name": "tokenOut", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountOut", - "type": "uint256" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - } - ], - "name": "TokensDeregistered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "assetManagers", - "type": "address[]" - } - ], - "name": "TokensRegistered", - "type": "event" - }, - { - "inputs": [], - "name": "WETH", - "outputs": [ - { - "internalType": "contract IWETH", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum IVault.SwapKind", - "name": "kind", - "type": "uint8" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "assetInIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "assetOutIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "userData", - "type": "bytes" - } - ], - "internalType": "struct IVault.BatchSwapStep[]", - "name": "swaps", - "type": "tuple[]" - }, - { - "internalType": "contract IAsset[]", - "name": "assets", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bool", - "name": "fromInternalBalance", - "type": "bool" - }, - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "bool", - "name": "toInternalBalance", - "type": "bool" - } - ], - "internalType": "struct IVault.FundManagement", - "name": "funds", - "type": "tuple" - }, - { - "internalType": "int256[]", - "name": "limits", - "type": "int256[]" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "batchSwap", - "outputs": [ - { - "internalType": "int256[]", - "name": "assetDeltas", - "type": "int256[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - } - ], - "name": "deregisterTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "components": [ - { - "internalType": "contract IAsset[]", - "name": "assets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "minAmountsOut", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "userData", - "type": "bytes" - }, - { - "internalType": "bool", - "name": "toInternalBalance", - "type": "bool" - } - ], - "internalType": "struct IVault.ExitPoolRequest", - "name": "request", - "type": "tuple" - } - ], - "name": "exitPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IFlashLoanRecipient", - "name": "recipient", - "type": "address" - }, - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "userData", - "type": "bytes" - } - ], - "name": "flashLoan", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "selector", - "type": "bytes4" - } - ], - "name": "getActionId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getAuthorizer", - "outputs": [ - { - "internalType": "contract IAuthorizer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainSeparator", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - } - ], - "name": "getInternalBalance", - "outputs": [ - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getNextNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPausedState", - "outputs": [ - { - "internalType": "bool", - "name": "paused", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "pauseWindowEndTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bufferPeriodEndTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "enum IVault.PoolSpecialization", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - } - ], - "name": "getPoolTokenInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "cash", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "managed", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - }, - { - "internalType": "address", - "name": "assetManager", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getProtocolFeesCollector", - "outputs": [ - { - "internalType": "contract ProtocolFeesCollector", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "address", - "name": "relayer", - "type": "address" - } - ], - "name": "hasApprovedRelayer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "components": [ - { - "internalType": "contract IAsset[]", - "name": "assets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "maxAmountsIn", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "userData", - "type": "bytes" - }, - { - "internalType": "bool", - "name": "fromInternalBalance", - "type": "bool" - } - ], - "internalType": "struct IVault.JoinPoolRequest", - "name": "request", - "type": "tuple" - } - ], - "name": "joinPool", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "enum IVault.PoolBalanceOpKind", - "name": "kind", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "internalType": "struct IVault.PoolBalanceOp[]", - "name": "ops", - "type": "tuple[]" - } - ], - "name": "managePoolBalance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "enum IVault.UserBalanceOpKind", - "name": "kind", - "type": "uint8" - }, - { - "internalType": "contract IAsset", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "struct IVault.UserBalanceOp[]", - "name": "ops", - "type": "tuple[]" - } - ], - "name": "manageUserBalance", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum IVault.SwapKind", - "name": "kind", - "type": "uint8" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "assetInIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "assetOutIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "userData", - "type": "bytes" - } - ], - "internalType": "struct IVault.BatchSwapStep[]", - "name": "swaps", - "type": "tuple[]" - }, - { - "internalType": "contract IAsset[]", - "name": "assets", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bool", - "name": "fromInternalBalance", - "type": "bool" - }, - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "bool", - "name": "toInternalBalance", - "type": "bool" - } - ], - "internalType": "struct IVault.FundManagement", - "name": "funds", - "type": "tuple" - } - ], - "name": "queryBatchSwap", - "outputs": [ - { - "internalType": "int256[]", - "name": "", - "type": "int256[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum IVault.PoolSpecialization", - "name": "specialization", - "type": "uint8" - } - ], - "name": "registerPool", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "assetManagers", - "type": "address[]" - } - ], - "name": "registerTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IAuthorizer", - "name": "newAuthorizer", - "type": "address" - } - ], - "name": "setAuthorizer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "paused", - "type": "bool" - } - ], - "name": "setPaused", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "relayer", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setRelayerApproval", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }, - { - "internalType": "enum IVault.SwapKind", - "name": "kind", - "type": "uint8" - }, - { - "internalType": "contract IAsset", - "name": "assetIn", - "type": "address" - }, - { - "internalType": "contract IAsset", - "name": "assetOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "userData", - "type": "bytes" - } - ], - "internalType": "struct IVault.SingleSwap", - "name": "singleSwap", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bool", - "name": "fromInternalBalance", - "type": "bool" - }, - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "bool", - "name": "toInternalBalance", - "type": "bool" - } - ], - "internalType": "struct IVault.FundManagement", - "name": "funds", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "limit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "swap", - "outputs": [ - { - "internalType": "uint256", - "name": "amountCalculated", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ] diff --git a/cow_py/codegen/example/Vault_types.py b/cow_py/codegen/example/Vault_types.py deleted file mode 100644 index 1104fd7..0000000 --- a/cow_py/codegen/example/Vault_types.py +++ /dev/null @@ -1,237 +0,0 @@ -from dataclasses import dataclass -from enum import Enum -from typing import Any, List, Tuple - -from hexbytes import HexBytes - -from cow_py.codegen.components import ( - BaseContract, - BaseMixin, - ContractFactory, - FileAbiLoader, -) -from cow_py.common.chains import Chain - - -# TODO: Enums must be fixed before using them. They currently only use placeholder values. -class SwapKind(Enum): - VALUE_1 = 1 - VALUE_2 = 2 - - -class PoolSpecialization(Enum): - VALUE_1 = 1 - VALUE_2 = 2 - - -@dataclass -class FundManagement: - sender: str - fromInternalBalance: bool - recipient: str - toInternalBalance: bool - - -@dataclass -class ExitPoolRequest: - assets: List[str] - minAmountsOut: List[int] - userData: HexBytes - toInternalBalance: bool - - -@dataclass -class JoinPoolRequest: - assets: List[str] - maxAmountsIn: List[int] - userData: HexBytes - fromInternalBalance: bool - - -@dataclass -class SingleSwap: - poolId: HexBytes - kind: SwapKind - assetIn: str - assetOut: str - amount: int - userData: HexBytes - - -class VaultMixin(BaseMixin): - def weth(self) -> str: - return self.call_contract_method("WETH") - - def batch_swap( - self, - kind: SwapKind, - swaps: List[Any], - assets: List[str], - funds: FundManagement, - limits: List[int], - deadline: int, - ) -> List[int]: - return self.call_contract_method( - "batchSwap", - kind, - swaps, - assets, - ( - funds.sender, - funds.fromInternalBalance, - funds.recipient, - funds.toInternalBalance, - ), - limits, - deadline, - ) - - def deregister_tokens(self, pool_id: HexBytes, tokens: List[str]) -> None: - return self.call_contract_method("deregisterTokens", pool_id, tokens) - - def exit_pool( - self, pool_id: HexBytes, sender: str, recipient: str, request: ExitPoolRequest - ) -> None: - return self.call_contract_method( - "exitPool", - pool_id, - sender, - recipient, - ( - request.assets, - request.minAmountsOut, - request.userData, - request.toInternalBalance, - ), - ) - - def flash_loan( - self, recipient: str, tokens: List[str], amounts: List[int], user_data: HexBytes - ) -> None: - return self.call_contract_method( - "flashLoan", recipient, tokens, amounts, user_data - ) - - def get_action_id(self, selector: HexBytes) -> HexBytes: - return self.call_contract_method("getActionId", selector) - - def get_authorizer(self) -> str: - return self.call_contract_method("getAuthorizer") - - def get_domain_separator(self) -> HexBytes: - return self.call_contract_method("getDomainSeparator") - - def get_internal_balance(self, user: str, tokens: List[str]) -> List[int]: - return self.call_contract_method("getInternalBalance", user, tokens) - - def get_next_nonce(self, user: str) -> int: - return self.call_contract_method("getNextNonce", user) - - def get_paused_state(self) -> Tuple[bool, int, int]: - return self.call_contract_method("getPausedState") - - def get_pool(self, pool_id: HexBytes) -> Tuple[str, PoolSpecialization]: - return self.call_contract_method("getPool", pool_id) - - def get_pool_token_info( - self, pool_id: HexBytes, token: str - ) -> Tuple[int, int, int, str]: - return self.call_contract_method("getPoolTokenInfo", pool_id, token) - - def get_pool_tokens(self, pool_id: HexBytes) -> Tuple[List[str], List[int], int]: - return self.call_contract_method("getPoolTokens", pool_id) - - def get_protocol_fees_collector(self) -> str: - return self.call_contract_method("getProtocolFeesCollector") - - def has_approved_relayer(self, user: str, relayer: str) -> bool: - return self.call_contract_method("hasApprovedRelayer", user, relayer) - - def join_pool( - self, pool_id: HexBytes, sender: str, recipient: str, request: JoinPoolRequest - ) -> None: - return self.call_contract_method( - "joinPool", - pool_id, - sender, - recipient, - ( - request.assets, - request.maxAmountsIn, - request.userData, - request.fromInternalBalance, - ), - ) - - def manage_pool_balance(self, ops: List[Any]) -> None: - return self.call_contract_method("managePoolBalance", ops) - - def manage_user_balance(self, ops: List[Any]) -> None: - return self.call_contract_method("manageUserBalance", ops) - - def query_batch_swap( - self, kind: SwapKind, swaps: List[Any], assets: List[str], funds: FundManagement - ) -> List[int]: - return self.call_contract_method( - "queryBatchSwap", - kind, - swaps, - assets, - ( - funds.sender, - funds.fromInternalBalance, - funds.recipient, - funds.toInternalBalance, - ), - ) - - def register_pool(self, specialization: PoolSpecialization) -> HexBytes: - return self.call_contract_method("registerPool", specialization) - - def register_tokens( - self, pool_id: HexBytes, tokens: List[str], asset_managers: List[str] - ) -> None: - return self.call_contract_method( - "registerTokens", pool_id, tokens, asset_managers - ) - - def set_authorizer(self, new_authorizer: str) -> None: - return self.call_contract_method("setAuthorizer", new_authorizer) - - def set_paused(self, paused: bool) -> None: - return self.call_contract_method("setPaused", paused) - - def set_relayer_approval(self, sender: str, relayer: str, approved: bool) -> None: - return self.call_contract_method( - "setRelayerApproval", sender, relayer, approved - ) - - def swap( - self, single_swap: SingleSwap, funds: FundManagement, limit: int, deadline: int - ) -> int: - return self.call_contract_method( - "swap", - ( - single_swap.poolId, - single_swap.kind, - single_swap.assetIn, - single_swap.assetOut, - single_swap.amount, - single_swap.userData, - ), - ( - funds.sender, - funds.fromInternalBalance, - funds.recipient, - funds.toInternalBalance, - ), - limit, - deadline, - ) - - -class Vault(BaseContract, VaultMixin): - def __init__(self, chain: Chain = Chain.MAINNET, address: str = ""): - abi_loader = FileAbiLoader("example/VaultABI.json") - contract = ContractFactory.create("Vault", chain, address, abi_loader) - super(Vault, self).__init__(address, chain, abi=contract.ABI)