eth-owned

0.0.1 • Public • Published

Owned Contract

Little Etherum Contract used to make another Contract Owned by someone (provided the restricted modifier).

How to use

First, install the package:

npm install --save eth-owned

Then, you can simply import/use it:

import "eth-owned/contracts/Owned.sol";
 
contract MyContract is Owned {
 
  // only the contract owner is able to call this method
  function getChurros() public restricted {
    // [...]
  }
  
}

Run local tests

First, on a separated console tab, run the test blockchain:

brice@brice:~/eth-owned$ npm run dev-serve
 
> eth-owned@0.0.1 dev-serve /home/brice/eth-owned
> ganache-cli
 
Ganache CLI v6.1.0 (ganache-core: 2.1.0)
 
Available Accounts
==================
(0) 0x4d7bbd49b20834470be749dfb2b8ef2e729c0bd8
(1) 0xb59d61d32187c661a9f935b46b9574ff21d38eaf
(2) 0xd06aac55f313e0bc58e6236e79a4a560349f9728
(3) 0xe94536dd74cb6c6dc21d8cfbd83e8fb9234ab58f
(4) 0xe1173e170bb6e9f3d26a884fd66472d7a07672c3
(5) 0x870d946428296bbf48574780a806235e93068b5e
(6) 0x2c385d9470c114b179b11d5edc6064e538fa737f
(7) 0xd22e5c39b5d291e25b1001bf6e9df6a7761fb8e6
(8) 0xae3f373802960c988be37ef08acd00054ba25676
(9) 0x7652fd246f13bf74221784906594e95271b7f7c6
 
Private Keys
==================
(0) ec8b88ab4dc3866b7c379aa9e3b803648663de0f6dd6437f1ae8a5e40a048215
(1) 8057eec8a864e2024991ffb35e89e3529f318b366253d5e78e1f694506fba8c3
(2) 6e842a1d0d8847b49269f55bf1f6f98ab6cfe5bb36f7b8b873f04983f498950c
(3) 3a210ea3439cdbabddc8fafb77cfa84f49a77f06c350cd2171cf39724bcfde64
(4) bacf1a42d99fb2d21e7e167d9550dc25d69c9bfb10ecd949c1fcb2dcdea3a794
(5) 31ab0b413add798b0dfd8363a98ad0f669d77e50ecae8912b5472e3870d2e0c2
(6) 394a552d7419b98dc6e9b84c9f58cfd5e5f00006b8c7aa4bd7ee872611ff5100
(7) 54642df6df2228c82510466cb9824d9468e38e0e0295fa9804f7d96d2fac7a77
(8) 0086cecc3decd77b984da9d2686b00ed78c003f537664dd87df29af306eac3d4
(9) 0f6229d27d41ade935abf8d5588ef52da0d817b2ade291e425d5fc84773a6b9d
 
HD Wallet
==================
Mnemonic:      leave offer sauce junk disorder remove rich vehicle opinion prepare member seminar
Base HD Path:  m/44'/60'/0'/0/{account_index}
 
Listening on localhost:8545

Then, you can run the tests:

brice@brice:~/eth-owned$ npm test
 
> eth-owned@0.0.1 test /home/brice/eth-owned
> truffle test
 
Using network 'development'.
 
  Contract: Owned
    ✓ should have an owner (58ms)
    ✓ should provides the restricted modifier (158ms)
 
  2 passing (235ms)

Package Sidebar

Install

npm i eth-owned

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

81.3 kB

Total Files

11

Last publish

Collaborators

  • bcolucci