From aa0e4f118fbc89c50816226a30dae672d1a2affb Mon Sep 17 00:00:00 2001 From: YoungMiShin <39818966+YoungMiShin@users.noreply.github.com> Date: Tue, 30 Apr 2019 13:52:13 +0900 Subject: [PATCH] Modify audit-checklist related with mint, burn --- score/audit-checklist.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/score/audit-checklist.md b/score/audit-checklist.md index d5b525c..934a448 100644 --- a/score/audit-checklist.md +++ b/score/audit-checklist.md @@ -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 @@ -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.