Skip to content

Commit

Permalink
Remove send overloading
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Dafflon committed Jul 13, 2018
1 parent dccafe7 commit 89212a6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
7 changes: 0 additions & 7 deletions contracts/ERC777BaseToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ contract ERC777BaseToken is ERC777Token, ERC820Implementer {
/// @return the balance of `_tokenAddress`.
function balanceOf(address _tokenHolder) public constant returns (uint256) { return mBalances[_tokenHolder]; }

/// @notice Send `_amount` of tokens to address `_to`
/// @param _to The address of the recipient
/// @param _amount The number of tokens to be sent
function send(address _to, uint256 _amount) public {
doSend(msg.sender, _to, _amount, "", msg.sender, "", true);
}

/// @notice Send `_amount` of tokens to address `_to` passing `_userData` to the recipient
/// @param _to The address of the recipient
/// @param _amount The number of tokens to be sent
Expand Down
1 change: 0 additions & 1 deletion contracts/ERC777Token.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ interface ERC777Token {
function granularity() public constant returns (uint256);
function balanceOf(address owner) public constant returns (uint256);

function send(address to, uint256 amount) public;
function send(address to, uint256 amount, bytes userData) public;

function authorizeOperator(address operator) public;
Expand Down
16 changes: 8 additions & 8 deletions test/utils/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ exports.test = function(web3, accounts, token) {
});

it(`should let ${utils.formatAccount(accounts[1])} ` +
`send 3 ${token.symbol} ` +
`send 3 ${token.symbol} with empty data ` +
`to ${utils.formatAccount(accounts[2])}`, async function() {
await utils.assertTotalSupply(web3, token, 10 * accounts.length);
await utils.assertBalance(web3, token, accounts[1], 10);
await utils.assertBalance(web3, token, accounts[2], 10);

await token.contract.methods
.send(accounts[2], web3.utils.toWei('3'))
.send(accounts[2], web3.utils.toWei('3'), '0x')
.send({ gas: 300000, from: accounts[1] });

await utils.getBlock(web3);
Expand All @@ -30,7 +30,7 @@ exports.test = function(web3, accounts, token) {
});

it(`should let ${utils.formatAccount(accounts[1])} ` +
`send 3 ${token.symbol} wtih data ` +
`send 3 ${token.symbol} with data ` +
`to ${utils.formatAccount(accounts[2])}`, async function() {
await utils.assertTotalSupply(web3, token, 10 * accounts.length);
await utils.assertBalance(web3, token, accounts[1], 10);
Expand All @@ -56,7 +56,7 @@ exports.test = function(web3, accounts, token) {
await token.disableERC20();

await token.contract.methods
.send(accounts[2], web3.utils.toWei('3'))
.send(accounts[2], web3.utils.toWei('3'), '0x')
.send({ gas: 300000, from: accounts[1] });

await utils.getBlock(web3);
Expand All @@ -74,7 +74,7 @@ exports.test = function(web3, accounts, token) {
await utils.assertBalance(web3, token, accounts[2], 10);

await token.contract.methods
.send(accounts[2], web3.utils.toWei('11'))
.send(accounts[2], web3.utils.toWei('11'), '0x')
.send({ gas: 300000, from: accounts[1] })
.should.be.rejectedWith('revert');

Expand All @@ -91,7 +91,7 @@ exports.test = function(web3, accounts, token) {
await utils.assertBalance(web3, token, accounts[2], 10);

await token.contract.methods
.send(accounts[2], web3.utils.toWei('-3'))
.send(accounts[2], web3.utils.toWei('-3'), '0x')
.send({ gas: 300000, from: accounts[1] })
.should.be.rejectedWith('revert');

Expand All @@ -108,7 +108,7 @@ exports.test = function(web3, accounts, token) {
await utils.assertBalance(web3, token, accounts[2], 10);

await token.contract.methods
.send(accounts[2], web3.utils.toWei('0.007'))
.send(accounts[2], web3.utils.toWei('0.007'), '0x')
.send({ gas: 300000, from: accounts[1] })
.should.be.rejectedWith('revert');

Expand All @@ -126,7 +126,7 @@ exports.test = function(web3, accounts, token) {

await token.contract.methods
.send('0x0000000000000000000000000000000000000000',
web3.utils.toWei('1'))
web3.utils.toWei('1'), '0x')
.send({ gas: 300000, from: accounts[1] })
.should.be.rejectedWith('revert');

Expand Down
8 changes: 4 additions & 4 deletions test/utils/tokensRecipient.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports.test = function(web3, accounts, token) {
.send({ gas: 300000, from: accounts[4] });

await token.contract.methods
.send(recipient.options.address, web3.utils.toWei('1.22'))
.send(recipient.options.address, web3.utils.toWei('1.22'), '0x')
.send({ gas: 300000, from: accounts[5] });

await utils.getBlock(web3);
Expand All @@ -57,7 +57,7 @@ exports.test = function(web3, accounts, token) {
.send({ gas: 300000, from: accounts[4] });

await token.contract.methods
.send(recipient.options.address, web3.utils.toWei('1.22'))
.send(recipient.options.address, web3.utils.toWei('1.22'), '0x')
.send({ gas: 300000, from: accounts[5] })
.should.be.rejectedWith('revert');

Expand Down Expand Up @@ -96,7 +96,7 @@ exports.test = function(web3, accounts, token) {
.send({ gas: 300000, from: accounts[4] });

await token.contract.methods
.send(accounts[4], web3.utils.toWei('1.22'))
.send(accounts[4], web3.utils.toWei('1.22'), '0x')
.send({ gas: 300000, from: accounts[5] });

await utils.getBlock(web3);
Expand All @@ -122,7 +122,7 @@ exports.test = function(web3, accounts, token) {
assert.isFalse(await recipient.methods.notified().call());

await token.contract.methods
.send(recipient.options.address, web3.utils.toWei('1.22'))
.send(recipient.options.address, web3.utils.toWei('1.22'), '0x')
.send({ gas: 300000, from: accounts[5] })
.should.be.rejectedWith('revert');

Expand Down
4 changes: 2 additions & 2 deletions test/utils/tokensSender.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports.test = function(web3, accounts, token) {
.send({ gas: 300000, from: accounts[4] });

await token.contract.methods
.send(accounts[5], web3.utils.toWei('1.22'))
.send(accounts[5], web3.utils.toWei('1.22'), '0x')
.send({ gas: 300000, from: accounts[4] });

await utils.getBlock(web3);
Expand All @@ -68,7 +68,7 @@ exports.test = function(web3, accounts, token) {
.send({ gas: 300000, from: accounts[4] });

await token.contract.methods
.send(accounts[5], web3.utils.toWei('1.22'))
.send(accounts[5], web3.utils.toWei('1.22'), '0x')
.send({ gas: 300000, from: accounts[4] })
.should.be.rejectedWith('revert');

Expand Down

0 comments on commit 89212a6

Please sign in to comment.