Skip to content

Commit

Permalink
Merge pull request icon-project#18 from YoungMiShin/master
Browse files Browse the repository at this point in the history
Modify audit-checklist related with mint, burn
  • Loading branch information
sojinkim-icon authored May 3, 2019
2 parents 959d5dd + aa0e4f1 commit ae86312
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion score/audit-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def balanceOf(self, _owner: Address) -> int:

### Eventlog on Token Transfer

Token transfer must trigger Eventlog.
Token transfer must trigger Eventlog.

```python
# Good
Expand All @@ -220,6 +220,25 @@ def transfer(self, _to: Address, _value: int, _data: bytes = None):
self.Transfer(self.msg.sender, _to, _value, _data)
```

In addition to sending tokens between the two addresses, you must leave Eventlog even if tokens are minted or burned. For mint and burn, use a specific address as follows:
```python
# Good

EOA_ZERO = Address.from_string('hx' + '0' * 40)

@external
def mint(self, amount: int):
self._total_supply.set(self._total_supply.get() + amount)
self._balances[self.owner] += amount
self.Transfer(EOA_ZERO, self.owner, amount, b'mint')

@external
def burn(self, amount: int):
self._total_supply.set(self._total_supply.get() - amount)
self._balances[self.owner] -= amount
self.Transfer(self.owner, EOA_ZERO, amount, b'burn')
```

### Eventlog without Token Transfer

Do not trigger Transfer Eventlog without token transfer.
Expand Down

0 comments on commit ae86312

Please sign in to comment.