Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Kyto3 opened this issue May 22, 2021 · 0 comments

Comments

@Kyto3
Copy link

Kyto3 commented May 22, 2021

  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') })
})
})

})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant