The test_unlocked_funds.sh script tests the unlocked funds flow in the Aligned protocol by continuously cycling between locking and unlocking funds while submitting proofs.
Important: This script must be run from the root of the repository.
./scripts/unlocked_funds/test_unlocked_funds.sh <env_file_path>The script requires an environment file with the following variables:
RPC_URL- RPC endpoint URL for the blockchain networkNETWORK- Network identifier (e.g., holesky, mainnet)BATCHER_PAYMENT_SERVICE_ADDRESS- Contract address of the batcher payment servicePRIVATE_KEY- Private key for transaction signingSLEEP_SECONDS- Sleep duration between cycles (in seconds)
- Initial Setup: Locks funds using the batcher payment service contract
- Continuous Loop:
- Submits a proof to Aligned (runs in background)
- Waits 5 minutes
- Unlocks funds from the contract
- Sleeps for the configured duration
- Locks funds again
- Repeats the cycle
The script uses test files located at:
./scripts/test_files/circom_groth16_bn256_script/proof.json./scripts/test_files/circom_groth16_bn256_script/public.json./scripts/test_files/circom_groth16_bn256_script/verification_key.json
The test is considered successful when the UserFundsUnlocked event is detected in the proof submission output.
alignedCLI toolcast(from Foundry)- Bash shell environment