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

Wrapped OUSD #957

Merged
merged 13 commits into from
Apr 11, 2022
Prev Previous commit
Next Next commit
Update proxy initialize to set non-immutable constructor fields.
  • Loading branch information
DanielVF committed Mar 28, 2022
commit 21d5006773635f859d37b519eef67fc0b039d95c
8 changes: 7 additions & 1 deletion contracts/contracts/token/WrappedOusd.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ contract WrappedOusd is ERC4626, Governable, Initializable {
/**
* @notice Enable OUSD rebasing for this contract
*/
function initialize() external onlyGovernor initializer {
function initialize(string memory _name, string memory _symbol)
external
onlyGovernor
initializer
{
OUSD(address(asset)).rebaseOptIn();
name = _name;
symbol = _symbol;
}

/**
Expand Down
22 changes: 17 additions & 5 deletions contracts/deploy/001_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,25 @@ const deployWOusd = async () => {
const sDeployer = await ethers.provider.getSigner(deployerAddr);
const sGovernor = await ethers.provider.getSigner(governorAddr);
const ousd = await ethers.getContract("OUSDProxy");
await deployWithConfirmation("WrappedOusd", [
const dWrappedOusdImpl = await deployWithConfirmation("WrappedOusd", [
ousd.address,
"Wrapped OUSD",
"WOUSD",
"Wrapped OUSD IMPL",
"WOUSD IMPL",
]);
const wousd = await ethers.getContract("WrappedOusd");
await wousd.connect(sDeployer)["initialize()"]();
const dWrappedOusdProxy = await deployWithConfirmation("WrappedOUSDProxy");
const wousdProxy = await ethers.getContract("WrappedOUSDProxy");
const wousd = await ethers.getContractAt("WrappedOusd", wousdProxy.address);

await wousdProxy
.connect(sDeployer)
["initialize(address,address,bytes)"](
dWrappedOusdImpl.address,
deployerAddr,
[]
);
await wousd
.connect(sDeployer)
["initialize(string,string)"]("Wrapped OUSD", "WOUSD");
await wousd.connect(sDeployer).transferGovernance(governorAddr);
await wousd.connect(sGovernor).claimGovernance();
};
Expand Down
8 changes: 7 additions & 1 deletion contracts/deploy/039_wrapped_ousd.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ module.exports = deploymentWithProposal(

// 3. Initialize Wrapped OUSD
await withConfirmation(
cWrappedOUSD.connect(sDeployer)["initialize()"](await getTxOpts())
cWrappedOUSD
.connect(sDeployer)
["initialize(string,string)"](
"Wrapped OUSD",
"WOUSD",
await getTxOpts()
)
);

// 4. Assign ownership
Expand Down
3 changes: 2 additions & 1 deletion contracts/test/_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ async function defaultFixture() {
);
const dripperProxy = await ethers.getContract("DripperProxy");
const dripper = await ethers.getContractAt("Dripper", dripperProxy.address);
const wousd = await ethers.getContract("WrappedOusd");
const wousdProxy = await ethers.getContract("WrappedOUSDProxy");
const wousd = await ethers.getContractAt("WrappedOusd", wousdProxy.address);
const governorContract = await ethers.getContract("Governor");
const CompoundStrategyFactory = await ethers.getContractFactory(
"CompoundStrategy"
Expand Down
8 changes: 8 additions & 0 deletions contracts/test/token/wousd.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ describe("WOUSD", function () {
});
});

describe("Check proxy", async () => {
it("should have correct ERC20 properties", async () => {
expect(await wousd.decimals()).to.eq(18);
expect(await wousd.name()).to.eq("Wrapped OUSD");
expect(await wousd.symbol()).to.eq("WOUSD");
});
});

describe("Token recovery", async () => {
it("should allow a governor to recover tokens", async () => {
await dai.connect(matt).transfer(wousd.address, daiUnits("2"));
Expand Down