Giter Site home page Giter Site logo

openzeppelin / starter-kit Goto Github PK

View Code? Open in Web Editor NEW
122.0 26.0 67.0 2.1 MB

An OpenZeppelin starter kit containing React, OpenZeppelin SDK & OpenZeppelin Contracts.

Home Page: https://openzeppelin.com/starter-kits

License: MIT License

JavaScript 71.62% HTML 2.89% Solidity 2.57% Shell 0.14% SCSS 22.77%
truffle ganache react ethereum openzeppelin metamask infura web3 web3js dapp

starter-kit's Introduction

⚠️ This project is deprecated. We are no longer actively developing new features nor addressing issues. Read here for more info, and reach out if you are interested in taking over maintenance. We suggest looking into create-eth-app for a popular alternative to this project.

OpenZeppelin Starter Kit

An OpenZeppelin Starter Kit containing React, OpenZeppelin CLI, OpenZeppelin Contracts, Truffle and Infura.

This kit comes with everything you need to start using upgradeable Smart contracts inside your applications. It also includes all the configuration required to deploy to different networks.

Requirements

Install Ganache, and Truffle

Installation

Ensure you are in a new and empty directory, and run the unpack command with starter to create a starter project:

npx @openzeppelin/cli unpack starter

Run

In a new terminal window, run your local blockchain:

ganache-cli --deterministic

In your original terminal window, at the top level of your folder, initialize the project and follow the prompts:

npx oz init

In a new terminal window, in the client directory, run the React app:

cd client
npm run start

Interact

You can interact directly with your smart contracts from the openzeppelin cli.

npx oz transfer

send funds to a given address.

npx oz balance [address]

query the ETH balance of the specified account, also supports ERC20s.

npx oz send-tx

sends a transaction to your contract and returns the events.

npx oz call

execute a constant method and receive back the value.

Type npx oz to see a complete list of availible commands.

Test

Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the truffle development console.

// inside the development console.
test

// outside the development console..
truffle test

Jest is included for testing React components. Compile your contracts before running Jest, or you may receive some file not found errors.

// ensure you are inside the client directory when running this
npm run test

Build

To build the application for production, use the build script. A production build will be in the client/build folder.

// ensure you are inside the client directory when running this
npm run build

FAQ

starter-kit's People

Contributors

abcoathup avatar amystrayer avatar botary avatar cgcardona avatar crazyrabbitltc avatar dependabot-preview[bot] avatar frangio avatar gesquinca avatar itinance avatar nventuro avatar rrecuero avatar spalladino avatar ylv-io avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starter-kit's Issues

Migrate from 3 years old `scrypt` compatible with only Node v10

Hi, I had a lot of issues setting up the starter kit. Took me quiet some time to figure the issue. The problem is that all of the libraries, including the tabookey depend on the scrypt package which is 3 years old and doesn't compile Keccak alg and others on Node v12.

In order to setup the project, I had to install node v10.13.0.

I think it would be great if OpenZeppelin woud support [email protected] as well as latest Node version.

Great work on the Gas Station though! I hope I can integrate today the GSN into my project's smart contracts and setup the ReplayServer using your kit :)

Truffle will not unbox ZeppelinOS

PS C:\Users\dshod\Git\truffle\my-app> truffle unbox zeppelinos/zepkit

√ Preparing to download
√ Downloading
√ Cleaning up temporary files
× Setting up box
Error: Error: Error: Command failed: npm install && cd client && npm install
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dshod\AppData\Roaming\npm-cache_logs\2019-04-29T05_01_05_480Z-debug.log

at Object.unbox (C:\Users\dshod\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-box\box.js:69:1)
at processTicksAndRejections (internal/process/task_queues.js:88:5)

Truffle v5.0.14 (core: 5.0.14)
Node v12.0.0
PS C:\Users\dshod\Git\truffle\my-app>

Out of gas when initializing Counter in zepkit for truffle (5.0.17) and ganache-cli (6.4.3)

Following instructions for hot reloading demo https://blog.zeppelinos.org/solidity-hot-reloading-using-zepkit/ but using later versions of truffle (5.0.17) and ganache-cli (6.4.3).

When I initialized the Counter npx zos create Counter --init initialize --args 2
I got an out of gas error Returned error: VM Exception while processing transaction: out of gas

I solved by specifying the gas as 6721975 (ganache-cli gas limit) in truffle-config.js, so box may need to be updated to include (unless there is a better way to resolve).

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*",
      gas: 6721975,
    },
...

`npm run start-blank` will make client project uncompilable

start-blank is just rm -rf client/src && cp -rf barebones/src client/ command. For some reason barebones/src/components is missing all the components except Web3Info. So running npm run start-blank will put project in state of lacking all the components except Web3Info.

Issue in setting up zepkit

error
As it is visible in the screenshot, I did not get a green check in the "setting up box". Anyone know why it is happening and will it cause any issue in the future?

ZepKit will not load unless Ganache is running

When developing with ZepKit, the ZepKit will not run unless you have Ganache running. It will give you the error: Failed to load web3, accounts, or contract. Check the console for details. regardless of whether or not you have MetaMask enabled or what Network you are connected to. It does not give you feedback that the actual problem is the failure to start a development network.

IMHO this error should be more specific- as we should clarify that no Dev network is found, No contracts or found or now injected web3 is found.

Upgrade to React 16.8.0

It would be great to see ZepKit updated to REact 16.8.0 so that we can enjoy the new features such as Hooks! :-)

Error: Cannot find module './build/Release/scrypt'

Compiled with warnings.

./src/components/Header/index.js
Line 3: 'logo' is defined but never used no-unused-vars

./src/components/Footer/index.js
Line 5: 'pencil' is defined but never used no-unused-vars

../contracts/Counter.sol
Error: Command failed: '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/.bin/oz' compile
internal/modules/cjs/loader.js:628
throw err;
^

Error: Cannot find module './build/Release/scrypt'
Require stack:

  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt.js/node.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth-accounts/src/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth/src/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3/src/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/artifacts/ZWeb3.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/helpers/encodeCall.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/cli/lib/bin/oz-cli.js
    at Module.require (internal/modules/cjs/loader.js:683:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt.js/node.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth-accounts/src/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth/src/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3/src/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/artifacts/ZWeb3.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/helpers/encodeCall.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/cli/lib/bin/oz-cli.js'
    ]
    }

../contracts/Wallet.sol
Error: Command failed: '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/.bin/oz' compile
internal/modules/cjs/loader.js:628
throw err;
^

Error: Cannot find module './build/Release/scrypt'
Require stack:

  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt.js/node.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth-accounts/src/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth/src/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3/src/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/artifacts/ZWeb3.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/helpers/encodeCall.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/index.js
  • /mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/cli/lib/bin/oz-cli.js
    at Module.require (internal/modules/cjs/loader.js:683:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/scrypt.js/node.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth-accounts/src/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3-eth/src/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/web3/src/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/artifacts/ZWeb3.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/helpers/encodeCall.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/upgrades/lib/index.js',
    '/mnt/c/Users/samps/projects/wsl/openzeppelin/starterkit/tutorial/node_modules/@openzeppelin/cli/lib/bin/oz-cli.js'
    ]
    }

Unable to fund my Counter contract

I have setup the RelayHub, ganache, frontend but when I execute npx oz-gsn fund-recipient --recipient 0x9b1f7F645351AF3631a656421eD2e40f2802E6c0 it seems to succeed but my contract has still 0 funds afterwards.

Here is a picture with all the details:
Screen Shot 2019-08-20 at 12 41 45
Screen Shot 2019-08-20 at 12 40 41

Any idea what could be wrong?

Also, in order to enable GSN for Counter, I had to modify the contract but the starter kit is coming with no Migrations.sol from Truffle, neither the deployment script so I had to add the following 2 files:

client/contracts/Migrations.sol

pragma solidity ^0.5.0;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

  constructor() public {
    owner = msg.sender;
  }

  modifier restricted() {
    if (msg.sender == owner) _;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }

  function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}

and:
client/migrations/2_deploy_counter.js

const Counter = artifacts.require("Counter.sol");

module.exports = (deployer) => {
  deployer.deploy(Counter).then(() => {
    console.log("Counter.sol successfully deployed!");
  });
};

Questions:

  1. Why my funded recipient has still 0 ETH?
  2. Why are the migrations files and scripts missing? Did I skip some step or it's a bug?
  3. I think the UI should display the counter button right away but explain in the UI why it's disabled. I only realized I can interact with Counter contract using the UI by checking the code. Should be more obvious, as the first thing I want to do as a user when using the oz-gsn-kit is to test making transactions and see I don't pay gas for them.
          {(!!funds || !!balance) && (
            <React.Fragment>
              <div className={styles.label}>
                <strong>Counter Actions</strong>
              </div>
              <div className={styles.buttons}>
                <Button onClick={() => increase(1)} size="small">
                  {sending ? <Loader className={styles.loader} color="white" /> : <span> Increase Counter by 1</span>}
                </Button>
                <Button onClick={() => decrease(1)} disabled={!(methods && methods.decreaseCounter)} size="small">
                  {sending ? <Loader className={styles.loader} color="white" /> : <span> Decrease Counter by 1</span>}
                </Button>
              </div>
            </React.Fragment>
          )}

Update:

Atm, I am still debugging why my contract has 0 ETH. I will post update if I find out.

Update 20.8.2019 13:13 CET

  console.log(currentBalance.toString());

  if (currentBalance.lt(targetAmount)) {
    const value = targetAmount.sub(currentBalance);
    console.log(value);
    await relayHub.methods.depositFor(recipient).send({ value, from });
    return targetAmount;
  } else {
    return currentBalance;
  }

Output:

1000000000000000000

Recipient 0x9b1f7F645351AF3631a656421eD2e40f2802E6c0 balance is now 1000000000000000000 wei

Outputs 1 ETH, which means the recipient is apparently already funded... but querying Ganache balance still outputs 0 hm

Update 20.8.2019 15:11

Soooolved. So many moving pieces heh. The problem was that the Counter.sol was a valid RelayRecipient but wasn't initialized. I was missing this function call:

const Counter = artifacts.require("Counter.sol");

module.exports = (deployer) => {
  deployer.deploy(Counter).then((instance) => {
    console.log("Counter.sol successfully deployed!");
    console.log("Initializing the GSN...");
    instance.initialize(0).then(() => {
      console.log("Counter.sol successfully initialized with GSN!");
    });
  });
};

Which performs:

function initialize(uint num) public initializer {
     GSNRecipient.initialize();
     _owner = _msgSender();
    count = num;
  }

... I thought the initialize() is part of a contract constructor and was already executed.

Now the UI looks better and all parts seems to work well. Next doubt, who is the msg.sender behind "increaseCounter()" call? Gonna verify.

Feel free to use my questions for your "user research" so you know how devs are thinking about the GNS implementation :)

Update 20.8.2019 15:47

Simply modified the increaseCounter() function and some React code and...

function increaseCounter(uint256 amount) public {
    count = count + amount;
    counterIncrementer = _msgSender();
  }

Wopaa! Works like charm now @ylv-io and @spalladino!

Screen Shot 2019-08-20 at 15 44 12

Screen Shot 2019-08-20 at 15 43 54

Here is the code if somebody wants to check it out: https://github.com/EnchanterIO/starter-kit-gsn/commits/master

Gg.

Error: npm install -g [email protected] [email protected] @openzeppelin/[email protected]

I am getting the following errors when trying to install the starter kit here

Command:
npm install -g [email protected] [email protected] @openzeppelin/[email protected]

Error:

npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
npm ERR! path /usr/local/lib/node_modules/@openzeppelin/cli/node_modules/websocket
npm ERR! code EISGIT
npm ERR! git /usr/local/lib/node_modules/@openzeppelin/cli/node_modules/websocket: Appears to be a git repo or submodule.
npm ERR! git     /usr/local/lib/node_modules/@openzeppelin/cli/node_modules/websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

Does not detect Ganache

Hi managed to build the repo after the rimbleUi error by replacing PublicAddress by EthAddress.
But now when I start the app using "npm run start".

Then I also had to change "FALLBACK_WEB3_PROVIDER = process.env.REACT_APP_NETWORK || 'http://0.0.0.0:8545';" --- to 127.0.0.1:8545

The webpage loads up but I get an error on the console saying no local ganache found, when I have ganache running.

node --version
v12.14.1
npm --version
6.13.4
Mac Os

Split Zepkit into two boxes

Currently zepkit has two modes: tutorial and barebones application. Split it into two boxes: "zos unpack tutorial" and "zos unpack zepkit".

Out of Gas: Counter deployment failed with error: Returned error: sender doesn't have enough funds to send tx.

I did everything that was listet in README and official tutorial.

Ganache-CLI V6.3.0 is running in another terminal session providing 10 Accounts full of 100 ETH each.

How ever, when I want to "zos push" the default Contract "Counter.sol", the following error appears:

Counter deployment failed with error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 351843720888280000000000 and the sender's account only has: 100000000000000000000

The full output:

$ zos push
Compiling contracts with Truffle...

Compiling your contracts...
===========================
> Compiling ./contracts/Counter.sol
> Compiling ./contracts/Wallet.sol
> Compiling openzeppelin-eth/contracts/access/Roles.sol
> Compiling openzeppelin-eth/contracts/access/roles/MinterRole.sol
> Compiling openzeppelin-eth/contracts/access/roles/PauserRole.sol
> Compiling openzeppelin-eth/contracts/lifecycle/Pausable.sol
> Compiling openzeppelin-eth/contracts/math/SafeMath.sol
> Compiling openzeppelin-eth/contracts/ownership/Ownable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Detailed.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Mintable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/ERC20Pausable.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/IERC20.sol
> Compiling openzeppelin-eth/contracts/token/ERC20/StandaloneERC20.sol
> Compiling zos-lib/contracts/Initializable.sol
> Artifacts written to /xxxxxxxxxx/build/contracts
> Compiled successfully using:
   - solc: 0.5.0+commit.1d4f565a.Emscripten.clang


Using session with network local, sender address 0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086, timeout 3600 seconds
WARNING: Address 0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086 is not checksummed. Consider checksumming it to avoid future warnings or errors.
Validating contract Counter
Uploading Counter contract as Counter
Deploying logic contract for Counter
Counter deployment failed with error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 351843720888280000000000 and the sender's account only has: 100000000000000000000
Created zos.dev-1559219644112.json

zos-version: 2.3.0
ganache-cli: 6.3.0
ganache-core: 2.4.0

Review setup instructions for the end user

As a feedback from internal users, the setup for the starter kit is a bit cumbersome, involving several steps. Some ideas for simplifying it:

  • Run oz init as part of the setup
  • Run ganache automatically along with the react dev server (if the user does not start it on its own)

Installed Version of OpenZeppelin-solidity is not current

In checking the installed version of openzeppelin-solidity that comes with zep kit I noticed that it is not current with the openzeppelin-solidity library. It misses a number of contracts that have since been added.

NOTE: Adding a newer version of openzeppelin-solidity needs a newer version of the compiler.

Compiled with warnings

Hi.
I was running

npm run start

The result

Compiled with warnings.

../contracts/Counter.sol
Error: Command failed: zos push --network development --no-interactive
error: unknown option `--no-interactive'

../contracts/Wallet.sol
Error: Command failed: zos push --network development --no-interactive
error: unknown option `--no-interactive'

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

What's the keywords?
What should i search?

You have to restart web server after `create` command

Once you push and create the first counter and where we tell the user to put a console.log. It doesn't load the contract unless you restart the web server. It doesn't pick it up otherwise. It happened to me and pretty much everyone else that followed

"Truffle Box Does Not Exist"

When following along Zepkit's installation instructions, the command 'truffle unbox zeppelinos/zepkit' returns this error.
screen shot 2019-02-25 at 9 44 23 pm

`npm run start` is hanging

Hi there

starting from scratch following all instructions in the README, when I run npm run start in the client?-directory, the process is hanging with "Starting the development server...". The browser gets opened referring to "localhost:3000", but nothing happens. It will timeout later.

No further details are provided in the console. It just hangs.
I'm pretty sure that no other application is listening on this port (sudo lsof -n -i -P | grep 3000).

Tested on Macbook Pro running MacOS Mojave.

$ node -v
v10.11.0

$ npm -v
6.9.0

$ zos --version
2.3.0

Is anybody else facing this issue?

I remember it has worked exactly one week ago without any issues. Maybe some dependencies have changed and broke it somewhere?

GSN with ERC20 Compliant Smart Contract

I'm following the tutorial here: https://docs.openzeppelin.com/sdk/2.5/gsn-dapp. And I have successfully done everything required (though locally on Ganache). But i'm facing a problem. I am building an ERC20 compliant smart contract. And i need to call approve() before calling transferFrom() but if I call the approve() function it returns "Error: Could not get relay hub address from recipient at ". And i guess the reason is because the ERC20 token is not configured to accept relayed calls. But i can't call the transferFrom() function because it will revert. Please, how do i go about this problem with GSN?

zos unpack zepkit omits the previous startup instructions.

When previously using truffle to unbox zepkit, at the end of the process we were greeted with:


✔ Preparing to download
✔ Downloading
✔ Cleaning up temporary files
✔ Setting up box

Unbox successful. Sweet!

Commands:

  Add a contract:                            zos add <contract_name>
  Create a session:                          zos session --network <network_name> --from <default_address> --expires 36000
  Compile all contract and deploy them:      zos push --deploy-dependencies
  Create upgradeable instance of a contract: zos create <contract_name>
  Update an upgradeable contract:            zos update <contract_name>
  Test contracts:                            truffle test
  Test dapp:                                 cd client && npm test
  Run dev server:                            cd client && npm run start
  Build for production:                      cd client && npm run build
  Start from a blank slate:                  npm run start-blank

However when using zos unpack zepkit we are welcomed at the end of the unpack with:

The kit is ready to use. Amazing!

Quick Start
Run your local blockchain:
> ganache-cli --secure -u 0 -u 1 -u 2 --deterministic
Initialize the ZeppelinOS project:
> zos init zepkit
Go to the client directory:
> cd client
Run the React app:
> npm run start
Continue in your browser!
More at https://github.com/zeppelinos/zepkit/tree/stable

The previous version I believe was more informative for developers. In my opinion!

Minor README.md correction

Where the README instructions read truffle unbox zepkit should be changed to truffle unbox zeppelinos/zepkit.

I can fork and submit a PR to fix if that's helpful.

Setup instructions on zepkit.zeppelinos.org result in Command failed error

Hi @ylv-io

Following the instructions on https://zepkit.zeppelinos.org/

  1. Install truffle and ganache-cli for local development.
    npm install -g [email protected] && npm install -g [email protected]
  2. Install ZeppelinOS.
    npm install --g [email protected]
  3. Create a folder for your app and enter inside.
    mkdir my-app && cd my-app
  4. Unbox the ZepKit.
    truffle unbox zeppelinos/zepkit
  5. Switch to the client folder and run the web application to continue.
    cd client; npm run start
  6. The ZepKit should be running locally! Continue the instructions on your localhost.

I get the following error when running cd client; npm run start

Compiled with warnings.

../contracts/Wallet.sol
Error: Command failed: zos push --network development
Compiling contracts with Truffle...
ZeppelinOS file zos.json not found. Run 'zos init' first to initialize the project.

../contracts/Counter.sol
Error: Command failed: zos push --network development
Compiling contracts with Truffle...
ZeppelinOS file zos.json not found. Run 'zos init' first to initialize the project.

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

I assume a configured zos.json should be included in the zeppelinos/zepkit truffle box.

In addition, the instructions in the README of the repo state you need to run ganache-cli --secure -u 0 -u 1 -u 2 --deterministic and zos init zepkit. The README and website instructions should be the same.

Failed to Compile

After following these initial comands:
ganache-cli --deterministic (other terminal)
openzeppelin init
cd client npm run start

I got this: ( Using: Windows 10 OS / NodeJs Command Prompt / Node.js v12.10.0. / [email protected] / [email protected] / @openzeppelin/[email protected]).

Failed to compile.
./node_modules/@openzeppelin/network/react/useWeb3Hook.js
Module not found: Can't resolve '../context/Web3Context' in 'C:\Users\dimit\Projects\OpenZeppelinSDK\Starter\client\node_modules@openzeppelin\network\react'

Please help!

Fix infura API token usage in truffle config

The current truffle config defines an INFURA_ID which is never used, and uses process.env.INFURA_API_KEY instead. We should use the env variable if set, but fallback to the pre-set infura ID otherwise.

To make matters worse, .env.example defines (and App.js uses) an env variable REACT_APP_INFURA_KEY. We should change the env var being used in truffle config so it matches this one, otherwise the user needs to define two env vars with the same value.

Installation Instructions are missing some commands

I’ve run into small issue with ZepKit. If you follow instructions from official page (zepkit.zeppelinos.org), you would get the following error (image attached).
The reason is that you have to run truffle compile first, so contract’s json files are present before running front-end.

screen shot 2019-02-22 at 3 59 48 pm

You also have to run ganache-cli --secure -u 0 -u 1 -u 2 --deterministic in order for your metamask to connect to local blockchain. It is mentioned at github, but not mentioned at zepkit itself. It might be a bit confusing.

Restructure documentation

As part of a bigger review of the documentation (OpenZeppelin/docs.openzeppelin.com#47), we're restructuring the content. The idea is to organize it in a conceptual hierarchy rather than divide it in "Basics" and "Advanced".

The target structure is:

  • Overview
  • Usage (or perhaps this should be an entry guide?)
  • Available Kits
    • Starter / Base
    • Tutorial
    • GSN
  • How to create your own

Integrate GSN into starter-kit

We currently have two boxes in starter kit that demo how it is used: one with a local provider, another with an injected one.

While we could add one with a GSN provider, it is not possible to show how to use it because none of the boxes actually send a tx, which is the main feature of GSN.

We need to decide:

  • Are we going to include a demo box for the GSN in the kit?
  • If so, should it run locally or on a testnet?
  • If locally, how are we managing the GSN development setup?
  • If remotely, for which contract?

I'd suggest going with a local demo, so we force ourselves to also handle the GSN development setup for the user, which may not yet be trivial.

The other point to discuss is whether we want to include this into the vanilla kit, into a GSN dedicated one, or into the tutorial one.

Merge master & stable branches

Master and stable branches have diverged (20 ahead, 38 behind). We need to merge them or clearly identify where to keep developing.

Update: @ylv-io pointed out that master is being used for truffle box, while stable for zepkit. Let's just add a note on the README explaining this for future reference.

Out of gas: Test networks require a different HD-Wallet-Path against to Mainnet

Long story short:

I sent some Test-Ether on Ropsten into the first address, that was derived with MyCrypto out of my Mnmonics, but the deployment using truffle or zos-Tool was constantly running out of gas, no matter which funds was sent. And here is why this happened and how to solve:

Long Story:

When we import a Mnemonic into MyCrypto or MyEtherWallet (or other Tools) for Ropsten-Network, it derives the address with the following path: m/44'/1'/0'/0, while truffle-hdwallet-provider constantly is using m/44'/60'/0'/0/ no matter wich network will be used.

m/44'/60'/0'/0/ is the derivation path for Ethereum Mainnet, while all other Testnets across all coins share m/44'/1'/0'/0 for path derivation.

Therefor, I get a different address on MyCrypto as the first address than it will be used by truffle-hdwallet-provider.

This means, when I transfer Test-Ether on Ropsten Network to the first address out of my Mnemonic, it will be a different address as the HDWalletProvider will generate with our default settings.

Example:

Mnemonic: "tooth spike smile swarm adapt history motion salt outdoor document observe cloth"

MyCrypto Ropsten (using m/44'/1'/0'/0): 0x9dbFAFB5Edd1D69aCaC1C104C526C4ACDc20F3Ae

truffle-HDWallet-provider with default settings (using m/44'/60'/0'/0): 0xC0306fe5c3E90025AD56832A4399670be51b3Eec

Thus, a deployment of contracts, that are based on truffle-config.js as it is used in this repository, will raise "Out of gas"-exception because different addresses will be used. I would send Test-Ether to the address, that was generated by MyCrypto. And truffle-hdwallet-provider expects the second address, which probably has no funds nor could sign any transaction due to missing private key.

Fortunately the constructor of truffle-hdwallet-provider offers an argument for the wallet_hdpath that should be used for address derivation. So for using Ropster addresses (and even all other Testnetworks) properly with MyCrypto / MyEtherWallet, the following constructor is required to make transactions work as expected.

ropsten: {
  provider: () => new HDWalletProvider(
    process.env.DEV_MNEMONIC, "https://ropsten.infura.io/v3/" + infuraProjectId, 
        0, 1, true, "m/44'/1'/0'/0/"
    ),
  networkId: 3,       // Ropsten's id
},

Explanation of the parameters:

0 = start with first address
1 = derive only 1 addresses
true = sharedNonce (default)

“m/44’/1’/0’/0/” = BIP44 derivation path that is used for test networks (across all coins)

We should reflect this in truffle-config.js as well.

Failed to compile

Hi there,

I got following error as running npm run start:

Failed to compile.

./src/components/Instructions/index.js
  Line 328:  'addressDefault' is not defined  no-undef

Search for the keywords to learn more about each error.

My node version is v10.15.3 and npm version is 6.9.0.

Thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.