From e126c31ac7eae826c79134af3cd03e33ac7b5d9d Mon Sep 17 00:00:00 2001 From: katzman Date: Thu, 21 Sep 2023 21:25:18 +0000 Subject: [PATCH] Revert "Revert "Fixes to dummy deployment to include emitter"" This reverts commit 00565e853709389ed6d97bd96462d6a67711e773. --- contracts/integrations/dummy/GoerliDummy.sol | 13 ++++--- tasks/deploy/integrations/dummyIntegration.ts | 36 ++++++++++++++++++- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/contracts/integrations/dummy/GoerliDummy.sol b/contracts/integrations/dummy/GoerliDummy.sol index 7e51ff50e..c4a6151b4 100644 --- a/contracts/integrations/dummy/GoerliDummy.sol +++ b/contracts/integrations/dummy/GoerliDummy.sol @@ -16,13 +16,16 @@ contract GoerliDummy is DummyStrategy { constructor(StrategyConfig memory _config) DummyStrategy(_config) {} function deposit(uint256 amt) public payable override returns (uint256) { - IDummyERC20(config.yieldToken).mint(address(this), dummyAmt); - return super.deposit(amt); + IDummyERC20(config.yieldToken).mint(address(this), amt); + IERC20(config.baseToken).transferFrom(msg.sender, address(this), amt); + IDummyERC20(config.yieldToken).approve(msg.sender, amt); + return amt; } function withdraw(uint256 amt) public payable override returns (uint256) { - uint256 val = super.deposit(amt); - IDummyERC20(config.yieldToken).burn(address(this), val); - return val; + IERC20(config.yieldToken).transferFrom(msg.sender, address(this), amt); + IERC20(config.baseToken).approve(msg.sender, amt); + IDummyERC20(config.yieldToken).burn(address(this), amt); + return amt; } } diff --git a/tasks/deploy/integrations/dummyIntegration.ts b/tasks/deploy/integrations/dummyIntegration.ts index 83cf70249..12d18970f 100644 --- a/tasks/deploy/integrations/dummyIntegration.ts +++ b/tasks/deploy/integrations/dummyIntegration.ts @@ -1,5 +1,5 @@ import {task} from "hardhat/config"; -import {APVault_V1__factory, DummyERC20__factory, GoerliDummy__factory} from "typechain-types"; +import {APVault_V1__factory, VaultEmitter__factory, DummyERC20__factory, GoerliDummy__factory} from "typechain-types"; import {VaultType} from "types"; import { StratConfig, @@ -8,8 +8,12 @@ import { getSigners, logger, writeStrategyAddresses, + getVaultAddress, + getStrategyAddress, + getAPTeamOwner } from "utils"; import {allStrategyConfigs} from "../../../contracts/integrations/stratConfig"; +import {submitMultiSigTx} from "tasks/helpers"; type TaskArgs = { name: string; @@ -82,6 +86,36 @@ task("Deploy:dummyIntegration", "Will deploy a set of vaults and a dummy strateg }; let liqVault = await Vault.deploy(liquidConfig, addresses.vaultEmitter.proxy, admin); logger.pad(30, "Liquid Vault deployed to", liqVault.address); + + const emitter = VaultEmitter__factory.connect(addresses.vaultEmitter.proxy, deployer); + + await emitter.vaultCreated( + lockVault.address, + { + vaultType: VaultType.LOCKED, + strategyId: config.id, + strategy: strategy.address, + registrar: addresses.registrar.proxy, + baseToken: addresses.tokens.usdc, + yieldToken: yieldToken.address, + apTokenName: "LockedTestVault", + apTokenSymbol: "LockTV", + } + ) + await emitter.vaultCreated( + liqVault.address, + { + vaultType: VaultType.LIQUID, + strategyId: config.id, + strategy: strategy.address, + registrar: addresses.registrar.proxy, + baseToken: addresses.tokens.usdc, + yieldToken: "0x2811747e3336aa28caf71c51454766e1b95f56e8", + apTokenName: "LiquidTestVault", + apTokenSymbol: "LiqTV", + + } + ) const data: StrategyObject = { strategy: strategy.address,