chore: Tron counterfactual deployment tooling#1338
Conversation
* WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * executor address * EIP-712 for signatures * tests passing * remove executor as state variable in factory * use OZ clones instead of custom proxy * cleanup * Deposit to CCTPSrcPeriphery instead of SpokePool * rename immutables struct * only store hash of immutables * clean up withdraw functions * add execution fee * refactor & add OFT/Spoke implementations * make refund recipient an immutable * add base abstract contract & correct spoke pool max fee calc * clean up SpokePool implementation * polish * add comments * exclude counterfactual contracts from hardhat compilation * more cleanup * undo hardhat exclusion change * clean up readme * user and admin withdraw addresses as address rather than bytes32 * remove unneeded balance check reverts * only pass in hash of params to deploy functions * remove try/catch in factory * rename PRECISION_SCALAR to PRICE_SCALAR * update readme * update readme * change OFT token from bytes32 to address * make exclusiveRelayer and exclusivityDeadline signed calldata * rename price to stableExchangeRate * split immutables structs into separate deposit & execution structs * make verifyParams a modifier * make quoteTimestamp signed * make depositExecution events more descriptive * add native asset support * update imports * add signature deadline * add counterfactual contracts to hardhat test compilation exclusion * add comments for caller passing msg.value for LZ fee * make SpokePool maxFee have fixed and bps components * make DepositExecuted events separate per implementation * add deployAndExecuteIfNeeded function to factory * add AdminWithdrawManager and cleanup withdraw functions & param hash verification --------- Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
…ctual deposits (#1331) * replace params-hash dispatcher with merkle-dispatched counterfactual deposits Single dispatcher contract stores a merkle root as its immutable arg. Each leaf is (implementation, keccak256(params)). Callers prove leaf inclusion via merkle proof, then the dispatcher delegatecalls the implementation. Withdrawals become a standard implementation (WithdrawImplementation) rather than baked-in base logic, enabling one deposit address to support multiple possible actions. - Add CounterfactualDeposit dispatcher and ICounterfactualImplementation - Add WithdrawImplementation with authorized caller + forced recipient - Adapt SpokePool, CCTP, OFT implementations to ICounterfactualImplementation - Adapt AdminWithdrawManager for merkle-based withdraw execution - Delete CounterfactualDepositBase (replaced by dispatcher + WithdrawImpl) - Rewrite all tests for merkle pattern (90 tests passing) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * remove unused bytes return from execute interfaces The return value was never consumed by any caller (factory, AdminWithdrawManager, or tests). Removing it simplifies the interfaces and saves gas by avoiding ABI decode/re-encode of the delegatecall result in the dispatcher. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * simplify WithdrawParams to single {admin, user} merkle leaf Replace {authorizedCaller, forcedRecipient} with {admin, user} so each clone needs only one withdraw leaf instead of up to three. Both admin and user can withdraw to any recipient. Recipient enforcement for signed withdrawals moves to AdminWithdrawManager.signedWithdrawToUser, which reads the user address from the merkle-committed params. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * extract shared NATIVE_ASSET and BPS_SCALAR into CounterfactualConstants Addresses review feedback: both constants were duplicated across WithdrawImplementation, CounterfactualDepositSpokePool, and CounterfactualDepositCCTP. Now defined once as file-level constants and imported by name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…ery (#1329) * [WIP] feat: add TransferProxy to allow same-chain swaps via SpokePoolPeriphery Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * fix: remove payable from TransferProxy deposit functions ETH sent to these functions would be permanently trapped since TransferProxy only handles ERC-20 transfers. Removing payable causes the EVM to reject any calls that send ETH. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
* WIP tron factory compatibility changes * add foundry Tron profile * add natspec * make tron factory inherit from base counterfactual factory * move TronClones.sol into libraries folder * add references to OZ libraries forked from in comments
3ae3331 to
72f699d
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Adds TypeScript deploy scripts for deploying counterfactual deposit contracts to Tron via TronWeb. Foundry can't broadcast to Tron directly (Tron uses protobuf + SHA-256 signing vs RLP + keccak256), so each script validates typed args, ABI-encodes constructor params, and calls a shared deployer that handles TronWeb deployment and writes Foundry-compatible broadcast artifacts. Includes scripts for the factory, all three deposit implementations (CCTP, OFT, SpokePool), WithdrawImplementation, and a clone deployment script that verifies CREATE2 address prediction. Also adds a README documenting prerequisites (Tron solc fork), deploy commands, TronScan verification steps, and broadcast artifact format.
Deployed contracts are on Tron testnet, with dummy configurations - they are in this PR just to show the json format the deploy script is writing. We can delete these deployments before merging this.