Simple Treasury Overview
The Simple Treasury provides a streamlined, single-chain solution for asset management within EVVM. It operates on the same blockchain as the EVVM core contract, offering direct and efficient asset deposit and withdrawal operations.
When to Use Simple Treasury
Ideal for:
- EVVM running on the same blockchain as user assets
- Direct integration scenarios
- Lower gas costs and complexity
- Single-chain environments
Not suitable for:
- Multi-chain operations
- Cross-chain bridge requirements
- Gasless transaction needs
Key Features
- Direct Execution: Users interact directly with the Treasury contract
- Same-Chain Operations: All transactions on the same blockchain as EVVM
- Native & ERC20 Support: Both native coins and standard tokens
- EVVM Integration: Seamless balance synchronization
- Security Protection: Principal token withdrawal prevention
Available Functions
- deposit: Deposit native coins or ERC20 tokens into EVVM
- withdraw: Withdraw assets from EVVM back to user wallet
getEvvmAddress(): Returns the configured EVVM core contract address used by the Treasury (helper view on the contract)
Security Considerations
- The Treasury acts as an accounting gateway: it transfers custody of tokens to the contract (for ERC20) or receives native coins and then calls
addAmountToUser(...)on the EVVM core contract to credit balances. For withdrawals, it callsremoveAmountFromUser(...)before performing external transfers. - Principal token withdrawals are expressly blocked by design: attempting to withdraw the Principal Token will revert (
PrincipalTokenIsNotWithdrawable()). - Consider using safe ERC20 transfer helpers and adding tests for token transfer failures and malicious token behaviour.
Architecture
User Wallet → Simple Treasury → EVVM Core
↑ ↓
└──────────────┘
(Same Blockchain)
The Simple Treasury acts as a direct bridge between user wallets and EVVM balances on the same blockchain.