Skip to content

Commit

Permalink
more translation in lesson 31
Browse files Browse the repository at this point in the history
  • Loading branch information
thurendous committed Aug 25, 2024
1 parent b9089f5 commit 9e6ac55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Languages/ja/31_ERC20/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ contract ERC20 is IERC20 {

uint8 public decimals = 18; // トークンの小数点以下桁数

// @dev 在合约部署的时候实现合约名称和符号
// @dev deploy時に実行されるコンストラクタ
constructor(string memory name_, string memory symbol_) {
name = name_;
symbol = symbol_;
}

// @dev 实现`transfer`函数,代币转账逻辑
// @dev `transfer`関数を実装。トークン転送ロジック
function transfer(address recipient, uint256 amount) public override returns (bool) {
balanceOf[msg.sender] -= amount;
balanceOf[recipient] += amount;
emit Transfer(msg.sender, recipient, amount);
return true;
}

// @dev 实现 `approve` 函数, 代币授权逻辑
// @dev `approve` 関数を実装。トークン権限委任ロジック
function approve(address spender, uint256 amount) public override returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}

// @dev 实现`transferFrom`函数,代币授权转账逻辑
// @dev `transferFrom`関数の実装。トークン転送ロジック
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
allowance[sender][msg.sender] -= amount;
balanceOf[sender] -= amount;
Expand All @@ -47,14 +47,14 @@ contract ERC20 is IERC20 {
return true;
}

// @dev 铸造代币,从 `0` 地址转账给 调用者地址
// @dev トークンのミント。`0`アドレスから、callerアドレスへトークンを転送
function mint(uint256 amount) external {
balanceOf[msg.sender] += amount;
totalSupply += amount;
emit Transfer(address(0), msg.sender, amount);
}

// @dev 销毁代币,从 调用者地址 转账给 `0` 地址
// @dev トークンを焼却,callerから`amount`数量のトークンを`0`アドレスへ転送
function burn(uint256 amount) external {
balanceOf[msg.sender] -= amount;
totalSupply -= amount;
Expand Down

0 comments on commit 9e6ac55

Please sign in to comment.