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

Hardcode ERC777 granularity to 1, remove tests. #1739

Merged
merged 2 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions contracts/drafts/ERC777/ERC777.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../../utils/Address.sol";
import "../IERC1820Registry.sol";

/**
* @title ERC777 token implementation
* @title ERC777 token implementation, with granularity harcoded to 1.
* @author etsvigun <utgarda@gmail.com>, Bertrand Masius <github@catageeks.tk>
*/
contract ERC777 is IERC777 {
Expand All @@ -25,8 +25,6 @@ contract ERC777 is IERC777 {

uint256 private _totalSupply;

uint256 private _granularity;

bytes32 constant private TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
bytes32 constant private TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");

Expand All @@ -43,14 +41,10 @@ contract ERC777 is IERC777 {
constructor(
string memory name,
string memory symbol,
uint256 granularity,
address[] memory defaultOperators
) public {
require(granularity > 0);

_name = name;
_symbol = symbol;
_granularity = granularity;

_defaultOperatorsArray = defaultOperators;
for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) {
Expand Down Expand Up @@ -182,7 +176,7 @@ contract ERC777 is IERC777 {
* @return uint256 granularity
*/
function granularity() public view returns (uint256) {
return _granularity;
return 1;
}

/**
Expand Down Expand Up @@ -228,7 +222,6 @@ contract ERC777 is IERC777 {
internal
{
require(to != address(0));
require((amount % _granularity) == 0);

// Update state variables
_totalSupply = _totalSupply.add(amount);
Expand Down Expand Up @@ -260,7 +253,6 @@ contract ERC777 is IERC777 {
{
require(from != address(0));
require(to != address(0));
require((amount % _granularity) == 0);

_callTokensToSend(operator, from, to, amount, userData, operatorData);

Expand Down Expand Up @@ -291,7 +283,6 @@ contract ERC777 is IERC777 {
private
{
require(from != address(0));
require((amount % _granularity) == 0);

_callTokensToSend(operator, from, address(0), amount, data, operatorData);

Expand Down
3 changes: 1 addition & 2 deletions contracts/mocks/ERC777Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ contract ERC777Mock is ERC777 {
uint256 initialBalance,
string memory name,
string memory symbol,
uint256 granularity,
address[] memory defaultOperators
) public ERC777(name, symbol, granularity, defaultOperators) {
) public ERC777(name, symbol, defaultOperators) {
_mint(msg.sender, initialHolder, initialBalance, "", "");
}

Expand Down
3 changes: 0 additions & 3 deletions test/drafts/ERC777/ERC777.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,7 @@ module.exports = {
shouldBehaveLikeERC777DirectSendBurn,
shouldBehaveLikeERC777OperatorSendBurn,
shouldBehaveLikeERC777UnauthorizedOperatorSendBurn,
shouldDirectSendTokens,
shouldDirectBurnTokens,
shouldBehaveLikeERC777InternalMint,
shouldInternalMintTokens,
shouldBehaveLikeERC777SendBurnMintInternalWithReceiveHook,
shouldBehaveLikeERC777SendBurnWithSendHook,
};
Loading