-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into dependabot/npm_and_yarn/dotenv-14.1.0
- Loading branch information
Showing
9 changed files
with
195 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters