Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIT cannot be minted or burnt #17

Open
CjHare opened this issue Sep 13, 2021 · 2 comments
Open

BIT cannot be minted or burnt #17

CjHare opened this issue Sep 13, 2021 · 2 comments
Labels
question Further information is requested

Comments

@CjHare
Copy link
Contributor

CjHare commented Sep 13, 2021

BIT tokens cannot be minted or burnt as the implemented code is guarded by requires that exclude the addresses required to mint or burn.

line 665 – (ERC20.sol)

    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

line 883 – (BitDAO.sol)

	function _beforeTokenTransfer(
		address from,
		address to,
		uint256 amount
	) internal virtual override {
		super._beforeTokenTransfer(from, to, amount);
		if (from == address(0)) {
			// mint
			_updateAccountSnapshot(to);
			_updateTotalSupplySnapshot();
		} else if (to == address(0)) {
			// burn
			_updateAccountSnapshot(from);
			_updateTotalSupplySnapshot();
		} else {
			// transfer
			_updateAccountSnapshot(from);
			_updateAccountSnapshot(to);
		}
	}

Behaviour demostrated with the two tests:

  • ‘minting BIT not allowed’
  • ‘burning BIT not allowed'

If the intention is not to support these operations, then _beforeTokenTransfer could be trimmed to exclude those flows that are not possible (not a pressing change, as it's currently dead code, wouldn't bump up gas costs), otherwise if those operations are meant to be available then an update is required.

@CjHare CjHare added the question Further information is requested label Sep 13, 2021
@shahankhatch
Copy link

This issue is relevant because proposals for burning tokens are being posted.

To mint in the current system requires minting a derivative, and burning can be accomplished by sending ERC-20 tokens to the 0x00 address.

@CjHare
Copy link
Contributor Author

CjHare commented Oct 13, 2021

Yes, I suspect burning tokens will be a popular proposal. Following standard monetary theory, reducing the available pool of tokens the remaining tokens will increase in value, giving an incentive for a holder to propose other people tokens are burnt 🤔

burning can be accomplished by sending ERC-20 tokens to the 0x00 address.
The BitDAO ERC20 contract does have the function / code to burn, however it is gated to revert calls to transfer to that address, so sending to the empty address 0x0 does not burn the transferred tokens, it merely results in a reverted transaction.

To mimic burning tokens, we could deploy an empty (unowned) contract that would effectively loose the tokens sent (as nobody would have the private keys).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants