diff --git a/audit/20240703-cantina-report-maker-nst.pdf b/audit/20240703-cantina-report-review-makerdao-nst.pdf similarity index 100% rename from audit/20240703-cantina-report-maker-nst.pdf rename to audit/20240703-cantina-report-review-makerdao-nst.pdf diff --git a/audit/20240926-cantina-report-review-makerdao-usds.pdf b/audit/20240926-cantina-report-review-makerdao-usds.pdf new file mode 100644 index 0000000..875f598 Binary files /dev/null and b/audit/20240926-cantina-report-review-makerdao-usds.pdf differ diff --git a/audit/20240904-ChainSecurity_MakerDAO_USDS_audit.pdf b/audit/20240930-ChainSecurity_MakerDAO_USDS_audit.pdf similarity index 96% rename from audit/20240904-ChainSecurity_MakerDAO_USDS_audit.pdf rename to audit/20240930-ChainSecurity_MakerDAO_USDS_audit.pdf index 08aa783..c3f8e90 100644 Binary files a/audit/20240904-ChainSecurity_MakerDAO_USDS_audit.pdf and b/audit/20240930-ChainSecurity_MakerDAO_USDS_audit.pdf differ diff --git a/deploy/UsdsDeploy.sol b/deploy/UsdsDeploy.sol index 2f6c0cb..de44866 100644 --- a/deploy/UsdsDeploy.sol +++ b/deploy/UsdsDeploy.sol @@ -23,7 +23,7 @@ import { Usds } from "src/Usds.sol"; import { UsdsJoin } from "src/UsdsJoin.sol"; import { DaiUsds } from "src/DaiUsds.sol"; -import { UsdsInstance } from "./UsdsInstance.sol"; +import { UsdsInstance, UsdsL2Instance } from "./UsdsInstance.sol"; interface DaiJoinLike { function vat() external view returns (address); @@ -47,4 +47,16 @@ library UsdsDeploy { instance.usdsJoin = _usdsJoin; instance.daiUsds = _daiUsds; } + + function deployL2( + address deployer, + address owner + ) internal returns (UsdsL2Instance memory instance) { + address _usdsImp = address(new Usds()); + address _usds = address((new ERC1967Proxy(_usdsImp, abi.encodeCall(Usds.initialize, ())))); + ScriptTools.switchOwner(_usds, deployer, owner); + + instance.usds = _usds; + instance.usdsImp = _usdsImp; + } } diff --git a/deploy/UsdsInstance.sol b/deploy/UsdsInstance.sol index ddf7a1c..c723dfd 100644 --- a/deploy/UsdsInstance.sol +++ b/deploy/UsdsInstance.sol @@ -22,3 +22,8 @@ struct UsdsInstance { address usdsJoin; address daiUsds; } + +struct UsdsL2Instance { + address usds; + address usdsImp; +} diff --git a/test/L2Deployment.t.sol b/test/L2Deployment.t.sol new file mode 100644 index 0000000..e820588 --- /dev/null +++ b/test/L2Deployment.t.sol @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: © 2024 Dai Foundation +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +pragma solidity ^0.8.21; + +import "dss-test/DssTest.sol"; + +import { Upgrades } from "openzeppelin-foundry-upgrades/Upgrades.sol"; + +import { UsdsL2Instance } from "deploy/UsdsInstance.sol"; +import { UsdsDeploy } from "deploy/UsdsDeploy.sol"; + +import { Usds } from "src/Usds.sol"; + +contract L2DeploymentTest is DssTest { + + address l2GovRelay = address(222); + UsdsL2Instance inst; + + function setUp() public { + inst = UsdsDeploy.deployL2(address(this), l2GovRelay); + } + + function testSetUp() public view { + assertEq(Usds(inst.usds).wards(l2GovRelay), 1); + assertEq(Usds(inst.usds).wards(address(this)), 0); + assertEq(Upgrades.getImplementationAddress(inst.usds), inst.usdsImp); + assertEq(Usds(inst.usds).version(), "1"); + } +}