Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/dotenv-14.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joeysantoro committed Jan 17, 2022
2 parents 8103a96 + c2fa78c commit e657ce1
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 13 deletions.
30 changes: 30 additions & 0 deletions contracts/merger/REPTbRedeemer.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
@title Contract to exchange REPT-b for FEI
*/
contract REPTbRedeemer {
using SafeERC20 for IERC20;

event Exchange(address indexed from, address indexed to, uint256 amount);

IERC20 public immutable reptB;
IERC20 public immutable fei;

constructor(IERC20 _reptB, IERC20 _fei) {
reptB = _reptB;
fei = _fei;
}

/// @notice call to exchange REPT-b for FEI
/// @param to the destination address
/// @param amount the amount to exchange
function exchange(address to, uint256 amount) public {
reptB.safeTransferFrom(msg.sender, address(this), amount);
fei.safeTransfer(to, amount);
emit Exchange(msg.sender, to, amount);
}
}
12 changes: 11 additions & 1 deletion proposals/dao/fip_63.ts → proposals/dao/fip_67.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ export const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, con
};

export const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts) => {
const { lusdPCVDripController, lusdPSMFeiSkimmer, lusdPSM, pcvGuardian, bammDeposit, lusd } = contracts;
const {
lusdPCVDripController,
lusdPSMFeiSkimmer,
lusdPSM,
pcvGuardian,
bammDeposit,
lusd,
rariPool146EthPCVDeposit
} = contracts;

expect(await lusdPCVDripController.source()).to.be.equal(bammDeposit.address);
expect(await lusdPCVDripController.target()).to.be.equal(lusdPSM.address);
Expand All @@ -123,4 +131,6 @@ export const validate: ValidateUpgradeFunc = async (addresses, oldContracts, con
expect(await lusd.balanceOf(lusdPSM.address)).to.be.equal(0);

expect(await pcvGuardian.isSafeAddress(lusdPSM.address)).to.be.true;

expect(await rariPool146EthPCVDeposit.balance()).to.be.equal(ethers.constants.WeiPerEther.mul(2500));
};
36 changes: 36 additions & 0 deletions proposals/dao/fip_redeem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ethers } from 'hardhat';
import chai, { expect } from 'chai';
import CBN from 'chai-bn';
import {
DeployUpgradeFunc,
NamedContracts,
SetupUpgradeFunc,
TeardownUpgradeFunc,
ValidateUpgradeFunc
} from '@custom-types/types';

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

export const deploy: DeployUpgradeFunc = async (deployAddress, addresses, logging = false) => {
const { fei, reptb } = addresses;

// 1. Deploy Redeemer
const reptbRedeemer = await (await ethers.getContractFactory('REPTbRedeemer')).deploy(fei, reptb);

return {
reptbRedeemer
} 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 { fei, pegExchanger, reptbRedeemer } = contracts;
console.log('Validating');
expect(await fei.balanceOf(reptbRedeemer.address)).to.be.equal(ethers.constants.WeiPerEther.mul(12_000_000));
expect(await pegExchanger.expirationTimestamp()).to.be.equal(1659312000);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ProposalDescription } from '@custom-types/types';

const fip_62: ProposalDescription = {
title: 'FIP-67: Create Backup LUSD PSM',
const fip_67: ProposalDescription = {
title: 'FIP-65: Tribe ETH Fuse Pool, FIP-67: Create Backup LUSD PSM',
commands: [
/// CR Oracle ops
{
Expand Down Expand Up @@ -71,19 +71,46 @@ const fip_62: ProposalDescription = {
method: 'setSafeAddress(address)',
arguments: ['{lusdPSM}'],
description: 'Set the LUSD PSM as a safe address'
},
/// FIP-65
{
target: 'compoundEthPCVDeposit',
values: '0',
method: 'withdraw(address,uint256)',
arguments: ['{rariPool146EthPCVDeposit}', '2500000000000000000000'],
description: 'withdraw 2500 ETH to rariPool146 ETH PCV Deposit'
},
{
target: 'rariPool146EthPCVDeposit',
values: '0',
method: 'deposit()',
arguments: [],
description: 'deposit on rari pool 146 ETH PCV Deposit'
},
{
target: 'collateralizationOracle',
values: '0',
method: 'addDeposit(address)',
arguments: ['{rariPool146EthPCVDeposit}'],
description: 'Add rari pool 146 ETH PCV Deposit to cr oracle'
}
],
description: `
This proposal operationalizes the LUSD PSM:
FIP 65 sends 2500 ETH from Compound to the Tribe ETH Fuse pool. This allows for levering on stETH interest rates.
Forum: https://tribe.fei.money/t/fip-65-tribe-eth-fuse-pool/3862
FIP-67 proposal deploys a backup LUSD PSM, initially paused:
1. Add the LUSD PSM to the CR Oracle
2. Pause LUSD PCVDripController
3. Pause LUSD lusdPSMFeiSkimmer
4. Pause minting and redemptions on the newly created lusd PSM
5. Grant the LUSD PSM the minter role
6. Grant PCV Controller to the lusdPCVDripController and lusdPSMFeiSkimmer
Forum: https://tribe.fei.money/t/fip-67-backup-lusd-redeemability-module/3875
Code: https://github.com/fei-protocol/fei-protocol-core/pull/456
`
};

export default fip_62;
export default fip_67;
24 changes: 24 additions & 0 deletions proposals/description/fip_redeem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ProposalDescription } from '@custom-types/types';

const fip_redeemer: ProposalDescription = {
title: 'REPT-B Redemption',
commands: [
{
target: 'fei',
values: '0',
method: 'mint(address,uint256)',
arguments: ['{reptbRedeemer}', '12000000000000000000000000'],
description: 'Mint FEI to the ReptB Redeemer'
},
{
target: 'pegExchanger',
values: '0',
method: 'setExpirationTimestamp(uint256)',
arguments: ['1659312000'],
description: 'Expire peg exchanger'
}
],
description: ``
};

export default fip_redeemer;
3 changes: 2 additions & 1 deletion protocol-configuration/collateralizationOracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const collateralizationAddresses = {
'aaveEthPCVDepositWrapper',
'uniswapPCVDeposit',
'ethTokemakPCVDeposit',
'ethPSM'
'ethPSM',
'rariPool146EthPCVDeposit'
],
dpi: ['dpiUniswapPCVDeposit', 'rariPool19DpiPCVDepositWrapper'],
rai: ['rariPool9RaiPCVDepositWrapper', 'aaveRaiPCVDepositWrapper'],
Expand Down
28 changes: 25 additions & 3 deletions protocol-configuration/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const dependencies: DependencyMap = {
'indexDelegator',
'liquityFusePoolLusdPCVDeposit',
'poolPartyFeiPCVDeposit',
'rariPool146EthPCVDeposit',
'rariPool18FeiPCVDeposit',
'rariPool19DpiPCVDeposit',
'rariPool19FeiPCVDeposit',
Expand Down Expand Up @@ -147,7 +148,8 @@ const dependencies: DependencyMap = {
'restrictedPermissions',
'ethPSMFeiSkimmer',
'daiPSMFeiSkimmer',
'rariInfraFeiTimelock'
'rariInfraFeiTimelock',
'reptbRedeemer'
]
},
ethPSMFeiSkimmer: {
Expand Down Expand Up @@ -203,7 +205,8 @@ const dependencies: DependencyMap = {
'tribeReserveStabilizer',
'rariPool8Fei3Crv',
'rariPool8d3',
'rariInfraTribeTimelock'
'rariInfraTribeTimelock',
'pegExchanger'
]
},
tribeMinter: {
Expand All @@ -221,7 +224,8 @@ const dependencies: DependencyMap = {
'creamDepositWrapper',
'aaveTribeIncentivesController',
'tribeMinter',
'pcvGuardian'
'pcvGuardian',
'pegExchanger'
]
},
guardian: {
Expand Down Expand Up @@ -360,6 +364,18 @@ const dependencies: DependencyMap = {
poolPartyFeiPCVDeposit: {
contractDependencies: ['core', 'fei']
},
rariPool146EthPCVDeposit: {
contractDependencies: ['core', 'rariPool146Eth']
},
rariPool146Comptroller: {
contractDependencies: ['rariPool146FuseAdmin', 'rariPool146Eth']
},
rariPool146FuseAdmin: {
contractDependencies: ['rariPool146Comptroller']
},
rariPool146Eth: {
contractDependencies: ['rariPool146Comptroller', 'rariPool146EthPCVDeposit']
},
rariPool18FeiPCVDeposit: {
contractDependencies: ['core', 'fei']
},
Expand Down Expand Up @@ -875,6 +891,12 @@ const dependencies: DependencyMap = {
},
rariPool8TribeIrm: {
contractDependencies: ['rariPool8Tribe']
},
reptbRedeemer: {
contractDependencies: ['fei']
},
pegExchanger: {
contractDependencies: ['tribe', 'feiDAOTimelock']
}
};

Expand Down
20 changes: 20 additions & 0 deletions protocol-configuration/mainnetAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ const MainnetAddresses: MainnetAddresses = {
address: '0x7Eb88140af813294aEDce981b6aC08fcd139d408',
category: AddressCategory.PCV
},
rariPool146EthPCVDeposit: {
artifactName: 'EthCompoundPCVDeposit',
address: '0xC68412B72e68c30D4E6c0854b439CBBe957146e4',
category: AddressCategory.PCV
},
rariPool18FeiPCVDepositWrapper: {
artifactName: 'PCVDepositWrapper',
address: '0x07F2DD7E6A78D96c08D0a8212f4097dCC129d629',
Expand Down Expand Up @@ -801,6 +806,11 @@ const MainnetAddresses: MainnetAddresses = {
address: '0x6d64D080345C446dA31b8D3855bA6d9C0fC875D2',
category: AddressCategory.FeiRari
},
rariPool146Eth: {
artifactName: 'unknown',
address: '0xfbD8Aaf46Ab3C2732FA930e5B343cd67cEA5054C',
category: AddressCategory.FeiRari
},
fuseAdmin: {
artifactName: 'FuseAdmin',
address: '0x761dD1Ae03D95BdABeC3C228532Dcdab4F2c7adD',
Expand Down Expand Up @@ -1236,6 +1246,11 @@ const MainnetAddresses: MainnetAddresses = {
address: '0x752F119bD4Ee2342CE35E2351648d21962c7CAfE',
category: AddressCategory.External
},
reptb: {
artifactName: 'IERC20',
address: '0x6c806eDDAd78A5505Fce27B18C6f859fc9739BEc',
category: AddressCategory.External
},
reflexerStableAssetFusePoolRai: {
artifactName: 'CErc20Delegator',
address: '0x752F119bD4Ee2342CE35E2351648d21962c7CAfE',
Expand Down Expand Up @@ -1600,6 +1615,11 @@ const MainnetAddresses: MainnetAddresses = {
artifactName: 'LinearTimelockedDelegator',
address: '0x625cf6AA7DafB154F3Eb6BE87592110e30290dEe',
category: AddressCategory.TBD
},
reptbRedeemer: {
artifactName: 'REPTbRedeemer',
address: '0x362e7278Bf74389781812A1201e7A400872A0598',
category: AddressCategory.TBD
}
};

Expand Down
20 changes: 16 additions & 4 deletions test/integration/proposals_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { ProposalCategory, ProposalsConfigMap } from '@custom-types/types';
// import fip_xx_proposal from '@proposals/description/fip_xx';

import fip_60b from '@proposals/description/old/fip_60b';
import fip_63 from '@proposals/description/fip_63';
import fip_67 from '@proposals/description/fip_67';
import fip_64 from '@proposals/description/fip_64';
import fip_redeem from '@proposals/description/fip_redeem';

const proposals: ProposalsConfigMap = {
/*
Expand All @@ -15,6 +16,15 @@ const proposals: ProposalsConfigMap = {
proposal: fip_xx_proposal // full proposal file, imported from '@proposals/description/fip_xx.ts'
}
*/
fip_redeem: {
deploy: false,
proposalId: undefined,
affectedContractSignoff: ['reptbRedeemer', 'fei', 'pegExchanger'],
deprecatedContractSignoff: [],
category: ProposalCategory.DAO,
totalValue: 0,
proposal: fip_redeem
},
fip_60b: {
deploy: false,
proposalId: undefined,
Expand All @@ -38,7 +48,7 @@ const proposals: ProposalsConfigMap = {
totalValue: 0,
proposal: fip_60b
},
fip_63: {
fip_67: {
deploy: false,
proposalId: undefined,
affectedContractSignoff: [
Expand All @@ -47,12 +57,14 @@ const proposals: ProposalsConfigMap = {
'lusdPSMFeiSkimmer',
'collateralizationOracle',
'core',
'pcvGuardian'
'pcvGuardian',
'rariPool146EthPCVDeposit',
'compoundEthPCVDeposit'
],
deprecatedContractSignoff: [],
category: ProposalCategory.DAO,
totalValue: 0,
proposal: fip_63
proposal: fip_67
},
fip_64: {
deploy: false,
Expand Down

0 comments on commit e657ce1

Please sign in to comment.