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

FIP-64 #460

Merged
merged 3 commits into from
Jan 11, 2022
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
5 changes: 5 additions & 0 deletions contract-addresses/mainnetAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,11 @@ const MainnetAddresses: MainnetAddresses = {
address: '0x4da27a545c0c5b758a6ba100e3a049001de870f5',
category: AddressCategory.External
},
wstEth: {
artifactName: 'IERC20',
address: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
category: AddressCategory.External
},
steth: {
artifactName: 'IERC20',
address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',
Expand Down
80 changes: 80 additions & 0 deletions proposals/dao/fip_64.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { ethers } from 'hardhat';
import chai, { expect } from 'chai';
import CBN from 'chai-bn';
import {
DeployUpgradeFunc,
NamedContracts,
SetupUpgradeFunc,
TeardownUpgradeFunc,
ValidateUpgradeFunc
} from '@custom-types/types';
import { deploy as deploySTW } from '@scripts/deploy/deployStakingTokenWrapper';

chai.use(CBN(ethers.BigNumber));

/*
FIP-64: Add wstETH to FeiRari

OA ACTIONS:


*/

export const deploy: DeployUpgradeFunc = async (deployAddress, addresses, logging = false) => {
return {} as NamedContracts;
};

export const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {
logging && console.log('No setup');
};

export const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {};

export const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts) => {
const {
tribalChief,
feiDaiStakingTokenWrapper,
feiUsdcStakingTokenWrapper,
feiDaiAutoRewardsDistributor,
feiUsdcAutoRewardsDistributor,
rariRewardsDistributorDelegator,
rariPool8Comptroller
} = contracts;
const comptroller = contracts.rariPool8Comptroller;

console.log('Validating');

const d3Ctoken = await comptroller.cTokensByUnderlying(addresses.curveD3pool);
expect(d3Ctoken).to.not.be.equal(ethers.constants.AddressZero);

const fei3CrvCtoken = await comptroller.cTokensByUnderlying(addresses.curve3Metapool);
expect(fei3CrvCtoken).to.not.be.equal(ethers.constants.AddressZero);

const feiUsdcCToken = await comptroller.cTokensByUnderlying(addresses.gUniFeiUsdcLP);
expect(feiUsdcCToken).to.not.be.equal(ethers.constants.AddressZero);

const wstEthCToken = await comptroller.cTokensByUnderlying(addresses.wstEth);
expect(wstEthCToken).to.not.be.equal(ethers.constants.AddressZero);

console.log('Ctoken configs');

// supply cap
expect(await rariPool8Comptroller.supplyCaps(feiUsdcCToken)).to.be.equal(ethers.constants.WeiPerEther.mul(200_000)); // 100 M
expect(await rariPool8Comptroller.supplyCaps(fei3CrvCtoken)).to.be.equal(
ethers.constants.WeiPerEther.mul(100_000_000)
); // 100 M
expect(await rariPool8Comptroller.supplyCaps(wstEthCToken)).to.be.equal(ethers.constants.WeiPerEther.mul(30_000)); // 100 M
expect(await rariPool8Comptroller.supplyCaps(d3Ctoken)).to.be.equal(ethers.constants.WeiPerEther.mul(100_000_000)); // 100 M

console.log('Borrow Pause');

// borrow paused
expect(await rariPool8Comptroller.borrowGuardianPaused(wstEthCToken)).to.be.true;

console.log('LTV');

// LTV
expect((await rariPool8Comptroller.markets(wstEthCToken)).collateralFactorMantissa).to.be.equal(
ethers.constants.WeiPerEther.mul(80).div(100)
);
};
49 changes: 49 additions & 0 deletions proposals/description/fip_64.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { ProposalDescription } from '@custom-types/types';

const fip_60b: ProposalDescription = {
title: 'FIP-60b: FeiRari Rewards Upgrade',
commands: [
{
target: 'fuseAdmin',
values: '0',
method: '_deployMarket(address,address,string,string,address,bytes,uint256,uint256,uint256)',
arguments: [
'{wstEth}', // underlying
'{rariPool8EthIrm}', // IRM (not used)
'FeiRari Wrapped stETH Fuse', // Name
'fwstETH-8', // Symbol
'{rariPool8CTokenImpl}', // impl
'0x', // constructor bytes (not used)
'0', // reserve factor (not used)
'0', // admin fee (not used)
'800000000000000000' // LTV scaled by 1e18
],
description: 'Add wstETH to FeiRari'
},
{
target: 'fuseGuardian',
values: '0',
method: '_setBorrowPausedByUnderlying(address,bool)',
arguments: ['{wstEth}', true],
description: 'Set wstETH borrow paused'
},
{
target: 'fuseGuardian',
values: '0',
method: '_setMarketSupplyCapsByUnderlying(address[],uint256[])',
arguments: [
['{curveD3pool}', '{curve3Metapool}', '{wstEth}', '{gUniFeiUsdcLP}'],
[
'100000000000000000000000000',
'100000000000000000000000000',
'30000000000000000000000',
'200000000000000000000000'
]
],
description: 'Set Fuse supply caps'
}
],
description: ``
};

export default fip_60b;
11 changes: 10 additions & 1 deletion test/integration/proposals_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types';

import fip_54 from '@proposals/description/fip_54';
import fip_60b from '@proposals/description/fip_60b';
import fip_62 from '@proposals/description/fip_62';
import fip_64 from '@proposals/description/fip_64';

const proposals: ProposalsConfigMap = {
/*
Expand Down Expand Up @@ -56,6 +56,15 @@ const proposals: ProposalsConfigMap = {
category: ProposalCategory.OA,
totalValue: 0,
proposal: fip_60b
},
fip_64: {
deploy: false,
proposalId: undefined,
affectedContractSignoff: ['fuseAdmin', 'rariPool8EthIrm', 'rariPool8CTokenImpl', 'fuseGuardian'],
deprecatedContractSignoff: [],
category: ProposalCategory.OA,
totalValue: 0,
proposal: fip_64
}
};

Expand Down