- Solidity:
^0.8.30 - OpenZeppelin:
5.4.0
- Standard ERC20 transfers and balance management
- EIP-2612 permit (gasless approvals) support
- 3-of-5 EIP-712 multisig–based administrative control
- Instead of using a single
owneraddress (which creates a single point of failure), admin privileges are controlled by a 3-of-5 multisig to improve security and operational robustness.
- Instead of using a single
- Time-based lock mechanism to limit spending from specific accounts for a given period
- Rescue mechanism to recover ERC20 tokens accidentally sent to the contract
- Network: BNB Smart Chain (BSC)
- Token address:
0x03b60e802f936b18f422862c53dfaad6bf42719f
-
Switch (
src/Switch.sol)- ERC20 token implementation that mints the initial supply to the deployer.
- Delegates all admin logic (lock) to
Mshelper. - Transfers are only allowed when the sender is not locked.
-
Mshelper (
src/utils/Mshelper.sol)- Glue layer that combines
ERC20Permit,Lockable,Multisig, andReentrancyGuard. - Exposes multisig-protected admin functions such as
setDeployer,lockFor,lockUntil,unlock,pruneExpiredLocks, andrescueERC20.
- Glue layer that combines
-
Multisig (
src/utils/Multisig.sol)- Generic 3-of-5 EIP-712 multisig helper.
- Validates signatures from a fixed set of 5 signers and maintains a nonce to prevent replay.
-
Lockable (
src/utils/Lockable.sol)- Manages time-based spending locks on accounts.
- Supports relative (
lockFor) and absolute (lockUntil) locks, unlocking, listing locked accounts, and pruning expired locks.
- Signer set: 5 distinct multisig signers, with a fixed 3-of-5 threshold.
- Typed data: Each admin action (lock, etc.) has its own EIP-712 typehash.
- Execution pattern:
- Off-chain, at least 3 signers sign the EIP-712 typed data for the desired action.
- The collected signatures are passed to the corresponding
Mshelperfunction (e.g.lockFor). _validateSigschecks signatures, threshold, deadline, and nonce, then the action is executed.