forked from utgarda/openzeppelin-solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ERC777 Add burn functions and fix send functions (OpenZeppelin#1159)
- Loading branch information
Bertrand Masius
committed
Oct 27, 2018
1 parent
73ac6af
commit 9a6ed29
Showing
3 changed files
with
106 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pragma solidity ^0.4.24; | ||
|
||
import "./ERC777.sol"; | ||
|
||
|
||
@title ERC777 burnable token implementation | ||
@author Bertrand Masius <github@catageeks.tk> | ||
@dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-777.md | ||
contract ERC777Burnable is ERC777 { | ||
|
||
/** | ||
* @dev Burn the amount of tokens from the address msg.sender | ||
* @param amount uint256 amount of tokens to transfer | ||
*/ | ||
function burn(uint256 amount) external { | ||
_burn(msg.sender, msg.sender, amount, ""); | ||
} | ||
|
||
/** | ||
* @dev Burn the amount of tokens on behalf of the address from | ||
* @param from address token holder address. Set to 0x0 to use msg.sender as token holder | ||
* @param amount uint256 amount of tokens to transfer | ||
* @param operatorData bytes extra information provided by the operator (if any) | ||
*/ | ||
function operatorBurn(address from, uint256 amount, bytes operatorData) external { | ||
address holder = from == address(0) ? msg.sender : from; | ||
_burn(msg.sender, holder, amount, operatorData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters