-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EIP712 domain and version adjustment, correction to transferWithAutho…
…rization method, Version 02 of the contract
- Loading branch information
1 parent
a3c6aba
commit d909b4c
Showing
10 changed files
with
1,380 additions
and
25 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* Copyright (c) 2020 CENTRE SECZ | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
* Ported to 0.8.24 solidity by Vladimir Klimo, bitCore,s.r.o. | ||
* 20.03.2024 - https://www.bitcore.sk - initial realease | ||
* 25.06.2024 - ability to change domain and version during upgrade (reinitializer) | ||
*/ | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
//import { EnhancedEIP712Upgradeable } from "./EnhancedEIP712Upgradeable.sol"; | ||
import { PRETokenBase } from "./PRETokenBase.sol"; | ||
|
||
contract PRETokenBaseV2 is PRETokenBase { | ||
|
||
function reinitialize(string memory name, string memory version) public reinitializer(2) { | ||
super.__EIP712_init(name, version); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { ethers, upgrades } from "hardhat"; | ||
|
||
let tokenName: string = 'Presearch'; | ||
let tokenSymbol: string = 'PRE'; | ||
|
||
async function main() { | ||
const networkName = (await ethers.provider.getNetwork()).name; | ||
let PROXY_ADDRESS: string; | ||
|
||
// get fixed/optimized PRETokenBase after audit | ||
const pre = await ethers.getContractFactory("PRETokenBaseV2"); | ||
console.log("Re-Deploying PRETokenBaseV2 ..."); | ||
|
||
// base deployed transparent PROXY address | ||
switch (networkName) { | ||
case 'base-mainnet': { PROXY_ADDRESS = '0x3816dD4bd44c8830c2FA020A5605bAC72FA3De7A'; break; } | ||
case 'base-sepolia': { PROXY_ADDRESS = '0xc0C034725e4eC6DDd23B8D4e6412094BcfB3F5D6'; break; } | ||
case 'localhost': { PROXY_ADDRESS = '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1'; break; } | ||
default: { throw new TypeError('Unknown network for deployment'); break; } | ||
} | ||
|
||
// execute the upgrade | ||
const upgraded = await upgrades.upgradeProxy(PROXY_ADDRESS, pre); | ||
console.log("Reinitializing..."); | ||
await upgraded.reinitialize('Presearch', '1'); | ||
console.log("Upgrade and reinitialization complete!"); | ||
|
||
// log output | ||
console.log("V2 Contract deployed / upgraded to:", await upgraded.getAddress()); | ||
console.log(await upgrades.erc1967.getImplementationAddress(await upgraded.getAddress())," getImplementationAddress"); | ||
console.log(await upgrades.erc1967.getAdminAddress(await upgraded.getAddress()), " getAdminAddress"); | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
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
Oops, something went wrong.