1.0.0-beta.20 • Published 2 years ago

erc725 v1.0.0-beta.20

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
2 years ago

ERC725 Implementation

This package is DEPRECATED, please use npmjs.com/package/@erc725/smart-contracts

This package contains an implementation of ERC725 to make it as easy as possible to get started.\ If you see ways to improve this implementation, you are welcome to create an issue or a pull request.

The package has the following contracts:

  • ERC725X.sol: The execute part of ERC725, allows to execute any other smart contract. Uses ERC173 as a basis.
  • ERC725Y.sol: The data part of ERC725, allows to attach any key-value data to a smart contract. Uses ERC173 as a basis.
  • ERC725.sol: Combines both implementations: ERC725X.sol and ERC725Y.sol.
  • ERC725Account.sol: An implementation that could be used for a smart contract based account.
    • Implements ERC1271.
    • Allows to receive native tokens (like ETH) and fires the event ValueReceived(address indexed sender, uint256 indexed value).
    • Sets the key hash keccak256('ERC725Type'): 0xee97c7dd2e734cf234c2ba0d83a74633e1ac7fc8a9fd779f8497a0109c71b993 to keccak256('ERC725Account'): 0xafdeb5d6e788fe0ba73c9eb2e30b8a4485e3a18fb31dd13e3b362f62a65c67a0 in the constructor.

Usage

To use in your project install via npm

npm install

And import in your contracts

import "erc725/contracts/ERC725/ERC725Account.sol";

contract MyContract is ERC725Account {
    ...
}

Development

Setup:

npm install

Run tests:

npm test

Run linter (solium):

npm run lint

Technical References

Interface IDs

The table below contains a list of ERC165 interface IDs used by the Solidity implementations of the ERC725 smart contracts.

Interface NameInterface IDDescription
ERC725X0x44c028feGeneral executor
ERC725Y0x5a988c0fGeneral key-value store
ERC725Account0x63cb749bERC725X + ERC725Y + LSP1 + ERC1271
ERC1650x01ffc9a7Standard Interface Detection for Contracts
ERC12710x1626ba7eStandard Signature Validation Method for Contracts
LSP10x6bb56a14Universal Receiver entry function
LSP1Delegate0xc2d7bcc1Universal Receiver delegated to an other smart contract

The ERC725Account's interface ID is calculated as the XOR of the functions selectors from the interfaces it implements. Despite the fact that an ERC725Account is an ownable contract, the selectors from ERC173 (owner() and transferOwnership(address)) are omitted in the calculation.

  getData              // ERC725Y
^ setData              // ERC725Y
^ execute              // ERC725X
^ universalReceiver    // LSP1
^ isValidSignature     // ERC1271
= 0x63cb749b           // ERC725Account

Solc Contract details

Notice: you need the solc compiler installed locally to use this command. Installation instructions can be found in the solidity documentation

The repository offers a shell utility tool that generate details about each contracts (function selectors, storage layout, evm opcodes...). You can obtain them via the following command.

npm run solc

This will generate files and folders under /solc

solc
 |- bytecode/
 |- evm/
 |- metadata/
 |- opcodes/
 |- selectors/
 |- storage-layout/
 |- gas-costs.md
1.0.0-beta.20

2 years ago

1.0.0-beta.18

3 years ago

1.0.0-beta.17

3 years ago

1.0.0-beta.16

3 years ago

1.0.0-beta.15

4 years ago

1.0.0-beta.14

4 years ago

1.0.0-beta.12

4 years ago

1.0.0-beta.11

4 years ago

1.0.0-beta.10

4 years ago

1.0.0-beta.9

4 years ago

1.0.0-beta.8

4 years ago

1.0.0-beta.7

4 years ago

1.0.0-beta.6

4 years ago

1.0.0-beta.3

4 years ago

1.0.0-beta.4

4 years ago

1.0.0-beta.5

4 years ago

1.0.0-beta.2

4 years ago

1.0.0-beta.0

4 years ago

1.0.0-beta.1

4 years ago

0.0.1

6 years ago