Skip to content

Commit

Permalink
Update to ERC1820
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjac committed Apr 4, 2019
1 parent 719a350 commit 5bc56da
Show file tree
Hide file tree
Showing 12 changed files with 1,582 additions and 3,223 deletions.
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
norpc: true,
copyPackages: ['eip820', 'openzeppelin-solidity'],
copyPackages: ['erc1820', 'openzeppelin-solidity'],
compileCommand: 'npx truffle compile --network coverage',
testCommand: 'npx truffle test --network coverage',
};
4 changes: 2 additions & 2 deletions contracts/ERC777BaseToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pragma solidity 0.4.24;

import { ERC820Implementer } from "eip820/contracts/ERC820Implementer.sol";
import { ERC1820Client } from "erc1820/contracts/ERC1820Client.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { ERC777Token } from "./ERC777Token.sol";
import { ERC777TokensSender } from "./ERC777TokensSender.sol";
import { ERC777TokensRecipient } from "./ERC777TokensRecipient.sol";


contract ERC777BaseToken is ERC777Token, ERC820Implementer {
contract ERC777BaseToken is ERC777Token, ERC1820Client {
using SafeMath for uint256;

string internal mName;
Expand Down
10 changes: 5 additions & 5 deletions contracts/examples/ExampleTokensRecipient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
*/
pragma solidity 0.4.24;

import { ERC820Implementer } from "eip820/contracts/ERC820Implementer.sol";
import { ERC820ImplementerInterface } from "eip820/contracts/ERC820ImplementerInterface.sol";
import { ERC1820Client } from "erc1820/contracts/ERC1820Client.sol";
import { ERC1820ImplementerInterface } from "erc1820/contracts/ERC1820ImplementerInterface.sol";
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import { ERC777TokensRecipient } from "../ERC777TokensRecipient.sol";
import { ERC777Token } from "../ERC777Token.sol";


contract ExampleTokensRecipient is ERC820Implementer, ERC820ImplementerInterface, ERC777TokensRecipient, Ownable {
contract ExampleTokensRecipient is ERC1820Client, ERC1820ImplementerInterface, ERC777TokensRecipient, Ownable {

bool private allowTokensReceived;

Expand Down Expand Up @@ -59,7 +59,7 @@ contract ExampleTokensRecipient is ERC820Implementer, ERC820ImplementerInterface
function rejectTokens() public onlyOwner { allowTokensReceived = false; }

// solhint-disable-next-line no-unused-vars
function canImplementInterfaceForAddress(address addr, bytes32 interfaceHash) public view returns(bytes32) {
return ERC820_ACCEPT_MAGIC;
function canImplementInterfaceForAddress(bytes32 _interfaceHash, address _addr) external view returns(bytes32) {
return ERC1820_ACCEPT_MAGIC;
}
}
10 changes: 5 additions & 5 deletions contracts/examples/ExampleTokensSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
*/
pragma solidity 0.4.24;

import { ERC820Implementer } from "eip820/contracts/ERC820Implementer.sol";
import { ERC820ImplementerInterface } from "eip820/contracts/ERC820ImplementerInterface.sol";
import { ERC1820Client } from "erc1820/contracts/ERC1820Client.sol";
import { ERC1820ImplementerInterface } from "erc1820/contracts/ERC1820ImplementerInterface.sol";
import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import { ERC777TokensSender } from "../ERC777TokensSender.sol";
import { ERC777Token } from "../ERC777Token.sol";


contract ExampleTokensSender is ERC820Implementer, ERC820ImplementerInterface, ERC777TokensSender, Ownable {
contract ExampleTokensSender is ERC1820Client, ERC1820ImplementerInterface, ERC777TokensSender, Ownable {

bool private allowTokensToSend;

Expand Down Expand Up @@ -59,8 +59,8 @@ contract ExampleTokensSender is ERC820Implementer, ERC820ImplementerInterface, E
function rejectTokensToSend() public onlyOwner { allowTokensToSend = false; }

// solhint-disable-next-line no-unused-vars
function canImplementInterfaceForAddress(address addr, bytes32 interfaceHash) public view returns(bytes32) {
return ERC820_ACCEPT_MAGIC;
function canImplementInterfaceForAddress(bytes32 _interfaceHash, address _addr) external view returns(bytes32) {
return ERC1820_ACCEPT_MAGIC;
}

}
Loading

0 comments on commit 5bc56da

Please sign in to comment.