Skip to main content

Questions tagged [remix-tests]

remix-tests is a tool by Ethereum Remix Team which can be used for Solidity Unit Testing.

Filter by
Sorted by
Tagged with
3 votes
3 answers
336 views

Issue with Accounts Not Displaying in Remix VM (Cancun and Shanghai) Environments

I'm encountering an issue with Remix VM where, after successful compilation, the accounts are not displaying in the "Deploy" section. This problem persists in both the Cancun and Shanghai ...
Piña's user avatar
  • 33
1 vote
1 answer
24 views

Is there any possible way to call node js function and retrive the returned value on solidity smart contract?

In solidity , from solidity, I need to call the JS function that I have created in Node.js Scenario : I tried some encryption on Solidty, but its not working, so what I'm thinking is that I need to ...
AIT DEV's user avatar
  • 15
2 votes
1 answer
177 views

Remix errors trying to test and run a script

I'm taking a course and trying to run a file called 3_Ballot.sol. I'm getting this error: "You have not set a script to run. Set it with @custom:dev-run-script NatSpec tag." I've been ...
Josh's user avatar
  • 21
0 votes
0 answers
8 views

Lost My REMIX IDE code, cleaning browser cache [duplicate]

I accidentally lost my final year research project code, which was on remix IDE (chrome), while cleaning my browser cache. How can I recover that?
Vinuri 's user avatar
0 votes
0 answers
8 views

Deployed smart contract on base with REMIX but now it wont show in remix and i cant verify the contract

here is the contract im trying to verify. it seems i lost the original code from REMIX. https://library.dedaub.com/base/address/0xf518a23ec64feec4869860eafb4d7d717a987e9d
iamearly's user avatar
1 vote
1 answer
25 views

remix.ethereum.org - you cannot test payable methods

I am using: https://remix.ethereum.org contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Receiver { receive() external payable {} function getMoney() public payable ...
Harry's user avatar
  • 11
0 votes
0 answers
28 views

Hello, Can you help me for issue? (ETH CONTRACT DEPLOY)

I am learning to deploy contracts to improve myself. I copied a contract that was actually deployed and deployed it on the Goerli testnet. However, I have these parts and I wonder why. It has an ...
BluePlanet's user avatar
1 vote
1 answer
456 views

assertEq is showing error when written in the test file foundry

I am writing the test by following the lesson 7 tutorial and got this error, even I imported Test from forge-std Undeclared identifier. Did you mean "assert"? this is the actual error // ...
Sardar Ahmed Khan's user avatar
1 vote
0 answers
191 views

Remix IDE runs every transaction twice in Remix VM - Mainnet fork (and Testnet forks)

I ran some unit tests in Remix IDE using the Remix VM - Merge. It works without any issues. As I needed the ERC-1820 registry contract I switched to Remix VM - Mainnet fork for the unit tests. Some ...
fish filet's user avatar
0 votes
1 answer
79 views

Why Remix keeps giving "The requested account and/or method has not been authorized by the user" error?

I keep getting this error but, after a while, the transaction works. Is there any problem with Remix?
Falcon Stakepool's user avatar
0 votes
1 answer
27 views

How do i prevent further burn once the minimum total supply of my token has been reached?

I have successfully created my token and I have an automatic burn fee but I would like the burn fee to be automatically set to 0 once the minimum total supply has been reached and also prevent any ...
samuel godwin's user avatar
0 votes
1 answer
48 views

Data location must be "calldata" for parameter in external function, but none was given. --> Undeclared identifier

In Remix, I'm getting the following error. contracts/TestBench.sol:138:30: TypeError: Data location must be "calldata" for parameter in external function, but none was given. function ...
Mowzer's user avatar
  • 211
1 vote
1 answer
484 views

Gas for call to a simple contract function on Remix

just started looking into an Hello World example of solidity into the Remix web IDE. I deployed it on the embedded blockchain on Remix and I was curious on the execution cost field it was returned ...
Mattiatore's user avatar
0 votes
1 answer
47 views

Reentrancy attack question

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; interface IBank { function deposit() external payable; function withdraw(...
Joe B's user avatar
  • 3
1 vote
1 answer
19 views

why can use array's push [duplicate]

//一个投票的合约 contract Ballot{ //提案对象 struct Proposal{ bytes32 name; uint voteCount;//累计票数 } //获取获胜的对象 function winningProposal() public view returns (...
lal's user avatar
  • 11
1 vote
1 answer
21 views

How would you write this function in Solidity ? I keep getting error because of the floats

function calcPercentage(int elapsedTime){ return round(8000 + (elapsedTime * (100/36))/10000); }
user108118's user avatar
0 votes
4 answers
869 views

In Remix unable to switch from Javascript VM to Injected Web3

I'm looking to learn the high-level basics of code so I am watching and following along to freeCodeCamp.org and their 16-hour-long video. I am 2 hours and 5 minutes into the video and it's time to ...
Kev Silk 's user avatar
1 vote
0 answers
213 views

getting error while calling getrandomnumber in my smart contract

error message: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? execution reverted { "originalError": {...
Raaj Vashitva's user avatar
1 vote
1 answer
305 views

Testing external functions in Remix

I am writing unit tests on Remix (using Solidity Unit Testing) for my contract. However, I am having trouble testing external functions when msg.sender is involved. The contract: pragma solidity 0.8....
Matteo Pinna's user avatar
0 votes
1 answer
346 views

How do I test extra parameters in Remix?

I tried to use Remix to test a Smart Contract: /******************************************************************** * Make bids with ETH or an ERC20 Token specified by the NFT seller.* * Additionally,...
NineCattoRules's user avatar
0 votes
0 answers
26 views

Trouble deploying an ERC20 contract remix

Hi so some assistance would be greatly appreciated. I am able to successfully deploy my contract when my ether is set to 0. It will go through MM and everything looks solid. By the way I am using test ...
Mark's user avatar
  • 1
1 vote
0 answers
120 views

Solidity unit tests using Remix unit_tests plugin

I have a 2 contracts Token A - Basic ERC20 Token Token B - An ERC20 Token which takes Token A My question is more on solidity UNIT_TESTS plugin. From my understanding, I can only manipulate msg....
momoja's user avatar
  • 239
0 votes
0 answers
123 views

Is it possible to import multiple contracts inside a remix test and pass an ERC20 address?

I want to run unit tests in remix where I have 2 contracts Token A (AUSDC) that will be exchanged for Token B (AToken) However, during the imports, I am shown the ff: error import "../contracts/...
momoja's user avatar
  • 239
1 vote
0 answers
288 views

How to run a REMIX UNIT TEST for 2 Smart Contracts (Token Contract and Staking Contract)

I have 2 Smart Contracts Token Contract: A basic ERC20 with 6 decimals Staking Contract: A contract which locks in the Token above and requires the Token address to be part of the parameters I am ...
momoja's user avatar
  • 239
0 votes
1 answer
73 views

I can't figure out why my tests don't pass

I always get this an error when I run my tests, I don't know what to do anymore: You can test at my repository on GitHub here
Arthur Breguez's user avatar
0 votes
2 answers
300 views

How can I pass an amount with the gas fee and msg.value in solidity unit test

Id like to test this function of buyTokens but i can't figure out how to pass the amount of tokens as argument This is the test contract Function to be tested
Arthur Breguez's user avatar
0 votes
1 answer
277 views

chainlink oracle http get request not returning value - taken from example but still is not working

I have my own oracle code that suddenly stopped returning any output. So I double checked with the official Chainlink oracle example on remix and that is also not returning any value... I have sent ...
Btadford's user avatar
1 vote
1 answer
59 views

Unexpected "catch Error" Behavior

IDE: Remix (on Firefox and Brave) Compiler: v0.8.12 I am practicing with unit tests on the Ballot sample contract from Solidity's documentation, and am having trouble understanding how does catch ...
Globallager's user avatar
0 votes
1 answer
107 views

Why does my mint function throw an insufficent amount error?

I'm testing a smart contract on REMIX, everything works but the mint function provided throws an insufficient amount error even though I have enough ether in my account. It seems like theirs no ether ...
piña's user avatar
  • 209
0 votes
1 answer
225 views

How to write Test case for NFT buy functionaity?

Function for buying NFT function buy(address nftContract, uint256 itemId) public payable nonReentrant { uint256 price = idToMarketItem[itemId].price; uint256 tokenId = ...
Samresh Kumar Jha's user avatar
1 vote
1 answer
346 views

What to pass for abi encoded arguments

I had cloned usdc contract on polygon test network and deployed it. I want to test deposit method but couldn't able to figure what to pass in depositData( more specifically in which format should i ...
Rohit's user avatar
  • 11
0 votes
1 answer
74 views

Remix's documented test test#2 fails

Why the remix’s documented test#2 fails? Hi, I am following the remix’s example test available at: https://remix-ide.readthedocs.io/en/latest/unittesting_examples.html. The sender code is: pragma ...
zak100's user avatar
  • 1,406
0 votes
1 answer
48 views

Testing the Remix example2 contract

I am trying to execute the remix test#2 at: Testing the Remix example contract#2 But I am gettig the error: tests/senderTest_test.sol:33:22: DeclarationError: Undeclared identifier. Assert.equal(...
zak100's user avatar
  • 1,406
1 vote
1 answer
657 views

TypeError: Member "push" not found or not visible after argument-dependent lookup in address payable[] storage ref

I am having the above error at the point where I am pushing the newly created contract address into the contracts[] array. Where am I going wrong? Any help will be appreciated. pragma solidity ^0.8.0;...
Silicon Lion's user avatar
1 vote
0 answers
195 views

Remix: Test Failed and the Message is " Transaction is reverted"

I am sending ETher from the test contract and then checking the balance but I am getting the message, Test Failed and Transaction is reverted. My contracts are: //pragma solidity >=0.4.22 <0.9.0;...
zak100's user avatar
  • 1,406
0 votes
0 answers
226 views

Contract Deployment on Remix in JavaScript VM pending indefinitely

https://youtu.be/M576WGiDBdQ?t=6082 I'm writing code along with this YT tutorial to learn Solidity with Remix. I cannot deploy the contract, it shows "creation of SimpleStorage pending..." ...
PhilosophOtter's user avatar
0 votes
2 answers
175 views

Whats needed to complete my contract token for this BEP20?

I'm trying to figure out if the 80% of the total supply is allocated to the network? and if there are any fundamental things I am missing here? // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; ...
tay's user avatar
  • 1
0 votes
1 answer
605 views

My remix.eth page does not connect with my metamask account

When I choose the "injected web3" environment metamask does not automatically pop-up,thus I have to manually connect my metamask account with the remix.eth web page.However when I do this ...
simon gonzalez's user avatar
0 votes
0 answers
29 views

why does any contract i write to the blockchain look like this

ive tried about 40 different contracts and they all do not show as a token, ive tried bsc,bsctestnet, pulsechain testnet. when i try to verify the code on bscscan it says the byte code doesnt match it ...
ryan olsen's user avatar
1 vote
0 answers
2k views

How to send the ERC721 NFT token of existing smart contract to another wallet using my smart contract

I have some ERC721 NFTs in my wallet minted in A smart contract. I want to transfer that NFTs to another wallet using my smart contract. But I am getting error like: "ERC721: approve caller is ...
Abe Yusei's user avatar
0 votes
1 answer
144 views

I can't compile, on my library SafeMath it says "parsererror: function, vairable, struct or modifier declaration expected, please help me

pragma solidity ^0.8.2; contract Token { mapping(address => uint) public balances; mapping(address => mapping(address => uint)) public allowance; uint public totalSupply = ...
pascal's user avatar
  • 1
1 vote
1 answer
3k views

How to call a fallback function in remix

I have the below code in remix. I remember the remix had the "fallback" button to check the fallback method. I am back after long time. I do not find the "fallback" button. I ...
iappmaker's user avatar
  • 813
1 vote
0 answers
409 views

Gas estimation failed in remix with MATIC or BSC (ETH testnet works)

I'm facing a very annoying error but I'm unable to find an answer for it. Case: Using Metamask, having accounts in eth Popsten with ETH coins, bsc and matic with coins I'm using just a simple ...
Álvaro J. Martín López's user avatar
1 vote
1 answer
268 views

Unit test on remix keeps throwing typeError

I am trying to write a unit test for my token contract whose constructor takes 6 arguments. I have written the test but each time I try to test any function on the token contract it throws TypeError ...
David's user avatar
  • 15
0 votes
2 answers
2k views

Solidity Smart Contract - Split and Send Contract ETH Balance Between Two Accounts

Want to start off by saying thanks in advance. I'm very new to solidity, so really appreciate your time. I've built a basic smart contract for testing purposes, and I'm running it on Remix. I want to ...
sandyk47's user avatar
1 vote
2 answers
113 views

Remix says that I got undeclared variable in my test contract when trying to run it, when it is declared in the original contract. How to fix?

Basically I need to get the hash from the function in the original contract, and for that the function makeBet() requires some input. The function looks like this: pragma solidity >=0.8.0 <0.9.0;...
Teo's user avatar
  • 53
4 votes
3 answers
4k views

How to properly write Solidity unit tests?

I would like to write maintainable and readable unit tests for my code. Requirements: Test different actors. E.g. a bank contract and three customers interacting with it. Test for errors. E.g. test ...
user3669782's user avatar
1 vote
0 answers
68 views

Remix Unit Testing: Fail message is giving wrong name of the test file

I am trying to do unit testing using Remix using the tutorial at Simple Contract at Medium, but it is giving me a FAIL message with “browser/tests/4_Ballot_test.sol) file highlighted with blue ...
zak100's user avatar
  • 1,406
1 vote
1 answer
401 views

The called function should be payable if you send value and the value you send should be less than your current balance. WITH NON-Payable functions

I have the following functions function balance() public view returns(uint152) { return uint152(IERC20(token).balanceOf(address(this))); } function balance1() public view returns(...
Hakob Arshakyan's user avatar
1 vote
0 answers
364 views

Empty msg.sender in contract function when called from Remix testing

I have a very simple contract function (bogusFunc) that makes use of the implicit msg.sender: function bogusFunc(uint256 _val) public { // use _val for something user_list.push(msg.sender); } ...
Neurus's user avatar
  • 163