Fix typos, run prettier, and allow anyone to call on DummyERC721Token

This commit is contained in:
Amir Bandeali
2018-08-15 10:55:48 -07:00
parent c13f538400
commit 8bce73dc67
8 changed files with 17 additions and 16 deletions

View File

@@ -29,6 +29,7 @@ contract DummyERC20Token is
string public name;
string public symbol;
uint256 public decimals;
uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;
constructor (
string _name,
@@ -67,7 +68,7 @@ contract DummyERC20Token is
external
{
require(
_value <= 10000000000000000000000,
_value <= MAX_MINT_AMOUNT,
"VALUE_TOO_LARGE"
);

View File

@@ -46,13 +46,12 @@ contract DummyERC721Token is
/// @param _tokenId ID of the token to be minted by the msg.sender
function mint(address _to, uint256 _tokenId)
external
onlyOwner
{
_mint(_to, _tokenId);
}
/// @dev Function to burn a token
/// Reverts if the given token ID doesn't exist
/// Reverts if the given token ID doesn't exist or not called by contract owner
/// @param _owner Owner of token with given token ID
/// @param _tokenId ID of the token to be burned by the msg.sender
function burn(address _owner, uint256 _tokenId)

View File

@@ -101,7 +101,7 @@ contract ERC20Token is
/// @dev `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Always true if enough call has enough gas to complete execution
/// @return Always true if the call has enough gas to complete execution
function approve(address _spender, uint256 _value)
external
returns (bool)

View File

@@ -58,7 +58,7 @@ contract IERC20Token {
/// @dev `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Always true if enough call has enough gas to complete execution
/// @return Always true if the call has enough gas to complete execution
function approve(address _spender, uint256 _value)
external
returns (bool);

View File

@@ -45,7 +45,7 @@ contract ERC721Token is
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// perator, or the approved address for this NFT. Throws if `_from` is
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT. When transfer is complete, this function
/// checks if `_to` is a smart contract (code size > 0). If so, it calls

View File

@@ -4,15 +4,15 @@ import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import { DummyERC721ReceiverContract } from '../../generated_contract_wrappers/dummy_erc721_receiver';
import {
DummyERC721ReceiverContract,
DummyERC721ReceiverTokenReceivedEventArgs,
} from '../../generated_contract_wrappers/dummy_erc721_receiver';
import {
DummyERC721TokenContract,
DummyERC721TokenTransferEventArgs,
} from '../../generated_contract_wrappers/dummy_erc721_token';
import {
InvalidERC721ReceiverContract,
InvalidERC721ReceiverTokenReceivedEventArgs,
} from '../../generated_contract_wrappers/invalid_erc721_receiver';
import { InvalidERC721ReceiverContract } from '../../generated_contract_wrappers/invalid_erc721_receiver';
import { artifacts } from '../utils/artifacts';
import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
@@ -132,7 +132,7 @@ describe('ERC721Token', () => {
expect(log.args._to).to.be.equal(to);
expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
});
it('should transfer the token is spender is individually approved', async () => {
it('should transfer the token if spender is individually approved', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await token.approve.sendTransactionAsync(spender, tokenId),
constants.AWAIT_TRANSACTION_MINED_MS,
@@ -204,7 +204,7 @@ describe('ERC721Token', () => {
const newOwner = await token.ownerOf.callAsync(tokenId);
expect(newOwner).to.be.equal(to);
const transferLog = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<InvalidERC721ReceiverTokenReceivedEventArgs>;
const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<DummyERC721ReceiverTokenReceivedEventArgs>;
expect(transferLog.args._from).to.be.equal(from);
expect(transferLog.args._to).to.be.equal(to);
expect(transferLog.args._tokenId).to.be.bignumber.equal(tokenId);
@@ -265,7 +265,7 @@ describe('ERC721Token', () => {
const newOwner = await token.ownerOf.callAsync(tokenId);
expect(newOwner).to.be.equal(to);
const transferLog = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<InvalidERC721ReceiverTokenReceivedEventArgs>;
const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<DummyERC721ReceiverTokenReceivedEventArgs>;
expect(transferLog.args._from).to.be.equal(from);
expect(transferLog.args._to).to.be.equal(to);
expect(transferLog.args._tokenId).to.be.bignumber.equal(tokenId);

View File

@@ -1,5 +1,5 @@
[
{
{
"version": "1.0.1-rc.5",
"changes": [
{

View File

@@ -7,7 +7,8 @@
"pr": 807
},
{
"note": "Store different ABIs for events with same function signature and different amount of indexed arguments",
"note":
"Store different ABIs for events with same function signature and different amount of indexed arguments",
"pr": 933
}
],