SHARE
TWEET

Untitled

a guest Jun 20th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.5.0;
  2.  
  3. contract Lottery {
  4.     address public manager;
  5.     address[] public players;
  6.     event Deposit(address _from, uint value);
  7.  
  8.     constructor() public {
  9.         manager = msg.sender;
  10.     }
  11.  
  12.     function enter() public payable {
  13.         require(msg.value > .01 ether, 'Not enough ether');
  14.         players.push(msg.sender);
  15.     }
  16.  
  17.     function numberPlayers() public view returns(uint) {
  18.         return players.length;
  19.     }
  20. }
  21.      
  22. pragma solidity ^0.5.0;
  23.  
  24. contract Lottery {
  25.     address public manager;
  26.     address[] public players;
  27.     // event Deposit(address _from, uint value);
  28.  
  29.     constructor() public {
  30.         manager = msg.sender;
  31.     }
  32.  
  33.     function enter() public payable {
  34.         require(msg.value > .01 ether, 'Not enough ether');
  35.         players.push(msg.sender);
  36.     }
  37.  
  38.     function numberPlayers() public view returns(uint) {
  39.         return players.length;
  40.     }
  41. }
  42.      
  43. 1) Contract: Lottery
  44.        should create a player if the player send some ether:
  45.      Error: Invalid number of parameters for "enter". Got 1 expected 2!
  46.       at Object.InvalidNumberOfParams (/Users/adrian.ferrereses/.nvm/versions/node/v10.15.3/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-helpers/src/errors.js:32:1)
  47.       at Object._createTxObject (/Users/adrian.ferrereses/.nvm/versions/node/v10.15.3/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:699:1)
  48.       at constructor.detectNetwork.then.network (/Users/adrian.ferrereses/.nvm/versions/node/v10.15.3/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/execute.js:170:1)
  49.       at process._tickCallback (internal/process/next_tick.js:68:7)
  50.      
  51. Truffle v5.0.15 (core: 5.0.15)
  52. Solidity v0.5.0 (solc-js)
  53. Node v10.15.3
  54. Web3.js v1.0.0-beta.37
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top