Skip to content

Commit 93c5bd3

Browse files
razwwclaude
andcommitted
fix(audit): tighten Deploy.s.sol owner-transfer logic
- Simplify ProxyAdmin ownership transfer: rely on proxyAdmin.owner() (set to broadcaster in constructor) instead of the misleading address(this) check. - Guard PROXY_ADMIN_OWNER=0 explicitly, matching the OWNER=0 require. - Drop dead `owner != address(0)` clause on the factory.setOwner branch (already enforced by the OWNER=0 require above). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8b52dfd commit 93c5bd3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

script/Deploy.s.sol

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ contract Deploy is Script {
4949
address tokenDescriptor = vm.envOr('TOKEN_DESCRIPTOR', address(0));
5050

5151
require(owner != address(0), 'OWNER=0');
52+
require(proxyAdminOwner != address(0), 'PROXY_ADMIN_OWNER=0');
5253
require(weth9 != address(0), 'WETH9=0');
5354

5455
console.log('--- Lista V3 deploy ---');
@@ -62,14 +63,16 @@ contract Deploy is Script {
6263
vm.startBroadcast();
6364

6465
ProxyAdmin proxyAdmin = new ProxyAdmin();
65-
if (proxyAdminOwner != address(this) && proxyAdminOwner != proxyAdmin.owner()) {
66+
// ProxyAdmin.owner() is set to msg.sender (the broadcaster) in its constructor.
67+
// Transfer only if a different owner was requested.
68+
if (proxyAdminOwner != proxyAdmin.owner()) {
6669
proxyAdmin.transferOwnership(proxyAdminOwner);
6770
}
6871

6972
// Factory: plain deploy. owner = msg.sender (the broadcaster). If a separate
7073
// owner is required, the broadcaster should call factory.setOwner(owner) after.
7174
ListaV3Factory factory = new ListaV3Factory();
72-
if (owner != address(0) && owner != msg.sender) {
75+
if (owner != msg.sender) {
7376
factory.setOwner(owner);
7477
}
7578

0 commit comments

Comments
 (0)