GithubHelp home page GithubHelp logo

starter_kit's People

Contributors

gwmccubbin 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starter_kit's Issues

error while doing truffle console

when i type SocialNetwork.deployed() its giving me this error:
Uncaught:
Error: SocialNetwork has not been deployed to detected network (network/artifact mismatch)

ReferenceError: Asset is not defined

on "Token" and "EthSwap" deployment 'contract has a name', i get following error; "ReferenceError: asset is not defined" after compiling all .sol contracts successfully on EthSwap.test.js

https://i.imgur.com/CPlL74r.png

Any idea what went wrong? I'm like 1hr in the YT tutorial already.... do I need to add a missing method (import)?

MetaMask RPC Error?

Did anybody run into a MetaMask RPC Error while tyring to buy tokens? All the test passed and the conversion output works but once the swap button is click there is an ALERT: Transaction Error: Exception thrown in contract code on the Confirmation window and once the Confirm button clicked then the MetaMask RPC Error: error with payload and a bunch of parameters inside the object. Thanks.

MetaMask - RPC Error: Error: [ethjs-rpc] rpc error with payload {"id":9293667341869,"jsonrpc":"2.0","params":["0xf873198504a817c800836170d49493691c1a44c3240514f7523565e1b03c4751641e8829a2241af62c000084d0febe4c822d45a0a0435987818a1ac1ee917f85dad977c71ff28eb03d9afc55c375ca28daf16706a0222b5400fbd5c25e3b051f5373195abcf421b79f0585363e9d8c68322ff86347"],"method":"eth_sendRawTransaction"} [object Object]

also not sure if this is installed right !!

screwdaup@victors-Air-2 eth_swap % npm install

[email protected] preinstall /Users/screwdaup/eth_swap/node_modules/scrypt
node node-scrypt-preinstall.js

[email protected] install /Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents
node install

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.9/fse-v1.2.9-node-v83-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 19.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents
node-pre-gyp ERR! node -v v14.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/screwdaup/eth_swap/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)

[email protected] install /Users/screwdaup/eth_swap/node_modules/fsevents
node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v83-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/screwdaup/eth_swap/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/screwdaup/eth_swap/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64" "--napi_version=7" "--node_abi_napi=napi"
gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/fsevents
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/screwdaup/eth_swap/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/screwdaup/eth_swap/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/screwdaup/eth_swap/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 19.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/screwdaup/eth_swap/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/fsevents
node-pre-gyp ERR! node -v v14.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/screwdaup/eth_swap/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/screwdaup/eth_swap/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi' (1)

[email protected] install /Users/screwdaup/eth_swap/node_modules/keccak
npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."

[email protected] rebuild /Users/screwdaup/eth_swap/node_modules/keccak
node-gyp rebuild

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/keccak
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rebuild: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/screwdaup/.npm/_logs/2021-04-20T19_37_54_425Z-debug.log
Keccak bindings compilation fail. Pure JS implementation will be used.

[email protected] install /Users/screwdaup/eth_swap/node_modules/scrypt
node-gyp rebuild

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/scrypt
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

[email protected] install /Users/screwdaup/eth_swap/node_modules/secp256k1
npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."

[email protected] rebuild /Users/screwdaup/eth_swap/node_modules/secp256k1
node-gyp rebuild

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/screwdaup/eth_swap/node_modules/secp256k1
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rebuild: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/screwdaup/.npm/_logs/2021-04-20T19_37_59_116Z-debug.log
Secp256k1 bindings compilation fail. Pure JS implementation will be used.

[email protected] install /Users/screwdaup/eth_swap/node_modules/websocket
(node-gyp rebuild 2> builderror.log) || (exit 0)

[email protected] postinstall /Users/screwdaup/eth_swap/node_modules/core-js
node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[email protected] postinstall /Users/screwdaup/eth_swap/node_modules/core-js-pure
node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[email protected] postinstall /Users/screwdaup/eth_swap/node_modules/web3
node angular-patch.js

npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/scrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 2431 packages from 1208 contributors and audited 2567 packages in 174.05s
found 35780 vulnerabilities (31473 low, 823 moderate, 3483 high, 1 critical)
run npm audit fix to fix them, or npm audit for details
screwdaup@victors-Air-2 eth_swap %

nom install

Hi, I have been following your blockchain tutorial on YouTube but I hit a wall. I can't get past npm install. When I enter, (git:(master) npm install) in the terminal this is what I get, (eth_swap % git:(master) npm install
zsh: number expected). How can I get past this? I can't seem to find a way to fix it online.

I don't understand what is happening here

screwdaup@victors-Air-2 ~ % npm install --g [email protected]
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

TypeError: "ethSwap.buyTokens" is not a function

TypeError?

    it('Allows user to instantly purchase tokens from ethSwap for a fixed price', async () => {
      await ethSwap.buyTokens({ from: accounts[1], value: '1000000000000000000'})
    })
  })
})```

'react-scripts' is not recognized as an internal or external command,

$ npm run start

[email protected] start C:\Users\hw-kohagan\Documents\dapps\meme
react-scripts start

'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hw-kohagan\AppData\Roaming\npm-cache_logs\2020-05-20T11_2 6_14_393Z-debug.log

Did anyone run itto this problem - downloaded from UrL to text editor VS code

My code ๐Ÿ‘

"dependencies": { "babel-polyfill": "6.26.0", "babel-preset-env": "1.7.0", "babel-preset-es2015": "6.24.1", "babel-preset-stage-2": "6.24.1", "babel-preset-stage-3": "6.24.1", "babel-register": "6.26.0", "bootstrap": "4.3.1", "chai": "4.2.0", "chai-as-promised": "7.1.1", "chai-bignumber": "3.0.0", "react": "16.8.4", "react-bootstrap": "1.0.0-beta.5", "react-dom": "16.8.4", "react-scripts": "2.1.3", "truffle": "5.0.5", "web3": "1.0.0-beta.55" },

The Code to add the -" identicon.js " "^2.3.3",

Do I just add it manually through the code editor?

1) Contract: EthSwap EthSwap deployment contract has a name: Error: Invalid number of parameters for "undefined". Got 0 expected 1!

  1. Contract: EthSwap
    EthSwap deployment
    contract has a name:
    Error: Invalid number of parameters for "undefined". Got 0 expected 1!

This is my test im new to coding

const Token = artifacts.require('Token')
const EthSwap = artifacts.require('EthSwap')

require('chai')
.use(require('chai-as-promised'))
.should()

function tokens(n){
return web3.utils.toWei(n, 'ether')
}

contract('EthSwap' , (accounts) => {
let token, ethSwap

before(async() =>{
	token = await Token.new()
	ethSwap = await EthSwap.new(token.address)
	// Transfer all tokens to EthSwap (1 million) 
	await token.transfer(ethSwap.address, tokens('1000000'))

})

describe('Token deployment', async () => {
it('contract has a name', async () => {
let token = await Token.new()
const name = await token.name()
assert.equal(name, 'Renn Token')
})
})

describe('EthSwap deployment', async () => {
it('contract has a name', async () => {
let ethSwap = await EthSwap.new()
const name = await ethSwap.name()
assert.equal(name, 'EthSwap Ethereum Exchange')
})

	it('contract has tokens', async() => {
		let balance = await token.balanceOf(ethSwap.address)
		assert.equal(balance.toString(), tokens('1000000'))
	})
})

describe('buyTokens()', async () => {
it('Allows user to instantly purchase tokens from ethSwap for a fixed price', async () => {
await ethSwap.buyTokens({ from: accounts[1], value: web3.utils.toWei('1', 'ether') })
})
})

})

Regarding License

None of the dappuniversity Repositroies has license information with in the projects codebase . What is the licence for these projects. Before start using the repos wants to check on the license.

How to integrate metamask without web3

MetaMask/metamask-extension#8077
How will this affect the imports at the top of app.js? I can't even get the page to load after trying to integrate metamask, I tried installing and importing web3, ethereum, it always tells me something can't be resolved. What should I be installing and importing to app.js?

Sorry if this is poorly worded, new to coding.

Parsing Error:Unexpected token, expected","

I can't figure this out I have been trying for hours now.

[{
"resource": "/c:/Users/Robert Threadgill/Test Project/starter_kit/test/EthSwap.test.js",
"owner": "eslint",
"severity": 8,
"message": "Parsing error: Unexpected token, expected ","\n\n 96 | assert.equal(event.amount.toString(), tokens('100').toString())\n 97 | assert.equal(event.rate.toString(), '100'\n> 98 | })\n | ^\n 99 | })\n 100 | \n 101 | })",
"source": "eslint",
"startLineNumber": 98,
"startColumn": 5,
"endLineNumber": 98,
"endColumn": 5
}]C:\Users\Robert Threadgill\Test Project\starter_kit\test\EthSwap.test.js

const { assert } = require('chai')

const Token = artifacts.require('Token')
const EthSwap = artifacts.require('EthSwap')

require('chai')
.use(require('chai-as-promised'))
.should()

function tokens(n) {
return web3.utils.toWei(n, 'ether')
}

contract('EthSwap', ([deployer, investor]) => {
let token, ethSwap

before(async () => {
token = await Token.new()
ethSwap = await EthSwap.new(token.address)
// Transfer all token to EthSwap (1 Million)
await token.transfer(ethSwap.address, tokens('1000000'))
})
})

describe('Token deployment', async () => {
it('contract has a name', async () => {
let token = await Token.new()
const name = await token.name()
assert.equal(name, 'DApp Token')
})
})

describe('EthSwap deployment', async () => {
it('contract has a name', async () => {
let ethSwap = await EthSwap.new()
const name = await ethSwap.name()
assert.equal(name, 'EthSwap Instant Exchange')
})
})

describe('buyTokens()', async () => {
let result

before(async () => {
  // Purchase tokens before each example
  result = await EthSwap.buyTokens({ from: investor, value: web3.utils.toWei('1', 'ether') })
})

})
it('Allows user to instantly purchase tokens from ethSwap for a fixed price', async () => {
// Check investor token balance after purchase
let investorBalance = await token.balanceOf(investor)
assert.equal(investorBalance.toString(), tokens('100'))

  // Check ethSwap balance after purchase
  let ethSwapBalance
  ethSwapBalance = await token.balanceOf(ethSwap.address)
  assert.equal(ethSwapBalance.toString(), tokens('999900'))
  ethSwapBalance = await web3.eth.getBalance(ethSwap.address)
  assert.equal(ethSwapBalance.toString(), web3.utils.toWei('1', 'Ether'))

  const event = result.logs[0].args
  assert.equal(event.account, investor)
  assert.equal(event.token, token.address)
  assert.equal(event.amount.toString(), tokens('100').toString())
  assert.equal(event.rate.toString(), '100')
 })

describe('sellTokens()', async () => {
let result

before(async () => {
// Investor must approve tokens before the purchase
await token.approve(ethSwap.address, ('100'), { from: investor })
// Investor sell tokens
results = await ethSwap.sellTokens(tokens('100'), { from: investor })
})

it('Allows user to instantly sell tokens to ethSwap for a fixed price', async () => {
  // Check investor token balance after purchase
  let investorBalance = await token.balanceOf(investor)
  assert.equal(investorBalance.toString(), tokens('0'))

  // Check ethSwap balance after purchase
  let ethSwapBalance
  ethSwapBalance = await token.balanceOf(ethSwap.address)
  assert.equal(ethSwapBalance.toString(), tokens('1000000'))
  ethSwapBalance = await web3.eth.getBalance(ethSwap.address)
  assert.equal(ethSwapBalance.toString(), web3.utils.toWei('0', 'Ether'))

  // Check logs to ensure event was emitted with correct data
  const event = result.logs[0].args
  assert.equal(event.account, investor)
  assert.equal(event.token, token.address)
  assert.equal(event.amount.toString(), tokens('100').toString())
  assert.equal(event.rate.toString(), '100'
})

})

})

Uncaught SyntaxError: Unexpected identifier

If there's a level below beginner, that is I. I'm getting the above error when I try to start Node.js re: Greg's YT blockchain tutorial.

The node.js that I'm running looks nothing look the one in the tutorials. My format looks more like notepad. No colours change when I type in commands like

code
eth_swap

Any help is appreciated.

MK

Load Token

Stuck at tokenBalance from the specific user logged in.

Checking that the specific user is log in works fine but once I try to Load The Token using:

` //Load Token
const networkId = await web3.eth.net.getId()
const tokenData = Token.networks[networkId]

if(tokenData){
  const token = new web3.eth.Contract(Token.abi, tokenData.address)
  this.setState({token})

  let tokenBalance = await token.methods.balanceOf(this.state.account).call()
  console.log("tokenBalance", tokenBalance.toString())
  this.setState({ tokenBalance: tokenBalance.toString() })

} else {
window.alert('Token contract not deployed to detected network')
}

}`

Error:

ร—
Unhandled Rejection (TypeError): Cannot read property 'toString' of null
App._callee2$
C:/Users/Angela/eth_swap/src/components/App.js:33
30 | this.setState({token})
31 |
32 | let tokenBalance = await token.methods.balanceOf(this.state.account).call()

33 | console.log("tokenBalance", tokenBalance.toString())
| ^ 34 | this.setState({ tokenBalance: tokenBalance.toString() })
35 |
36 | } else {

Any ideas or pointers?
Thanks

The tokenBalance is set to '0'

Update: So the tokenBalance is set to :null though on the code is equal to '0' As
tokenBalance:'0'
So if its set correctly why it keeps getting null?

Update: Just needed to --reset the Contracts and that did the trick lol..

npm run start

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\webpack\lib\util\createHash.js:90:53)
at NormalModule._initBuildHash (C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\webpack\lib\NormalModule.js:386:16)
at C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\webpack\lib\NormalModule.js:418:10
at C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\webpack\lib\NormalModule.js:293:13
at C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at C:\Users\mechanic rayane\Documents\GitHub\starter_kit\node_modules\babel-loader\lib\index.js:51:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.12.1
if any body can help the localhost does not respond

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.