Some changes to the compiler / ERC20 without inheritance using ERC7201 - #575
Some changes to the compiler / ERC20 without inheritance using ERC7201#575rodrigogribeiro wants to merge 5 commits into
Conversation
c6bdffd to
16bcbee
Compare
czepluch
left a comment
There was a problem hiding this comment.
shouldn't it be named "vault" instead of "valt"? The directory for the vaulttoken
| function caller() returns (address) { | ||
| let r : word; | ||
| assembly { r := caller() } | ||
| return address(r); | ||
| } | ||
| function selfAddress() returns (address) { | ||
| let a : word; | ||
| assembly { a := address() } | ||
| return address(a); | ||
| } | ||
| function chainId() returns (uint256) { | ||
| let c : word; | ||
| assembly { c := chainid() } | ||
| return uint256(c); | ||
| } | ||
| function nowTime() returns (uint256) { | ||
| let t : word; | ||
| assembly { t := timestamp() } | ||
| return uint256(t); | ||
| } | ||
|
|
There was a problem hiding this comment.
why not use std.opcodes and get rid of assembly?
| require(bf >= value, Error(0xe450d38c)); // ERC20InsufficientBalance | ||
| HasLedger.setBalance(s, from, Num.sub(bf, value)); | ||
| } | ||
| if (to == address(0)) { |
There was a problem hiding this comment.
transfer(to = address(0)) reaches this burn branch: nothing on the public transfer/transferFrom path rejects a zero recipient, so a typo'd recipient burns the tokens and reduces supply. OZ reverts here with ERC20InvalidReceiver. Guard the entry points, or make burn explicit in the seam (Option<address>) so it cannot happen by accident. Same issue in valt/erc20base.sol:47.
| import {sload, sstore, log3, mstore} from std.opcodes; | ||
| import * from store; | ||
|
|
||
| export { HasLedger, HasSupply, HasAllowance, coreUpdate, spendAllowance, approveVal }; |
There was a problem hiding this comment.
These exported setters plus a freely constructible AppStore let any code bypass tokenUpdate (pause check, votes, Transfer event). Consider exporting a single mutator that takes the hook evidence as a parameter. same enforcement OZ gets from private _balances.
No description provided.