feat: add V3 blacklist controls#2
Open
jejopl wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds PRETokenBaseV3 with blacklist controls (managed by PAUSER_ROLE) to block outgoing token movements from blacklisted addresses, along with deployment/ops scripts and test coverage for upgrade + blacklist behavior.
Changes:
- Introduces
PRETokenBaseV3with ERC-7201-style storage for a blacklist mapping, role-gated setters, and_updateenforcement for outgoing transfers. - Adds a Hardhat script to upgrade the proxy to V3 and a script to set/unset blacklist status on the deployed proxy.
- Adds V3 upgrade/blacklist tests and updates V1/V2 tests to mint an initial supply via bridge impersonation for consistent supply assertions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
contracts/PRETokenBaseV3.sol |
Adds blacklist state + role-gated management and enforces blacklist on outgoing _update flows. |
scripts/deploy-V3.ts |
Upgrade helper script to prepare/execute (or print) a V3 upgrade transaction. |
scripts/setBlacklist.ts |
Ops script to toggle blacklist status for an address on the V3 proxy. |
test/03-PRE-Token-Base-V3-Tests.ts |
New tests for V2→V3 upgrade invariants and blacklist enforcement across transfer paths. |
test/01-PRE-Token-Base-Tests.ts |
Mints a fixed initial supply via bridge impersonation and asserts exact totalSupply. |
test/02-PRE-Token-Base-V2-Tests.ts |
Same initial-supply minting + exact totalSupply assertion after V2 upgrade. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+20
| import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; | ||
| import { expect } from "chai"; | ||
| import { ethers, upgrades } from "hardhat"; | ||
| import { PRETokenBaseV3 } from "../typechain-types"; | ||
| import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; | ||
|
|
||
| const BRIDGE_ADDRESS = "0x4200000000000000000000000000000000000010"; | ||
| const L1_TOKEN_ADDRESS = "0xEC213F83defB583af3A000B1c0ada660b1902A0F"; | ||
| const INITIAL_TEST_SUPPLY = ethers.parseUnits("500000000", 18); | ||
| const TOKEN_NAME = "Presearch"; | ||
| const TOKEN_SYMBOL = "PRE"; | ||
| const EIP712_VERSION = "1"; | ||
|
|
||
| async function mintInitialTestSupply(con: any, to: string) { | ||
| await ethers.provider.send("hardhat_setBalance", [BRIDGE_ADDRESS, "0xde0b6b3a7640000"]); | ||
| await ethers.provider.send("hardhat_impersonateAccount", [BRIDGE_ADDRESS]); | ||
| const bridge = await ethers.getSigner(BRIDGE_ADDRESS); | ||
| await con.connect(bridge).mint(to, INITIAL_TEST_SUPPLY); | ||
| await ethers.provider.send("hardhat_stopImpersonatingAccount", [BRIDGE_ADDRESS]); | ||
| } |
Comment on lines
+51
to
+54
| const blacklisted = getBlacklistedValue(); | ||
| const proxyAddress = getProxyAddress(network.name); | ||
| const token = await ethers.getContractAt("PRETokenBaseV3", proxyAddress); | ||
|
|
Comment on lines
+10
to
+18
| function getProxyAddress(networkName: string): string { | ||
| switch (networkName) { | ||
| case "base": | ||
| case "base-mainnet": { | ||
| return "0x3816dD4bd44c8830c2FA020A5605bAC72FA3De7A"; | ||
| } | ||
| case "base-sepolia": { | ||
| return "0xc0C034725e4eC6DDd23B8D4e6412094BcfB3F5D6"; | ||
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.