Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fei/Volt Swap #719

Merged
merged 11 commits into from
Apr 25, 2022
58 changes: 58 additions & 0 deletions proposals/dao/fip_98.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { ethers } from 'hardhat';
import { expect } from 'chai';
import {
DeployUpgradeFunc,
NamedAddresses,
SetupUpgradeFunc,
TeardownUpgradeFunc,
ValidateUpgradeFunc
} from '@custom-types/types';
import { getImpersonatedSigner } from '@test/helpers';

/*

DAO Proposal 98

Description:

Steps:
1. Mint 10.17m FEI into the timelock
2. Approve OTC escrow contract to spend 10.17m FEI
3. Call swap on the escrow contract to send the 10.17m FEI
to the VOLT PCV Deposit so that the funds do not get invested into fuse

*/

const fipNumber = '98';
const seedAmount = ethers.constants.WeiPerEther.mul(10_000_000); // 10 M

// Do any deployments
// This should exclusively include new contract deployments
const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => {
return {}; // empty return to silence typescript compiler error
};

// Do any setup necessary for running the test.
// This could include setting up Hardhat to impersonate accounts,
// ensuring contracts have a specific state, etc.
const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {};

// Tears down any changes made in setup() that need to be
// cleaned up before doing any validation checks.
const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {
console.log(`No actions to complete in teardown for fip${fipNumber}`);
};

// Run any validations required on the fip using mocha or console logging
// IE check balances, check state of contracts, etc.
const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {
const { feiDAOTimelock, fei, volt, voltFusePCVDeposit } = contracts;

const feiAmount = ethers.constants.WeiPerEther.mul(10_170_000); // 10 M
// Validate 10M volt was received by fei Dao timelock
// Validate 10M fei was received by volt fuse pcv deposit
ElliotFriedman marked this conversation as resolved.
Show resolved Hide resolved
expect(await volt.balanceOf(feiDAOTimelock.address)).to.be.equal(seedAmount);
expect(await fei.balanceOf(voltFusePCVDeposit.address)).to.be.equal(feiAmount);
};

export { deploy, setup, teardown, validate };
31 changes: 31 additions & 0 deletions proposals/description/fip_98.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ProposalDescription } from '@custom-types/types';

const fip_98: ProposalDescription = {
title: 'FIP-98: Purchase 10m VOLT',
commands: [
{
target: 'fei',
values: '0',
method: 'mint(address,uint256)',
arguments: ['{feiDAOTimelock}', '10170000000000000000000000'],
description: 'Mint $10.17M FEI'
},
{
target: 'fei',
values: '0',
method: 'approve(address,uint256)',
arguments: ['{voltFeiSwapContract}', '10170000000000000000000000'],
description: 'Approve 10.17m Fei to be spent by the otc contract on the timelocks behalf'
},
{
target: 'voltFeiSwapContract',
ElliotFriedman marked this conversation as resolved.
Show resolved Hide resolved
values: '0',
method: 'swap()',
arguments: [],
description: 'Swap fei for Volt'
}
],
description: `Swap 10.17m Fei for 10m VOLT as described in fip 88 https://tribe.fei.money/t/fip-88-volt-joins-the-tribe/4007`
};

export default fip_98;
20 changes: 20 additions & 0 deletions protocol-configuration/mainnetAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ const MainnetAddresses: MainnetAddresses = {
address: '0x10ffa0CD36Bc16b355d21A08DF4a552c4A9FEC10',
category: AddressCategory.Core
},
volt: {
artifactName: 'Fei',
address: '0x559eBC30b0E58a45Cc9fF573f77EF1e5eb1b3E18',
category: AddressCategory.Core
ElliotFriedman marked this conversation as resolved.
Show resolved Hide resolved
},
voltCore: {
artifactName: AddressCategory.Core,
ElliotFriedman marked this conversation as resolved.
Show resolved Hide resolved
address: '0xEC7AD284f7Ad256b64c6E69b84Eb0F48f42e8196',
category: AddressCategory.Core
},
feiDAO: {
artifactName: 'FeiDAO',
address: '0x0BEF27FEB58e857046d630B2c03dFb7bae567494',
Expand Down Expand Up @@ -1576,6 +1586,16 @@ const MainnetAddresses: MainnetAddresses = {
address: '0xD3D13a578a53685B4ac36A1Bab31912D2B2A2F36',
category: AddressCategory.External
},
voltFeiSwapContract: {
artifactName: 'OtcEscrow',
address: '0xeF152E462B59940616E667E801762dA9F2AF97b9',
category: AddressCategory.External
},
voltFusePCVDeposit: {
artifactName: 'ERC20CompoundPCVDeposit',
address: '0xFeBDf448C8484834bb399d930d7E1bdC773E23bA',
category: AddressCategory.PCV
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I don't love the intermingling here. Lets think about having a parallel mainnetAddresses configuration in volt or even rewriting the proposal flow in forge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already did a simulation in the volt repo with forge, but it's not the same thing as writing out the calldata steps here. https://github.com/volt-protocol/volt-protocol-core/pull/70/files

votiumBribe: {
artifactName: 'IVotiumBribe',
address: '0x19BBC3463Dd8d07f55438014b021Fb457EBD4595',
Expand Down
10 changes: 10 additions & 0 deletions test/integration/proposals_config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types';

// import fip_xx_proposal from '@proposals/description/fip_xx';
import fip_98 from '@proposals/description/fip_98';
import fip_92 from '@proposals/description/fip_92';

const proposals: ProposalsConfigMap = {
Expand All @@ -15,6 +16,15 @@ const proposals: ProposalsConfigMap = {
category: ProposalCategory.DAO
}
*/
fip_98: {
deploy: false,
proposalId: null,
affectedContractSignoff: ['fei', 'voltFeiSwapContract'],
deprecatedContractSignoff: [],
category: ProposalCategory.DAO,
totalValue: 0,
proposal: fip_98
},
fip_92: {
deploy: false, // deploy flag for whether to run deploy action during e2e tests or use mainnet state
totalValue: 0, // amount of ETH to send to DAO execution
Expand Down