@@ -3,10 +3,9 @@ import { log } from "console";
33import { ethers , deployments } from "hardhat" ;
44import { DeployResult } from "hardhat-deploy/types" ;
55import { deployUpgradable } from "../../deploy/utils/deployUpgradable" ;
6- import {
7- UUPSUpgradableInitializableInheritanceV1 ,
8- UUPSUpgradableInitializableInheritanceV2 ,
9- } from "../../typechain-types" ;
6+ import { UpgradedByInheritanceV1 , UpgradedByInheritanceV2 } from "../../typechain-types" ;
7+ import { UpgradedByRewrite as UpgradedByRewriteV1 } from "../../typechain-types/src/proxy/mock/by-rewrite" ;
8+ import { UpgradedByRewrite as UpgradedByRewriteV2 } from "../../typechain-types/src/proxy/mock/by-rewrite/UpgradedByRewriteV2.sol" ;
109
1110let deployer ;
1211let user1 ;
@@ -119,8 +118,8 @@ describe("Upgradability", async () => {
119118 before ( "Setup Contracts" , async ( ) => {
120119 [ deployer ] = await ethers . getSigners ( ) ;
121120
122- proxyDeployment = await deployUpgradable ( deployments , "UUPSUpgradableInitializable " , {
123- contract : "src/proxy/mock/UUPSUpgradableInitializable .sol:UUPSUpgradableInitializable " ,
121+ proxyDeployment = await deployUpgradable ( deployments , "UpgradedByRewrite " , {
122+ contract : "src/proxy/mock/by-rewrite/UpgradedByRewrite .sol:UpgradedByRewrite " ,
124123 from : deployer . address ,
125124 args : [ deployer . address ] ,
126125 log : true ,
@@ -131,11 +130,9 @@ describe("Upgradability", async () => {
131130 } ) ;
132131
133132 it ( "Initializes v1" , async ( ) => {
134- proxy = ( await ethers . getContract ( "UUPSUpgradableInitializable " ) ) as UUPSUpgradableInitializableInheritanceV1 ;
133+ proxy = ( await ethers . getContract ( "UpgradedByRewrite " ) ) as UpgradedByRewriteV1 ;
135134
136- implementation = ( await ethers . getContract (
137- "UUPSUpgradableInitializable_Implementation"
138- ) ) as UUPSUpgradableInitializableInheritanceV1 ;
135+ implementation = ( await ethers . getContract ( "UpgradedByRewrite_Implementation" ) ) as UpgradedByRewriteV1 ;
139136
140137 expect ( await proxy . governor ( ) ) . to . equal ( deployer . address ) ;
141138
@@ -150,16 +147,16 @@ describe("Upgradability", async () => {
150147 } ) ;
151148
152149 it ( "Upgrades to v2 and initializes" , async ( ) => {
153- proxyDeployment = await deployUpgradable ( deployments , "UUPSUpgradableInitializable " , {
154- contract : "src/proxy/mock/UUPSUpgradableInitializableV2 .sol:UUPSUpgradableInitializable " ,
150+ proxyDeployment = await deployUpgradable ( deployments , "UpgradedByRewrite " , {
151+ contract : "src/proxy/mock/by-rewrite/UpgradedByRewriteV2 .sol:UpgradedByRewrite " ,
155152 from : deployer . address ,
156153 args : [ "Future of France" ] ,
157154 log : true ,
158155 } ) ;
159156 if ( ! proxyDeployment . implementation ) {
160157 throw new Error ( "No implementation address" ) ;
161158 }
162- proxy = ( await ethers . getContract ( "UUPSUpgradableInitializable " ) ) as UUPSUpgradableInitializableInheritanceV2 ;
159+ proxy = ( await ethers . getContract ( "UpgradedByRewrite " ) ) as UpgradedByRewriteV2 ;
163160 expect ( await proxy . governor ( ) ) . to . equal ( deployer . address ) ;
164161
165162 expect ( await proxy . counter ( ) ) . to . equal ( 3 ) ;
@@ -176,7 +173,7 @@ describe("Upgradability", async () => {
176173 before ( "Setup Contracts" , async ( ) => {
177174 [ deployer ] = await ethers . getSigners ( ) ;
178175
179- proxyDeployment = await deployUpgradable ( deployments , "UUPSUpgradableInitializableInheritanceV1 " , {
176+ proxyDeployment = await deployUpgradable ( deployments , "UpgradedByInheritanceV1 " , {
180177 from : deployer . address ,
181178 args : [ deployer . address ] ,
182179 log : true ,
@@ -187,13 +184,9 @@ describe("Upgradability", async () => {
187184 } ) ;
188185
189186 it ( "Initializes v1" , async ( ) => {
190- proxy = ( await ethers . getContract (
191- "UUPSUpgradableInitializableInheritanceV1"
192- ) ) as UUPSUpgradableInitializableInheritanceV1 ;
187+ proxy = ( await ethers . getContract ( "UpgradedByInheritanceV1" ) ) as UpgradedByInheritanceV1 ;
193188
194- implementation = ( await ethers . getContract (
195- "UUPSUpgradableInitializableInheritanceV1_Implementation"
196- ) ) as UUPSUpgradableInitializableInheritanceV1 ;
189+ implementation = ( await ethers . getContract ( "UpgradedByInheritanceV1_Implementation" ) ) as UpgradedByInheritanceV1 ;
197190
198191 expect ( await proxy . governor ( ) ) . to . equal ( deployer . address ) ;
199192
@@ -208,17 +201,15 @@ describe("Upgradability", async () => {
208201 } ) ;
209202
210203 it ( "Upgrades to v2 and initializes" , async ( ) => {
211- proxyDeployment = await deployUpgradable ( deployments , "UUPSUpgradableInitializableInheritanceV1 " , {
212- newImplementation : "UUPSUpgradableInitializableInheritanceV2 " ,
204+ proxyDeployment = await deployUpgradable ( deployments , "UpgradedByInheritanceV1 " , {
205+ newImplementation : "UpgradedByInheritanceV2 " ,
213206 initializer : "initializeV2" ,
214207 from : deployer . address ,
215208 args : [ "Future of France" ] ,
216209 log : true ,
217210 } ) ;
218211
219- proxy = ( await ethers . getContract (
220- "UUPSUpgradableInitializableInheritanceV1"
221- ) ) as UUPSUpgradableInitializableInheritanceV2 ;
212+ proxy = ( await ethers . getContract ( "UpgradedByInheritanceV1" ) ) as UpgradedByInheritanceV2 ;
222213
223214 expect ( await proxy . governor ( ) ) . to . equal ( deployer . address ) ;
224215
@@ -233,8 +224,8 @@ describe("Upgradability", async () => {
233224
234225 it ( "Cannot upgrade to v3 which has an invalid initializer" , async ( ) => {
235226 await expect (
236- deployUpgradable ( deployments , "UUPSUpgradableInitializableInheritanceV1 " , {
237- newImplementation : "UUPSUpgradableInitializableInheritanceV3Bad " ,
227+ deployUpgradable ( deployments , "UpgradedByInheritanceV1 " , {
228+ newImplementation : "UpgradedByInheritanceV3Bad " ,
238229 initializer : "initializeV3" ,
239230 from : deployer . address ,
240231 args : [ ] ,
0 commit comments