-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from 0xPolygon/feat/pol
feat: PIP-42 change token to POL
- Loading branch information
Showing
47 changed files
with
5,047 additions
and
537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
broadcast/UpgradeDepositManager_Sepolia.s.sol/11155111/run-1721057237.json
Large diffs are not rendered by default.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
broadcast/UpgradeDepositManager_Sepolia.s.sol/11155111/run-latest.json
Large diffs are not rendered by default.
Oops, something went wrong.
112 changes: 112 additions & 0 deletions
112
broadcast/UpgradeStakeManager_Sepolia.s.sol/11155111/run-1721057742.json
Large diffs are not rendered by default.
Oops, something went wrong.
112 changes: 112 additions & 0 deletions
112
broadcast/UpgradeStakeManager_Sepolia.s.sol/11155111/run-latest.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.5.17; | ||
|
||
/* | ||
meant for testing only, adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.2/contracts/utils/cryptography/EIP712.sol | ||
modifications: | ||
- removed `immutable` since was it introduced in solidity 0.6.5 but we have to adhere to 0.5.17 | ||
- added chainId method since block.chainid isn't available yet | ||
- removed `_nameFallback` & `_versionFallback` | ||
*/ | ||
|
||
contract EIP712 { | ||
/* solhint-disable var-name-mixedcase */ | ||
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to | ||
// invalidate the cached domain separator if the chain id changes. | ||
bytes32 private _CACHED_DOMAIN_SEPARATOR; | ||
uint256 private _CACHED_CHAIN_ID; | ||
|
||
bytes32 private _HASHED_NAME; | ||
bytes32 private _HASHED_VERSION; | ||
bytes32 private _TYPE_HASH; | ||
|
||
string private _VERSION; | ||
/* solhint-enable var-name-mixedcase */ | ||
|
||
/** | ||
* @dev Initializes the domain separator and parameter caches. | ||
* | ||
* The meaning of `name` and `version` is specified in | ||
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: | ||
* | ||
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. | ||
* - `version`: the current major version of the signing domain. | ||
* | ||
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart | ||
* contract upgrade]. | ||
*/ | ||
constructor(string memory name, string memory version) public { | ||
bytes32 hashedName = keccak256(bytes(name)); | ||
bytes32 hashedVersion = keccak256(bytes(version)); | ||
bytes32 typeHash = keccak256( | ||
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" | ||
); | ||
_HASHED_NAME = hashedName; | ||
_HASHED_VERSION = hashedVersion; | ||
_CACHED_CHAIN_ID = _chainId(); | ||
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); | ||
_TYPE_HASH = typeHash; | ||
} | ||
|
||
function version() external view returns (string memory) { | ||
return _VERSION; | ||
} | ||
|
||
function _chainId() internal pure returns (uint chainId) { | ||
assembly { | ||
chainId := chainid() | ||
} | ||
} | ||
|
||
/** | ||
* @dev Returns the domain separator for the current chain. | ||
*/ | ||
function _domainSeparatorV4() internal view returns (bytes32) { | ||
if (_chainId() == _CACHED_CHAIN_ID) { | ||
return _CACHED_DOMAIN_SEPARATOR; | ||
} else { | ||
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); | ||
} | ||
} | ||
|
||
function _buildDomainSeparator( | ||
bytes32 typeHash, | ||
bytes32 nameHash, | ||
bytes32 versionHash | ||
) private view returns (bytes32) { | ||
return keccak256(abi.encode(typeHash, nameHash, versionHash, _chainId(), address(this))); | ||
} | ||
|
||
/** | ||
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this | ||
* function returns the hash of the fully encoded EIP712 message for this domain. | ||
* | ||
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: | ||
* | ||
* ```solidity | ||
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( | ||
* keccak256("Mail(address to,string contents)"), | ||
* mailTo, | ||
* keccak256(bytes(mailContents)) | ||
* ))); | ||
* address signer = ECDSA.recover(digest, signature); | ||
* ``` | ||
*/ | ||
function _hashTypedDataV4(bytes32 structHash) internal view returns (bytes32) { | ||
return _toTypedDataHash(_domainSeparatorV4(), structHash); | ||
} | ||
|
||
/** | ||
* @dev Returns an Ethereum Signed Typed Data, created from a | ||
* `domainSeparator` and a `structHash`. This produces hash corresponding | ||
* to the one signed with the | ||
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] | ||
* JSON-RPC method as part of EIP-712. | ||
*/ | ||
function _toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { | ||
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.5.17; | ||
|
||
interface IERC20Permit { | ||
function permit( | ||
address owner, | ||
address spender, | ||
uint256 value, | ||
uint256 deadline, | ||
uint8 v, | ||
bytes32 r, | ||
bytes32 s | ||
) external; | ||
|
||
function nonces(address owner) external view returns (uint256); | ||
|
||
// solhint-disable-next-line func-name-mixedcase | ||
function DOMAIN_SEPARATOR() external view returns (bytes32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
pragma solidity 0.5.17; | ||
|
||
interface IPolygonMigration { | ||
event Migrated(address indexed account, uint256 amount); | ||
event Unmigrated(address indexed account, address indexed recipient, uint256 amount); | ||
event UnmigrationLockUpdated(bool lock); | ||
|
||
function migrate(uint256 amount) external; | ||
function unmigrate(uint256 amount) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.4; | ||
|
||
// extracted using cast interface 0xCaf0aa768A3AE1297DF20072419Db8Bb8b5C8cEf | ||
|
||
interface Timelock { | ||
event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data); | ||
event CallScheduled( | ||
bytes32 indexed id, | ||
uint256 indexed index, | ||
address target, | ||
uint256 value, | ||
bytes data, | ||
bytes32 predecessor, | ||
uint256 delay | ||
); | ||
event Cancelled(bytes32 indexed id); | ||
event MinDelayChange(uint256 oldDuration, uint256 newDuration); | ||
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); | ||
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); | ||
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); | ||
|
||
receive() external payable; | ||
|
||
function DEFAULT_ADMIN_ROLE() external view returns (bytes32); | ||
function EXECUTOR_ROLE() external view returns (bytes32); | ||
function PROPOSER_ROLE() external view returns (bytes32); | ||
function TIMELOCK_ADMIN_ROLE() external view returns (bytes32); | ||
function cancel(bytes32 id) external; | ||
function execute(address target, uint256 value, bytes memory data, bytes32 predecessor, bytes32 salt) | ||
external | ||
payable; | ||
function executeBatch( | ||
address[] memory targets, | ||
uint256[] memory values, | ||
bytes[] memory datas, | ||
bytes32 predecessor, | ||
bytes32 salt | ||
) external payable; | ||
function getMinDelay() external view returns (uint256 duration); | ||
function getRoleAdmin(bytes32 role) external view returns (bytes32); | ||
function getTimestamp(bytes32 id) external view returns (uint256 timestamp); | ||
function grantRole(bytes32 role, address account) external; | ||
function hasRole(bytes32 role, address account) external view returns (bool); | ||
function hashOperation(address target, uint256 value, bytes memory data, bytes32 predecessor, bytes32 salt) | ||
external | ||
pure | ||
returns (bytes32 hash); | ||
function hashOperationBatch( | ||
address[] memory targets, | ||
uint256[] memory values, | ||
bytes[] memory datas, | ||
bytes32 predecessor, | ||
bytes32 salt | ||
) external pure returns (bytes32 hash); | ||
function isOperation(bytes32 id) external view returns (bool pending); | ||
function isOperationDone(bytes32 id) external view returns (bool done); | ||
function isOperationPending(bytes32 id) external view returns (bool pending); | ||
function isOperationReady(bytes32 id) external view returns (bool ready); | ||
function renounceRole(bytes32 role, address account) external; | ||
function revokeRole(bytes32 role, address account) external; | ||
function schedule( | ||
address target, | ||
uint256 value, | ||
bytes memory data, | ||
bytes32 predecessor, | ||
bytes32 salt, | ||
uint256 delay | ||
) external; | ||
function scheduleBatch( | ||
address[] memory targets, | ||
uint256[] memory values, | ||
bytes[] memory datas, | ||
bytes32 predecessor, | ||
bytes32 salt, | ||
uint256 delay | ||
) external; | ||
function supportsInterface(bytes4 interfaceId) external view returns (bool); | ||
function updateDelay(uint256 newDelay) external; | ||
} |
Oops, something went wrong.