diff --git a/test/README.md b/test/README.md index c637d36..e0c04b4 100644 --- a/test/README.md +++ b/test/README.md @@ -1,56 +1,71 @@ # TestStableToken -The waku-rlnv2-contract [spec](https://github.com/waku-org/specs/blob/master/standards/core/rln-contract.md) defines that DAI is to be used to pay for membership registration, with the end-goal being to deploy the contract on mainnet using an existing stable DAI token. +The waku-rlnv2-contract [spec](https://github.com/waku-org/specs/blob/master/standards/core/rln-contract.md) defines +that DAI is to be used to pay for membership registration, with the end-goal being to deploy the contract on mainnet +using an existing stable DAI token. -Before this, we need to perform extensive testing on testnet and local environments (such as [waku-simulator](https://github.com/waku-org/waku-simulator)). During initial testing, we discovered the need to manage token minting in testnet environments to limit membership registrations and enable controlled testing of the contract. +Before this, we need to perform extensive testing on testnet and local environments (such as +[waku-simulator](https://github.com/waku-org/waku-simulator)). During initial testing, we discovered the need to manage +token minting in testnet environments to limit membership registrations and enable controlled testing of the contract. -TestStableToken is our custom token implementation designed specifically for testing environments, providing controlled token distribution while mimicking DAI's behaviour. +TestStableToken is our custom token implementation designed specifically for testing environments, providing controlled +token distribution while mimicking DAI's behaviour. ## Requirements -- **Controlled minting**: Manage token minting through an allowlist of approved accounts, controlled by the token contract owner +- **Controlled minting**: Manage token minting through an allowlist of approved accounts, controlled by the token + contract owner - **ETH burning mechanism**: Burn ETH when minting tokens to create economic cost (WIP) -- **Proxy architecture**: Use a proxy contract to minimize updates required when the token address changes across other components (e.g., nwaku-compose repo or dogfooding instructions) +- **Proxy architecture**: Use a proxy contract to minimize updates required when the token address changes across other + components (e.g., nwaku-compose repo or dogfooding instructions) ## Usage ### Deploy new TestStableToken with proxy contract + ```bash forge script script/DeployTokenWithProxy.s.sol:DeployTokenWithProxy --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast ``` ### Deploy only TestStableToken contract implementation + ```bash forge script test/TestStableToken.sol:TestStableTokenFactory --tc TestStableTokenFactory --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast ``` ### Update the proxy contract to point to the new implementation + ```bash # Upgrade the proxy to a new implementation cast send $TOKEN_PROXY_ADDRESS "upgradeTo(address)" $NEW_IMPLEMENTATION_ADDRESS --rpc-url $RPC_URL --private-key $PRIVATE_KEY ``` ### Add account to the allowlist to enable minting + ```bash cast send $TOKEN_PROXY_ADDRESS "addMinter(address)" $ACCOUNT_ADDRESS --rpc-url $RPC_URL --private-key $PRIVATE_KEY ``` ### Mint tokens to the account + ```bash cast send $TOKEN_PROXY_ADDRESS "mint(address,uint256)" --rpc-url $RPC_URL --private-key $MINTER_ACCOUNT_PRIVATE_KEY ``` ### Approve the token for the waku-rlnv2-contract to use + ```bash cast send $TOKEN_PROXY_ADDRESS "approve(address,uint256)" $TOKEN_SPENDER_ADDRESS --rpc-url $RPC_URL --private-key $PRIVATE_KEY ``` ### Remove the account from the allowlist to prevent further minting + ```bash cast send $TOKEN_PROXY_ADDRESS "removeMinter(address)" $ACCOUNT_ADDRESS --rpc-url $RPC_URL --private-key $PRIVATE_KEY ``` ### Query token information + ```bash # Check if an account is a minter cast call $TOKEN_PROXY_ADDRESS "isMinter(address)" $ACCOUNT_ADDRESS --rpc-url $RPC_URL @@ -61,6 +76,3 @@ cast call $TOKEN_PROXY_ADDRESS "balanceOf(address)" $ACCOUNT_ADDRESS --rpc-url $ # Check token allowance cast call $TOKEN_PROXY_ADDRESS "allowance(address,address)" $TOKEN_OWNER_ADDRESS $TOKEN_SPENDER_ADDRESS --rpc-url $RPC_URL ``` - - -