Zerocard Protocol facilitates a secure and automated on-chain payment order lifecycle. When a card is swiped, the equivalent cryptocurrency token is immediately escrowed. This escrowed token is held until the corresponding fiat transaction is authorized. Upon successful settlement and confirmation of the fiat payment, the escrowed token is then disbursed to the business. In the event of an unsuccessful or failed swipe, the protocol ensures an automatic refund of the escrowed tokens to the user, providing a reliable and trustworthy payment experience.
Deployment is done using Hardhat scripts
npx hardhat run scripts/deploy.ts --network <network>
npx hardhat verify --network <network> <contract_address>
# for Tron network,
tronbox migrate -f 1 --to 1 --network <network>npx hardhat run scripts/upgrade.ts --network <network>
# upgrade across all EVM chains
npx hardhat run scripts/upgrade.ts --network arbitrumOne && npx hardhat run scripts/upgrade.ts --network base && npx hardhat run scripts/upgrade.ts --network bsc && npx hardhat run scripts/upgrade.ts --network polygon && npx hardhat run scripts/upgrade.ts --network optimisticEthereum && npx hardhat run scripts/upgrade.ts --network scroll
# upgrade across all EVM testnet chains
npx hardhat run scripts/upgrade.ts --network arbitrumSepolia && npx hardhat run scripts/upgrade.ts --network amoy && npx hardhat run scripts/upgrade.ts --network baseSepolia && npx hardhat run scripts/upgrade.ts --network sepolia
# for Tron network,
tronbox migrate -f 2 --to 2 --network <network>Update network settings in scripts/config.ts
npx hardhat run scripts/setSupportedTokens.ts --network <network>
npx hardhat run scripts/updateProtocolAddresses.ts --network <network>
npx hardhat run scripts/updateProtocolFee.ts --network <network>
# for Tron network,
npx hardhat run scripts/tron/setSupportedTokens.ts
npx hardhat run scripts/tron/updateProtocolAddresses.ts
npx hardhat run scripts/tron/updateProtocolFee.tsTo add support for a new chain, follow these steps:
- Update Network Configuration: Add the new chain's details in
scripts/config.tsunder the appropriate section (Mainnets or Testnets). Include RPC URL, supported tokens, treasury fee percentage, and contract addresses if available.# Example for a new chain with ID 9999 9999: { RPC_URL: `https://rpc.newchain.com`, SUPPORTED_TOKENS: { USDC: "0x...", }, TREASURY_FEE_PERCENT: 500, // in BPS i.e 0.5% GATEWAY_CONTRACT: "0x...", IMPERSONATE_ACCOUNT: "", },
- Update Network Names: Add the new chain's name to the
NETWORK_NAMESobject inscripts/updateReadme.tsto ensure it is recognized when updating the README.md file.# Example addition to NETWORK_NAMES in scripts/updateReadme.ts 9999: 'New Chain Name',
- Deploy Contracts: Deploy the gateway contract to the new chain using the deployment script.
npx hardhat run scripts/deploy.ts --network newChainName
- Verify Contracts: Verify the deployed contract on the new chain.
npx hardhat verify --network newChainName <contract_address>
- Update README: After deployment, update the README.md with the new chain's contract addresses in the appropriate table (Testnet or Mainnet).
To update the README.md file with new contract addresses or other information, you can manually edit the file or use a script to automate the process:
# Manually edit README.md
# Use your preferred editor to update the contract addresses and other details
# OR use a script to update README.md (if available)
npx hardhat run scripts/updateReadme.ts --network <network>| Network | Contracts | Address |
|---|---|---|
| Ethereum Sepolia | Gateway Proxy | |
| Gateway Implementation | ||
| Polygon Amoy | Gateway Proxy | |
| Gateway Implementation | ||
| Arbitrum Sepolia | Gateway Proxy | |
| Gateway Implementation | ||
| Base Sepolia | Gateway Proxy | |
| Gateway Implementation | ||
| Asset Chain Testnet | Gateway Proxy | |
| Gateway Implementation | ||
| Tron Shasta | Gateway Proxy | |
| Gateway Implementation | ||
| Gateway Admin | ||
| Network | Contracts | Address |
|---|---|---|
| Ethereum | Gateway Proxy | |
| Gateway Implementation | ||
| Polygon | Gateway Proxy | |
| Gateway Implementation | ||
| Base | Gateway Proxy | |
| Gateway Implementation | ||
| BNB Smart Chain | Gateway Proxy | |
| Gateway Implementation | ||
| Arbitrum One | Gateway Proxy | |
| Gateway Implementation | ||
| Optimism Ethereum | Gateway Proxy | |
| Gateway Implementation | ||
| Gateway Admin | ||
| Scroll | Gateway Proxy | |
| Gateway Implementation | ||
| Gateway Admin | ||
| Celo | Gateway Proxy | |
| Gateway Implementation | ||
| Gateway Admin | ||
| Lisk | Gateway Proxy | |
| Gateway Implementation | ||
| Gateway Admin | ||
| Asset Chain | Gateway Proxy | |
| Gateway Implementation | ||
| Tron | Gateway Proxy | |
| Gateway Implementation | ||
| Gateway Admin | ||
Contract tests are defined under the tests directory. To run all the tests, run:
npx hardhat testThis project uses Conventional Commits to generate release notes and to determine versioning. Commit messages should adhere to this standard and be of the form:
$ git commit -m "feat: Add new feature x"
$ git commit -m "fix: Fix bug in feature x"
$ git commit -m "docs: Add documentation for feature x"
$ git commit -m "test: Add test suite for feature x"