- ✅ Depósito de ETH com limite de capacidade do banco
⚠️ Limite de saque de 100 ETH por transação- 🔒 Modificadores de segurança integrados
- 📊 Rastreamento de saldos individuais
- 🚨 4 Erros personalizados com mensagens claras
# Compilar
forge build
# Implantar (capacidade em WEI)
forge create KipuBank --constructor-args <CAPACIDADE_EM_WEI> --value 0
// Depositar 1 ETH
(bool success,) = 0x...contractAddress.call{value: 1 ether}("");
// Sacar 0.5 ETH
contract.withdraw(0.5 ether);
KipuBank_InsufficientBalance() // Saldo insuficiente
KipuBank_ExceedsWithdrawLimit() // Limite de saque excedido
KipuBank_OverValueDeposit() // Depósito excede capacidade
KipuBank_WithdrawValue() // Falha na transferência
event Deposit(address indexed sender, uint256 amount);
event Withdraw(address indexed sender, uint256 amount);
- ✅ ETH deposits with bank capacity limit
⚠️ 100 ETH per transaction withdraw limit- 🔒 Built-in security modifiers
- 📊 Individual balance tracking
- 🚨 4 Custom errors with clear messages
# Compile
forge build
# Deploy (capacity in WEI)
forge create KipuBank --constructor-args <BANK_CAP_IN_WEI> --value 0
// Deposit 1 ETH
(bool success,) = 0x...contractAddress.call{value: 1 ether}("");
// Withdraw 0.5 ETH
contract.withdraw(0.5 ether);
KipuBank_InsufficientBalance() // Insufficient balance
KipuBank_ExceedsWithdrawLimit() // Withdraw limit exceeded
KipuBank_OverValueDeposit() // Deposit exceeds capacity
KipuBank_WithdrawValue() // Transfer failed
event Deposit(address indexed sender, uint256 amount);
event Withdraw(address indexed sender, uint256 amount);
- ✅ ETH存款 (银行总容量限制)
⚠️ 单次取款限额100 ETH- 🔒 内置安全修饰器 (原"修改器"→术语修正)
- 📊 用户余额追踪
- 🚨 4个定制化错误类型
# 编译合约
forge build
# 部署合约 (容量单位: WEI)
forge create KipuBank --constructor-args <银行总容量_WEI单位> --value 0
// 存入1 ETH
(bool success,) = 0x...合约地址.call{value: 1 ether}("");
// 提取0.5 ETH
合约.withdraw(0.5 ether);
KipuBank_InsufficientBalance() // 余额不足
KipuBank_ExceedsWithdrawLimit() // 超过取款限额
KipuBank_OverValueDeposit() // 存款超过总容量 (添加"总"更准确)
KipuBank_WithdrawValue() // 转账失败
event Deposit(address indexed sender, uint256 amount); // 存款事件
event Withdraw(address indexed sender, uint256 amount); // 取款事件
// SPDX-License-Identifier: MIT
Full license: LICENSE