Skip to content

Commit 5ae5940

Browse files
authored
Merge pull request #369 from push-protocol/366-bump-down-oz-version-for-pgp-registry
Downgraded OZ version to 4.9.0
2 parents 8c210d5 + 6ab07f5 commit 5ae5940

File tree

15 files changed

+42
-53
lines changed

15 files changed

+42
-53
lines changed

contracts/PushComm/EPNSCommAdmin.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ pragma solidity ^0.8.20;
55
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
66

77
contract EPNSCommAdmin is ProxyAdmin {
8-
constructor(address _pushChannelAdmin) public ProxyAdmin(_pushChannelAdmin) { }
8+
constructor(address _pushChannelAdmin) public ProxyAdmin() { }
99
}

contracts/PushCore/EPNSCoreAdmin.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ pragma solidity ^0.8.20;
55
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
66

77
contract EPNSCoreAdmin is ProxyAdmin {
8-
constructor(address _pushChannelAdmin) public ProxyAdmin(_pushChannelAdmin) { }
8+
constructor(address _pushChannelAdmin) public ProxyAdmin() { }
99
}

contracts/PushCore/PushCoreV3.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { CoreTypes } from "../libraries/DataTypes.sol";
2222
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
2323
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
2424
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
25-
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
25+
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
2626

2727
contract PushCoreV3 is Initializable, PushCoreStorageV1_5, PausableUpgradeable, PushCoreStorageV2, IPushCoreV3 {
2828
using SafeERC20 for IERC20;

contracts/libraries/Errors.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ library Errors {
2222
error InvalidArg_MoreThanExpected(uint256 max_threshold, uint256 actual_value);
2323
/// @notice Reverts when uint256 argument passed is less than expected value.
2424
error InvalidArg_LessThanExpected(uint256 min_threshold, uint256 actual_value);
25-
/// @notice Reverts when operation failed because the contract is paused.
26-
error EnforcedPause();
2725
/// @notice The caller account is not authorized to perform an operation.
2826
error OwnableUnauthorizedAccount(address account);
2927

contracts/mocks/PushCoreMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { PushCoreStorageV2 } from "../PushCore/PushCoreStorageV2.sol";
1616

1717
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
1818
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
19-
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
19+
import { PausableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
2020

2121
contract PushCoreMock is Initializable, PushCoreStorageV1_5, PausableUpgradeable, PushCoreStorageV2 {
2222
using SafeERC20 for IERC20;

contracts/token/Push.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ contract Push is Ownable{
103103
* @notice Construct a new PUSH token
104104
* @param account The initial account to grant all the tokens
105105
*/
106-
constructor(address account) Ownable(account){
106+
constructor(address account) Ownable(){
107107
// holder weight initial adjustments
108108
holderWeight[account] = block.number;
109109
born = block.number;

contracts/token/PushMigration.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
66
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
77
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
88
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
9-
import { PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
9+
import { PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
1010

1111
contract PushMigrationHelper is OwnableUpgradeable, PausableUpgradeable{
1212
using SafeERC20 for IERC20;
@@ -32,7 +32,7 @@ contract PushMigrationHelper is OwnableUpgradeable, PausableUpgradeable{
3232
function initialize(address _owner, address _oldToken) external initializer {
3333
oldPushToken = IERC20(_oldToken);
3434

35-
__Ownable_init(_owner);
35+
__Ownable_init();
3636
}
3737

3838
function pauseContract() external onlyOwner{

package-lock.json

Lines changed: 8 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"dependencies": {
2424
"@nomiclabs/hardhat-ethers": "^2.0.2",
2525
"@nomiclabs/hardhat-waffle": "^2.0.1",
26-
"@openzeppelin/contracts": "^5.0.0",
27-
"@openzeppelin/contracts-upgradeable": "^5.0.0",
26+
"@openzeppelin/contracts": "^4.9.0",
27+
"@openzeppelin/contracts-upgradeable": "^4.9.0",
2828
"bip39": "3.0.3",
2929
"chai": "^4.3.4",
3030
"chalk": "^4.1.1",

test/BaseTest.t.sol

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {EPNSCommProxy} from "contracts/PushComm/EPNSCommProxy.sol";
1515
import {EPNSCommAdmin} from "contracts/PushComm/EPNSCommAdmin.sol";
1616
import {PushMigrationHelper} from "contracts/token/PushMigration.sol";
1717
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
18+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
1819

1920
import {Actors} from "./utils/Actors.sol";
2021
import {Events} from "./utils/Events.sol";
@@ -35,6 +36,7 @@ abstract contract BaseTest is Test, Constants, Events {
3536
PushMigrationHelper public pushMigrationHelper;
3637
PushMigrationHelper public pushMigrationHelperProxy;
3738
TransparentUpgradeableProxy public pushMigrationProxy;
39+
ProxyAdmin public pushProxyAdmin;
3840

3941
/* ***************
4042
Main Actors in Test
@@ -79,12 +81,14 @@ abstract contract BaseTest is Test, Constants, Events {
7981
tim_push_holder: createActor("tim_push_holder")
8082
});
8183

84+
changePrank(actor.admin);
8285
pushNttToken = new Push(actor.admin);
86+
pushProxyAdmin = new ProxyAdmin();
8387

8488
// Initialize pushMigration proxy admin and proxy contract
8589
pushMigrationProxy = new TransparentUpgradeableProxy(
8690
address(pushMigrationHelper),
87-
actor.admin,
91+
address(pushProxyAdmin),
8892
abi.encodeWithSignature(
8993
"initialize(address,address)",
9094
actor.admin,
@@ -95,13 +99,14 @@ abstract contract BaseTest is Test, Constants, Events {
9599
address(pushMigrationProxy)
96100
);
97101
// set governance as minter of ntt token
98-
vm.prank(actor.admin);
102+
changePrank(actor.admin);
99103
pushNttToken.setMinter(actor.governance);
100104

105+
epnsCoreProxyAdmin = new EPNSCoreAdmin(actor.admin);
101106
// Initialize coreMock proxy admin and coreProxy contract
102107
epnsCoreProxy = new EPNSCoreProxy(
103108
address(coreMock),
104-
actor.admin,
109+
address(epnsCoreProxyAdmin),
105110
actor.admin,
106111
address(pushToken),
107112
address(0), // WETH Address
@@ -111,25 +116,14 @@ abstract contract BaseTest is Test, Constants, Events {
111116
address(0), // aDai address
112117
0
113118
);
114-
address admin = address(
115-
uint160(
116-
uint256(
117-
vm.load(
118-
address(epnsCoreProxy),
119-
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103
120-
)
121-
)
122-
)
123-
);
124-
vm.prank(actor.admin);
125-
EPNSCoreAdmin(admin).upgradeAndCall(
119+
changePrank(actor.admin);
120+
epnsCoreProxyAdmin.upgrade(
126121
ITransparentUpgradeableProxy(address(epnsCoreProxy)),
127-
address(coreProxy),
128-
""
122+
address(coreProxy)
129123
);
130124

131125
coreProxy = PushCoreV3(address(epnsCoreProxy));
132-
vm.prank(tokenDistributor);
126+
changePrank(tokenDistributor);
133127
pushToken.transfer(address(coreProxy), 1 ether);
134128

135129
// Initialize comm proxy admin and commProxy contract
@@ -143,7 +137,7 @@ abstract contract BaseTest is Test, Constants, Events {
143137
commProxy = PushCommV3(address(epnsCommProxy));
144138

145139
// Set-up Core Address in Comm & Vice-Versa
146-
vm.startPrank(actor.admin);
140+
changePrank(actor.admin);
147141
commProxy.setEPNSCoreAddress(address(coreProxy));
148142
commProxy.setPushTokenAddress(address(pushToken));
149143
coreProxy.setEpnsCommunicatorAddress(address(commProxy));

0 commit comments

Comments
 (0)