Repository navigation
feat(arcade): ArcadeEscrow — per-wallet NODL balance for Arcade builds #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
db093cc
feat(arcade): ArcadeEscrow per-wallet NODL balance for Arcade builds
aliXsed 6edbd69
fix(arcade): bind charge refs to their payload, map escrow for verifi…
aliXsed f9b501a
ci: gate ArcadeEscrow on the 95% line-coverage threshold
aliXsed 124839c
feat(arcade): timelock oracle grants and limit increases past any wit…
aliXsed caf2dec
Merge remote-tracking branch 'origin/main' into claude/arcadeescrow-p…
aliXsed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // SPDX-License-Identifier: BSD-3-Clause-Clear | ||
|
|
||
| pragma solidity ^0.8.26; | ||
|
|
||
| import {Script, console} from "forge-std/Script.sol"; | ||
|
|
||
| import {ArcadeEscrow} from "../src/arcade/ArcadeEscrow.sol"; | ||
|
|
||
| /** | ||
| * @title DeployArcadeEscrow | ||
| * @notice Deployment script for the Arcade NODL escrow on ZkSync Era. | ||
| * @dev Design: agent-stack `docs/arcade-artifacts-backend-design.md`, section 9.3. | ||
| * | ||
| * The contract holds user funds and is not upgradeable: there is no proxy. To sponsor | ||
| * gas for `deposit`, whitelist the deployed address on the existing `WhitelistPaymaster` | ||
| * (`addWhitelistedContracts`); that is a separate admin transaction. | ||
| * | ||
| * Usage: | ||
| * forge script script/DeployArcadeEscrow.s.sol \ | ||
| * --rpc-url $L2_RPC --broadcast --zksync | ||
| * | ||
| * Environment Variables: | ||
| * - DEPLOYER_PRIVATE_KEY: Private key with ETH for gas. | ||
| * - N_TOKEN_ADDR: NODL token address. | ||
| * - N_ARCADE_ADMIN: Multisig that will hold DEFAULT_ADMIN_ROLE. | ||
| * - N_ARCADE_ORACLE: arcade-forge settlement key, granted ORACLE_ROLE. | ||
| * - N_ARCADE_QUOTA: Total NODL (wei) that may be charged per period. | ||
| * - N_ARCADE_PERIOD: Optional quota period in seconds, defaults to 1 day. | ||
| * - N_ARCADE_MIN_DEPOSIT: Smallest deposit (wei) into an empty balance. | ||
| * - N_ARCADE_MAX_CHARGE: Largest single charge (wei). | ||
| * - N_ARCADE_WITHDRAW_DELAY: Optional, seconds, defaults to 1 hour. | ||
| */ | ||
| contract DeployArcadeEscrow is Script { | ||
| function run() external { | ||
| uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
| address nodl = vm.envAddress("N_TOKEN_ADDR"); | ||
| address admin = vm.envAddress("N_ARCADE_ADMIN"); | ||
| address oracle = vm.envAddress("N_ARCADE_ORACLE"); | ||
| uint256 quota = vm.envUint("N_ARCADE_QUOTA"); | ||
| uint256 period = vm.envOr("N_ARCADE_PERIOD", uint256(1 days)); | ||
| uint256 minDeposit = vm.envUint("N_ARCADE_MIN_DEPOSIT"); | ||
| uint256 maxCharge = vm.envUint("N_ARCADE_MAX_CHARGE"); | ||
| uint256 withdrawDelayRaw = vm.envOr("N_ARCADE_WITHDRAW_DELAY", uint256(1 hours)); | ||
|
|
||
| // The constructor enforces the delay cap too; failing here saves a broadcast round-trip. | ||
| require(withdrawDelayRaw <= type(uint64).max, "N_ARCADE_WITHDRAW_DELAY out of range"); | ||
| require(maxCharge != 0, "N_ARCADE_MAX_CHARGE is zero"); | ||
| require(quota >= maxCharge, "N_ARCADE_QUOTA is below one max charge"); | ||
| uint64 withdrawDelay = uint64(withdrawDelayRaw); | ||
|
|
||
| console.log("=== Deploying ArcadeEscrow on ZkSync ==="); | ||
| console.log("NODL:", nodl); | ||
| console.log("Admin:", admin); | ||
| console.log("Oracle:", oracle); | ||
| console.log("Quota / period:", quota, period); | ||
| console.log("Min deposit:", minDeposit); | ||
| console.log("Max charge:", maxCharge); | ||
| console.log("Withdraw delay:", withdrawDelay); | ||
|
|
||
| vm.startBroadcast(deployerPrivateKey); | ||
| ArcadeEscrow escrow = new ArcadeEscrow(nodl, oracle, admin, quota, period, minDeposit, maxCharge, withdrawDelay); | ||
| vm.stopBroadcast(); | ||
|
|
||
| console.log(""); | ||
| console.log("ArcadeEscrow:", address(escrow)); | ||
| } | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.