From 5b123982ab43d2121d3a760837c6f183442aac04 Mon Sep 17 00:00:00 2001 From: Sergey <2901744+evercoinx@users.noreply.github.com.> Date: Fri, 6 Sep 2024 22:32:32 +0200 Subject: [PATCH] Rename variable on MaticX contract --- contracts/MaticX.sol | 6 ++--- test/ChildPool.spec.ts | 16 ++++++------ test/ValidatorRegistry.spec.ts | 48 +++++++++++++++++----------------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/contracts/MaticX.sol b/contracts/MaticX.sol index 424853ce..351bdc80 100644 --- a/contracts/MaticX.sol +++ b/contracts/MaticX.sol @@ -50,21 +50,21 @@ contract MaticX is * @param _validatorRegistry - Address of the validator registry * @param _stakeManager - Address of the stake manager * @param _maticToken - Address of the MATIC token - * @param _admin - Address of the admin + * @param _manager - Address of the manager * @param _treasury - Address of the treasury */ function initialize( address _validatorRegistry, address _stakeManager, address _maticToken, - address _admin, + address _manager, address _treasury ) external initializer { __AccessControl_init(); __Pausable_init(); __ERC20_init("Liquid Staking Matic", "MaticX"); - _setupRole(DEFAULT_ADMIN_ROLE, _admin); + _setupRole(DEFAULT_ADMIN_ROLE, _manager); validatorRegistry = _validatorRegistry; stakeManager = _stakeManager; diff --git a/test/ChildPool.spec.ts b/test/ChildPool.spec.ts index e0d83a60..f03779bf 100644 --- a/test/ChildPool.spec.ts +++ b/test/ChildPool.spec.ts @@ -18,7 +18,7 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; describe("ChildPool", () => { let childPool: ChildPool; let deployer: SignerWithAddress; - let admin: SignerWithAddress; + let manager: SignerWithAddress; let instantPoolOwner: SignerWithAddress; let treasury: SignerWithAddress; let users: SignerWithAddress[] = []; @@ -127,7 +127,7 @@ describe("ChildPool", () => { beforeEach(async () => { [deployer, ...users] = await ethers.getSigners(); - admin = deployer; + manager = deployer; treasury = users[1]; instantPoolOwner = deployer; polygonMock = (await ( @@ -148,9 +148,9 @@ describe("ChildPool", () => { fxStateRootTunnel = (await ( await ethers.getContractFactory("FxStateRootTunnel") ).deploy( - admin.address, + manager.address, fxRootMock.address, - admin.address + manager.address )) as FxStateRootTunnel; await fxStateRootTunnel.deployed(); @@ -170,7 +170,7 @@ describe("ChildPool", () => { stakeManagerMock.address, polygonMock.address, ethers.constants.AddressZero, - admin.address, + manager.address, ] )) as ValidatorRegistry; await validatorRegistry.deployed(); @@ -181,7 +181,7 @@ describe("ChildPool", () => { validatorRegistry.address, stakeManagerMock.address, polygonMock.address, - admin.address, + manager.address, treasury.address, ] )) as MaticX; @@ -192,7 +192,7 @@ describe("ChildPool", () => { [ fxStateChildTunnel.address, maticX.address, - admin.address, + manager.address, instantPoolOwner.address, treasury.address, 10, @@ -205,7 +205,7 @@ describe("ChildPool", () => { await validatorRegistry.addValidator(1); await validatorRegistry.grantRole( await validatorRegistry.BOT(), - admin.address + manager.address ); await validatorRegistry.setPreferredDepositValidatorId(1); await validatorRegistry.setPreferredWithdrawalValidatorId(1); diff --git a/test/ValidatorRegistry.spec.ts b/test/ValidatorRegistry.spec.ts index e4c7f706..c7b0cb76 100644 --- a/test/ValidatorRegistry.spec.ts +++ b/test/ValidatorRegistry.spec.ts @@ -12,7 +12,7 @@ import { describe("ValidatorRegistry contract", function () { let deployer: SignerWithAddress; - let admin: SignerWithAddress; + let manager: SignerWithAddress; let treasury: SignerWithAddress; let users: SignerWithAddress[] = []; let maticX: MaticX; @@ -87,7 +87,7 @@ describe("ValidatorRegistry contract", function () { beforeEach(async () => { [deployer, ...users] = await ethers.getSigners(); - admin = deployer; + manager = deployer; treasury = deployer; polygonMock = (await ( @@ -106,7 +106,7 @@ describe("ValidatorRegistry contract", function () { stakeManagerMock.address, polygonMock.address, ethers.constants.AddressZero, - admin.address, + manager.address, ] )) as ValidatorRegistry; await validatorRegistry.deployed(); @@ -117,7 +117,7 @@ describe("ValidatorRegistry contract", function () { validatorRegistry.address, stakeManagerMock.address, polygonMock.address, - admin.address, + manager.address, treasury.address, ] )) as MaticX; @@ -128,7 +128,7 @@ describe("ValidatorRegistry contract", function () { // add bot role for deployer await validatorRegistry.grantRole( await validatorRegistry.BOT(), - admin.address + manager.address ); }); @@ -136,7 +136,7 @@ describe("ValidatorRegistry contract", function () { const validatorIds = [3, 6]; for (const id of validatorIds) { - await createValidator(admin, id); + await createValidator(manager, id); const constractAddress = await getValidatorContract(id); expect(constractAddress).to.be.properAddress; } @@ -145,7 +145,7 @@ describe("ValidatorRegistry contract", function () { const validators = await getValidators(); expect(validators).to.be.empty; for (const id of validatorIds) { - await expect(await addValidator(admin, id)) + await expect(await addValidator(manager, id)) .emit(validatorRegistry, "AddValidator") .withArgs(id); expectedValidators.push(BigNumber.from(id)); @@ -155,12 +155,12 @@ describe("ValidatorRegistry contract", function () { }); it("Should not add existing validator", async function () { - await createValidator(admin, 1); - await expect(await addValidator(admin, 1)) + await createValidator(manager, 1); + await expect(await addValidator(manager, 1)) .emit(validatorRegistry, "AddValidator") .withArgs(1); - await expect(addValidator(admin, 1)).to.be.revertedWith( + await expect(addValidator(manager, 1)).to.be.revertedWith( "Validator id already exists in our registry" ); }); @@ -169,8 +169,8 @@ describe("ValidatorRegistry contract", function () { const validatorIds = [3, 6]; const expectedValidators = []; for (const id of validatorIds) { - await createValidator(admin, id); - await expect(await addValidator(admin, id)) + await createValidator(manager, id); + await expect(await addValidator(manager, id)) .emit(validatorRegistry, "AddValidator") .withArgs(id); expectedValidators.push(BigNumber.from(id)); @@ -179,7 +179,7 @@ describe("ValidatorRegistry contract", function () { const validators = await getValidators(); expect(validators).to.eql(expectedValidators); for (const id of validatorIds) { - await expect(await removeValidator(admin, id)) + await expect(await removeValidator(manager, id)) .emit(validatorRegistry, "RemoveValidator") .withArgs(id); expectedValidators.splice(0, 1); @@ -189,31 +189,31 @@ describe("ValidatorRegistry contract", function () { }); it("Should not remove an validator when it is preferred for deposits", async function () { - await createValidator(admin, 1); - await addValidator(admin, 1); - await expect(await setPreferredDepositValidatorId(admin, 1)) + await createValidator(manager, 1); + await addValidator(manager, 1); + await expect(await setPreferredDepositValidatorId(manager, 1)) .emit(validatorRegistry, "SetPreferredDepositValidatorId") .withArgs(1); - await expect(removeValidator(admin, 1)).to.be.revertedWith( + await expect(removeValidator(manager, 1)).to.be.revertedWith( "Can't remove a preferred validator for deposits" ); }); it("Should not remove an validator when it is preferred for withdrawals", async function () { - await createValidator(admin, 1); - await addValidator(admin, 1); - await expect(await setPreferredWithdrawalValidatorId(admin, 1)) + await createValidator(manager, 1); + await addValidator(manager, 1); + await expect(await setPreferredWithdrawalValidatorId(manager, 1)) .emit(validatorRegistry, "SetPreferredWithdrawalValidatorId") .withArgs(1); - await expect(removeValidator(admin, 1)).to.be.revertedWith( + await expect(removeValidator(manager, 1)).to.be.revertedWith( "Can't remove a preferred validator for withdrawals" ); }); it("Should not remove non existing validator", async function () { - await expect(removeValidator(admin, 1)).to.be.revertedWith( + await expect(removeValidator(manager, 1)).to.be.revertedWith( "Validator id doesn't exist in our registry" ); }); @@ -245,8 +245,8 @@ describe("ValidatorRegistry contract", function () { it("it should setPreferredDepositValidatorId - accesscontrol check", async () => { const validatorId = BigNumber.from(1); - await createValidator(admin, validatorId); - await addValidator(admin, validatorId); + await createValidator(manager, validatorId); + await addValidator(manager, validatorId); const botRole = await validatorRegistry.BOT(); await validatorRegistry.grantRole(botRole, users[1].address);