Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Fixes to dummy deployment to include emitter #387

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions contracts/integrations/dummy/GoerliDummy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
36 changes: 35 additions & 1 deletion tasks/deploy/integrations/dummyIntegration.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down