feat: adapt ListaRevenueDistributor for ETH + add emergencyWithdraw + deploy script - #111
Conversation
Pull Request ReviewThis PR modifies the Solidity upgradeable contract Sensitive ContentNo sensitive content detected. Security Issues🟡 [MEDIUM] Access control / safety check relaxed for critical destination setters
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
- Remove require != address(0) checks in initialize() for autoBuyback/revenueWallet/listaDistributeTo - Add address(0) guards in _distributeToken() and _distributeTokenWithCost() to skip transfers - Remove require != address(0) from setter methods to allow resetting to address(0) This enables deploying ListaRevenueDistributor on ETH where revenue stays in the contract for manual cross-chain bridging instead of auto-distributing.
7446de3 to
778d276
Compare
Pull Request ReviewThis PR updates the Solidity Sensitive ContentNo sensitive content detected. Security Issues🟡 [MEDIUM] Access control / safety constraint relaxed for critical payout addresses
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Add MANAGER-callable emergencyWithdraw(token, to, amount) to allow manual withdrawal of tokens from the contract for cross-chain bridging when distribution addresses are set to address(0) on ETH deployment.
Pull Request ReviewThis PR modifies Sensitive ContentNo sensitive content detected. Security Issues🟠 [HIGH] Privileged arbitrary token drain via new
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR modifies the Solidity Sensitive ContentBlockchain Address:
Security Issues🟡 [MEDIUM] Access control is relaxed for critical destination-address setters
No serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
The test uses hardcoded 1inch swap calldata that is only valid at block 43143645. Without the guard, it fails on any other fork block. Consistent with test_buyback() which already has the same pattern.
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distributor to support an ETH-mainnet mode where distribution target addresses may be set to Sensitive ContentBlockchain Address:
Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distributor to support ETH deployment scenarios where distribution targets may be unset ( Sensitive ContentBlockchain Address:
Security Issues🟡 [MEDIUM] Access control behavior relaxed for critical fund-flow configuration (confirm intended)
No serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR modifies Sensitive ContentBlockchain Address:
Security Issues🟡 [MEDIUM] Confirm intentional fund custody change due to zero-address target allowance
No serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distribution contract and deployment tooling for Ethereum mainnet. The contract now allows zero-address distribution targets (so funds can remain in-contract), adds a new Sensitive ContentBlockchain Address:
Security Issues🟡 [MEDIUM] Access control relaxed in initialization/address-setting flow (zero-address constraints removed)
No serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…n-specific addresses
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distribution contract and adds Ethereum deployment scripts (Hardhat + Foundry) for Sensitive ContentBlockchain Address:
Security Issues🟡 [MEDIUM] Centralized emergency token extraction capability added
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…r ListaRevenueDistributor
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distribution contract and adds Ethereum deployment scripts (Hardhat + Foundry) for Sensitive ContentBlockchain Address:
Security Issues🟡 [MEDIUM] Access control changed for emergency withdrawal role assignment (confirm intended privilege model)
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…nd actual amounts
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distribution system for ETH deployment by allowing zero-address distribution targets (so funds can remain in-contract), introducing an Sensitive ContentBlockchain Address:
Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR updates a Solidity upgradeable revenue distributor for ETH deployment by allowing zero-address distribution targets, adding a new Sensitive ContentBlockchain Address:
Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Summary
Adapt
ListaRevenueDistributorfor ETH mainnet deployment:address(0)— revenue stays in contract when targets are unsetemergencyWithdraw()with dedicatedEMERGENCY_WITHDRAWERrole for manual token extraction (cross-chain bridge to BSC for buyback)Change Type
Contracts Changed
contracts/dao/ListaRevenueDistributor.solscripts/foundry/eth/deploy_listaRevenueDistributor.solscripts/eth/deploy_listaRevenueDistributor.tsKey Changes
1. address(0) Guard Pattern
initialize()admin,manager,listaTokenAddressrequired non-zero_distributeToken()_distributeTokenWithCost()changeAutoBuybackAddress()changeRevenueWalletAddress()changeListaDistributeToAddress()2. emergencyWithdraw (NEW)
EMERGENCY_WITHDRAWERrole — separate from MANAGER, never granted to bot hot wallets_to != address(0),_amount > 0EmergencyWithdrawn(token, to, amount)event for on-chain auditability3. Event Accuracy Fix (Audit Response)
_distributeToken(): Early returns when all targets areaddress(0)— no misleading events, no gas waste, no balance re-splitting_distributeToken()/_distributeTokenWithCost(): Events report actual transferred amounts (not computed split amounts)ETH Revenue Flow
Deploy Order
Storage Layout
No new state variables —
EMERGENCY_WITHDRAWERis abytes32 public constant(compiled into bytecode, not stored in storage). Pure logic change — safe for upgrade on BSC.Access Control
changeAutoBuybackAddress(address(0))changeRevenueWalletAddress(address(0))changeListaDistributeToAddress(address(0))distributeTokens()emergencyWithdraw()Audit Fixes Applied
EMERGENCY_WITHDRAWERroleEmergencyWithdrawneventRisk Assessment
Test Plan
npx hardhat test test/dao/ListaRevenueDistributor.t.solScenarios:
initialize()succeeds with distribution targets = address(0)distributeTokens()early returns when all targets are address(0) — no event emitted, tokens stay in contractdistributeTokens()emits actual transferred amounts (not computed split) when one target is address(0)distributeTokens()correctly transfers when addresses are non-zero (BSC regression)emergencyWithdraw()transfers specified token amount to destinationemergencyWithdraw()reverts for non-EMERGENCY_WITHDRAWER (including MANAGER)emergencyWithdraw()reverts for _to = address(0) or _amount = 0emergencyWithdraw()emits EmergencyWithdrawn eventchangeAutoBuybackAddress(address(0))succeeds