-
Hello!
To test I have used almost a copy paste code as the fund-me example: const { inputToConfig } = require("@ethereum-waffle/compiler")
const { assert, expect } = require("chai")
const { network, ethers, getNamedAccounts } = require("hardhat")
const { developmentChains, networkConfig } = require("../../helper.hardhat")
developmentChains.includes(network.name)
? describe.skip
: describe("Code Unit Tests", async function () {
let Code //, raffleContract, vrfCoordinatorV2Mock, raffleEntranceFee, interval, player // , deployer
let deployer
const chainId = network.config.chainId
const NewValue = ethers.utils.parseEther("0.1") //ethers.utils.parseEther("0.3")
// let owner
// let addr1
// let addr2
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer
console.log(`Deployer: ${deployer}`)
Code = await ethers.getContract("Code", deployer)
})
it ("Subscription wallets", async function () {
const SUB = await Code.Subscription({value: NewValue})
await SUB.wait(1)
const CheckBalance = await Code.provider.getBalance(Code.address)
const EtherForm = ethers.utils.formatEther(CheckBalance)
console.log(`Balance: ${EtherForm}`)
// const Subs = await Code.getSubscribers()
// console.log(`Number of subs: ${Subs}`)
const Money = await Code.Withdraw()
await Money.wait(1)
const endingBalance = await Code.provider.getBalance(Code.address)
const EtherFormOut = ethers.utils.formatEther(endingBalance)
console.log(`Balance: ${EtherFormOut}`)
// const Balance = await Code.getBalance()
// console.log(`Balance inicial: ${Balance}`)
})
}) I also have tryed to especify gas and gasPrice in the hardhat-config file. But other errors occur: module.exports = {
solidity: "0.8.8",
defaultNetwork: "hardhat",
networks: {
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 4,
blockConfirmations: 6,
gas: 2100000,
gasPrice: 130000000000
},
Anyone have had a similar issue? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Is this the Raffle/Lesson 9? |
Beta Was this translation helpful? Give feedback.
-
Solved this doing the subscription with 1000 wei, It works fine but I don't know why it doesn't works with 0.1 Eth for example. |
Beta Was this translation helpful? Give feedback.
Solved this doing the subscription with 1000 wei, It works fine but I don't know why it doesn't works with 0.1 Eth for example.