diff --git a/contracts/interfaces/IHypervisor.sol b/contracts/interfaces/IHypervisor.sol index b2e1774..151d2fa 100644 --- a/contracts/interfaces/IHypervisor.sol +++ b/contracts/interfaces/IHypervisor.sol @@ -6,13 +6,12 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; interface IHypervisor { - function deposit( - uint256, - uint256, - address, - address, - uint256[4] memory minIn + uint256, + uint256, + address, + address, + uint256[4] memory minIn ) external returns (uint256); function withdraw( @@ -55,7 +54,6 @@ interface IHypervisor { ); function compound() external returns ( - uint128 baseToken0Owed, uint128 baseToken1Owed, uint128 limitToken0Owed, diff --git a/contracts/interfaces/IUniProxy.sol b/contracts/interfaces/IUniProxy.sol index 23ffcc9..a991553 100644 --- a/contracts/interfaces/IUniProxy.sol +++ b/contracts/interfaces/IUniProxy.sol @@ -1,16 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 - pragma solidity =0.7.6; pragma abicoder v2; interface IUniProxy { - function deposit( uint256 deposit0, uint256 deposit1, address to, - address from, - address pos + address pos, + uint256[4] memory minIn ) external returns (uint256 shares); function getDepositAmount( diff --git a/contracts/interfaces/IUniversalVault.sol b/contracts/interfaces/IUniversalVault.sol deleted file mode 100644 index 9e70f24..0000000 --- a/contracts/interfaces/IUniversalVault.sol +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity 0.7.6; -pragma abicoder v2; - -interface IUniversalVault { - /* user events */ - - event Locked(address delegate, address token, uint256 amount); - event Unlocked(address delegate, address token, uint256 amount); - event RageQuit(address delegate, address token, bool notified, string reason); - - /* data types */ - - struct LockData { - address delegate; - address token; - uint256 balance; - } - - /* initialize function */ - - function initialize() external; - - /* user functions */ - - function lock( - address token, - uint256 amount, - bytes calldata permission - ) external; - - function unlock( - address token, - uint256 amount, - bytes calldata permission - ) external; - - function rageQuit(address delegate, address token) - external - returns (bool notified, string memory error); - - function transferERC20( - address token, - address to, - uint256 amount - ) external; - - function transferETH(address to, uint256 amount) external payable; - - /* pure functions */ - - function calculateLockID(address delegate, address token) - external - pure - returns (bytes32 lockID); - - /* getter functions */ - - function getPermissionHash( - bytes32 eip712TypeHash, - address delegate, - address token, - uint256 amount, - uint256 nonce - ) external view returns (bytes32 permissionHash); - - function getNonce() external view returns (uint256 nonce); - - function owner() external view returns (address ownerAddress); - - function getLockSetCount() external view returns (uint256 count); - - function getLockAt(uint256 index) external view returns (LockData memory lockData); - - function getBalanceDelegated(address token, address delegate) - external - view - returns (uint256 balance); - - function getBalanceLocked(address token) external view returns (uint256 balance); - - function checkBalances() external view returns (bool validity); -} diff --git a/contracts/interfaces/IVault.sol b/contracts/interfaces/IVault.sol deleted file mode 100644 index 412eed3..0000000 --- a/contracts/interfaces/IVault.sol +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only - -pragma solidity 0.7.6; - -interface IVault { - function deposit( - uint256, - uint256, - address, - address - ) external returns (uint256); - - function withdraw( - uint256, - address, - address, - uint256, - uint256 - ) external returns (uint256, uint256); - - function rebalance( - int24 _baseLower, - int24 _baseUpper, - int24 _limitLower, - int24 _limitUpper, - address feeRecipient, - uint256 _amount0Min, - uint256 _amount1Min - ) external; - - function getTotalAmounts() external view returns (uint256, uint256); - - event Deposit( - address indexed sender, - address indexed to, - uint256 shares, - uint256 amount0, - uint256 amount1 - ); - - event Withdraw( - address indexed sender, - address indexed to, - uint256 shares, - uint256 amount0, - uint256 amount1 - ); - - event Rebalance( - int24 tick, - uint256 totalAmount0, - uint256 totalAmount1, - uint256 feeAmount0, - uint256 feeAmount1, - uint256 totalSupply - ); -} diff --git a/contracts/proxy/admin.sol b/contracts/proxy/admin.sol index 7c29e80..45382a2 100644 --- a/contracts/proxy/admin.sol +++ b/contracts/proxy/admin.sol @@ -1,5 +1,4 @@ // SPDX-License-Identifier: BUSL-1.1 - pragma solidity 0.7.6; import "../interfaces/IHypervisor.sol"; diff --git a/typechain/IUniProxy.d.ts b/typechain/IUniProxy.d.ts index da42585..f3f57dc 100644 --- a/typechain/IUniProxy.d.ts +++ b/typechain/IUniProxy.d.ts @@ -21,13 +21,19 @@ import type { TypedEventFilter, TypedEvent, TypedListener } from "./common"; interface IUniProxyInterface extends ethers.utils.Interface { functions: { - "deposit(uint256,uint256,address,address,address)": FunctionFragment; + "deposit(uint256,uint256,address,address,uint256[4])": FunctionFragment; "getDepositAmount(address,address,uint256)": FunctionFragment; }; encodeFunctionData( functionFragment: "deposit", - values: [BigNumberish, BigNumberish, string, string, string] + values: [ + BigNumberish, + BigNumberish, + string, + string, + [BigNumberish, BigNumberish, BigNumberish, BigNumberish] + ] ): string; encodeFunctionData( functionFragment: "getDepositAmount", @@ -91,8 +97,8 @@ export class IUniProxy extends BaseContract { deposit0: BigNumberish, deposit1: BigNumberish, to: string, - from: string, pos: string, + minIn: [BigNumberish, BigNumberish, BigNumberish, BigNumberish], overrides?: Overrides & { from?: string | Promise } ): Promise; @@ -110,8 +116,8 @@ export class IUniProxy extends BaseContract { deposit0: BigNumberish, deposit1: BigNumberish, to: string, - from: string, pos: string, + minIn: [BigNumberish, BigNumberish, BigNumberish, BigNumberish], overrides?: Overrides & { from?: string | Promise } ): Promise; @@ -129,8 +135,8 @@ export class IUniProxy extends BaseContract { deposit0: BigNumberish, deposit1: BigNumberish, to: string, - from: string, pos: string, + minIn: [BigNumberish, BigNumberish, BigNumberish, BigNumberish], overrides?: CallOverrides ): Promise; @@ -151,8 +157,8 @@ export class IUniProxy extends BaseContract { deposit0: BigNumberish, deposit1: BigNumberish, to: string, - from: string, pos: string, + minIn: [BigNumberish, BigNumberish, BigNumberish, BigNumberish], overrides?: Overrides & { from?: string | Promise } ): Promise; @@ -169,8 +175,8 @@ export class IUniProxy extends BaseContract { deposit0: BigNumberish, deposit1: BigNumberish, to: string, - from: string, pos: string, + minIn: [BigNumberish, BigNumberish, BigNumberish, BigNumberish], overrides?: Overrides & { from?: string | Promise } ): Promise; diff --git a/typechain/factories/IUniProxy__factory.ts b/typechain/factories/IUniProxy__factory.ts index 9600ad8..1a89d95 100644 --- a/typechain/factories/IUniProxy__factory.ts +++ b/typechain/factories/IUniProxy__factory.ts @@ -26,13 +26,13 @@ const _abi = [ }, { internalType: "address", - name: "from", + name: "pos", type: "address", }, { - internalType: "address", - name: "pos", - type: "address", + internalType: "uint256[4]", + name: "minIn", + type: "uint256[4]", }, ], name: "deposit", diff --git a/typechain/hardhat.d.ts b/typechain/hardhat.d.ts index b6c9fa9..0a98a29 100644 --- a/typechain/hardhat.d.ts +++ b/typechain/hardhat.d.ts @@ -12,6 +12,10 @@ import * as Contracts from "."; declare module "hardhat/types/runtime" { interface HardhatEthersHelpers extends HardhatEthersHelpersBase { + getContractFactory( + name: "AccessControl", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "Ownable", signerOrOptions?: ethers.Signer | FactoryOptions @@ -32,6 +36,14 @@ declare module "hardhat/types/runtime" { name: "IERC20", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "IUniswapV2Factory", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "IUniswapV2Pair", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "IUniswapV3FlashCallback", signerOrOptions?: ethers.Signer | FactoryOptions @@ -204,6 +216,30 @@ declare module "hardhat/types/runtime" { name: "V3Migrator", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "BaseController", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "GammaController", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "IHypervisorFactory", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "ITokeHypervisor", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "TokeHypervisor", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "TokeHypervisorFactory", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "Hypervisor", signerOrOptions?: ethers.Signer | FactoryOptions @@ -212,6 +248,10 @@ declare module "hardhat/types/runtime" { name: "HypervisorFactory", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "HypervisorV3Migrator", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "IHypervisor", signerOrOptions?: ethers.Signer | FactoryOptions @@ -244,6 +284,10 @@ declare module "hardhat/types/runtime" { name: "Admin", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "Swap", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "MockToken", signerOrOptions?: ethers.Signer | FactoryOptions @@ -257,6 +301,11 @@ declare module "hardhat/types/runtime" { signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractAt( + name: "AccessControl", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "Ownable", address: string, @@ -282,6 +331,16 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "IUniswapV2Factory", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "IUniswapV2Pair", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "IUniswapV3FlashCallback", address: string, @@ -497,6 +556,36 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "BaseController", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "GammaController", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "IHypervisorFactory", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "ITokeHypervisor", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "TokeHypervisor", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "TokeHypervisorFactory", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "Hypervisor", address: string, @@ -507,6 +596,11 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "HypervisorV3Migrator", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "IHypervisor", address: string, @@ -547,6 +641,11 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "Swap", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "MockToken", address: string, diff --git a/typechain/index.ts b/typechain/index.ts index f71ead8..403365b 100644 --- a/typechain/index.ts +++ b/typechain/index.ts @@ -1,11 +1,14 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ +export type { AccessControl } from "./AccessControl"; export type { Ownable } from "./Ownable"; export type { ERC20Permit } from "./ERC20Permit"; export type { IERC20Permit } from "./IERC20Permit"; export type { ERC20 } from "./ERC20"; export type { IERC20 } from "./IERC20"; +export type { IUniswapV2Factory } from "./IUniswapV2Factory"; +export type { IUniswapV2Pair } from "./IUniswapV2Pair"; export type { IUniswapV3FlashCallback } from "./IUniswapV3FlashCallback"; export type { IUniswapV3MintCallback } from "./IUniswapV3MintCallback"; export type { IUniswapV3SwapCallback } from "./IUniswapV3SwapCallback"; @@ -49,8 +52,15 @@ export type { NonfungiblePositionManager } from "./NonfungiblePositionManager"; export type { NonfungibleTokenPositionDescriptor } from "./NonfungibleTokenPositionDescriptor"; export type { SwapRouter } from "./SwapRouter"; export type { V3Migrator } from "./V3Migrator"; +export type { BaseController } from "./BaseController"; +export type { GammaController } from "./GammaController"; +export type { IHypervisorFactory } from "./IHypervisorFactory"; +export type { ITokeHypervisor } from "./ITokeHypervisor"; +export type { TokeHypervisor } from "./TokeHypervisor"; +export type { TokeHypervisorFactory } from "./TokeHypervisorFactory"; export type { Hypervisor } from "./Hypervisor"; export type { HypervisorFactory } from "./HypervisorFactory"; +export type { HypervisorV3Migrator } from "./HypervisorV3Migrator"; export type { IHypervisor } from "./IHypervisor"; export type { IUniProxy } from "./IUniProxy"; export type { IUniversalVault } from "./IUniversalVault"; @@ -59,15 +69,19 @@ export type { MockUniswapV3Pool } from "./MockUniswapV3Pool"; export type { MockUniswapV3PoolDeployer } from "./MockUniswapV3PoolDeployer"; export type { TestERC20 } from "./TestERC20"; export type { Admin } from "./Admin"; +export type { Swap } from "./Swap"; export type { MockToken } from "./MockToken"; export type { TestRouter } from "./TestRouter"; export type { UniProxy } from "./UniProxy"; +export { AccessControl__factory } from "./factories/AccessControl__factory"; export { Ownable__factory } from "./factories/Ownable__factory"; export { ERC20Permit__factory } from "./factories/ERC20Permit__factory"; export { IERC20Permit__factory } from "./factories/IERC20Permit__factory"; export { ERC20__factory } from "./factories/ERC20__factory"; export { IERC20__factory } from "./factories/IERC20__factory"; +export { IUniswapV2Factory__factory } from "./factories/IUniswapV2Factory__factory"; +export { IUniswapV2Pair__factory } from "./factories/IUniswapV2Pair__factory"; export { IUniswapV3FlashCallback__factory } from "./factories/IUniswapV3FlashCallback__factory"; export { IUniswapV3MintCallback__factory } from "./factories/IUniswapV3MintCallback__factory"; export { IUniswapV3SwapCallback__factory } from "./factories/IUniswapV3SwapCallback__factory"; @@ -111,8 +125,15 @@ export { NonfungiblePositionManager__factory } from "./factories/NonfungiblePosi export { NonfungibleTokenPositionDescriptor__factory } from "./factories/NonfungibleTokenPositionDescriptor__factory"; export { SwapRouter__factory } from "./factories/SwapRouter__factory"; export { V3Migrator__factory } from "./factories/V3Migrator__factory"; +export { BaseController__factory } from "./factories/BaseController__factory"; +export { GammaController__factory } from "./factories/GammaController__factory"; +export { IHypervisorFactory__factory } from "./factories/IHypervisorFactory__factory"; +export { ITokeHypervisor__factory } from "./factories/ITokeHypervisor__factory"; +export { TokeHypervisor__factory } from "./factories/TokeHypervisor__factory"; +export { TokeHypervisorFactory__factory } from "./factories/TokeHypervisorFactory__factory"; export { Hypervisor__factory } from "./factories/Hypervisor__factory"; export { HypervisorFactory__factory } from "./factories/HypervisorFactory__factory"; +export { HypervisorV3Migrator__factory } from "./factories/HypervisorV3Migrator__factory"; export { IHypervisor__factory } from "./factories/IHypervisor__factory"; export { IUniProxy__factory } from "./factories/IUniProxy__factory"; export { IUniversalVault__factory } from "./factories/IUniversalVault__factory"; @@ -121,6 +142,7 @@ export { MockUniswapV3Pool__factory } from "./factories/MockUniswapV3Pool__facto export { MockUniswapV3PoolDeployer__factory } from "./factories/MockUniswapV3PoolDeployer__factory"; export { TestERC20__factory } from "./factories/TestERC20__factory"; export { Admin__factory } from "./factories/Admin__factory"; +export { Swap__factory } from "./factories/Swap__factory"; export { MockToken__factory } from "./factories/MockToken__factory"; export { TestRouter__factory } from "./factories/TestRouter__factory"; export { UniProxy__factory } from "./factories/UniProxy__factory";