Skip to content

Commit

Permalink
Remove method to set POL token from MaticX contract
Browse files Browse the repository at this point in the history
  • Loading branch information
evercoinx committed Sep 18, 2024
1 parent 797a630 commit 92e9416
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
11 changes: 0 additions & 11 deletions contracts/MaticX.sol
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,6 @@ contract MaticX is
emit SetVersion(_version);
}

/// @notice Sets the address of the POL token.
/// @param _address - Address of the POL token
function setPOLToken(
address _address
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
require(_address != address(0), "Zero POL token address");

polToken = _address;
emit SetPOLToken(_address);
}

/// ------------------------------ Getters ---------------------------------

/// @notice Returns total pooled stake tokens from all registered validators.
Expand Down
4 changes: 0 additions & 4 deletions contracts/interfaces/IMaticX.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ interface IMaticX is IERC20Upgradeable {
/// @param _version - New version of this contract
function setVersion(string calldata _version) external;

/// @notice Sets the address of the POL token.
/// @param _address - Address of the POL token
function setPOLToken(address _address) external;

/// @notice Returns total pooled stake tokens from all registered validators.
/// @return Total pooled stake tokens
function getTotalStakeAcrossAllValidators() external view returns (uint256);
Expand Down
41 changes: 0 additions & 41 deletions test/MaticX.forking.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1847,45 +1847,4 @@ describe("MaticX (Forking)", function () {
});
});
});

describe("Set a POL token address", function () {
describe("Negative", function () {
it("Should revert with the right error if called by a non admin", async function () {
const { maticX, pol, stakerA, defaultAdminRole } =
await loadFixture(deployFixture);

const promise = maticX
.connect(stakerA)
.setPOLToken(pol.address);
await expect(promise).to.be.revertedWith(
`AccessControl: account ${stakerA.address.toLowerCase()} is missing role ${defaultAdminRole}`
);
});

it("Should revert with the right error if passing the zero POL token address", async function () {
const { maticX, manager } = await loadFixture(deployFixture);

const promise = maticX
.connect(manager)
.setPOLToken(ethers.constants.AddressZero);
await expect(promise).to.be.revertedWith(
"Zero POL token address"
);
});
});

describe("Positive", function () {
it("Should emit the SetPOLToken event", async function () {
const { maticX, pol, manager } =
await loadFixture(deployFixture);

const promise = maticX
.connect(manager)
.setPOLToken(pol.address);
await expect(promise)
.to.emit(maticX, "SetPOLToken")
.withArgs(pol.address);
});
});
});
});

0 comments on commit 92e9416

Please sign in to comment.