Questions tagged [solidity]

Solidity is a language for smart contracts for blockchain technologies like Ethereum. It is designed to compile code for the Ethereum Virtual Machine. Use this tag for questions about programming smart contracts using the Solidity language.

Solidity is an object-oriented language whose syntax is similar to that of ECMAScript, but with static typing, and it is designed to compile to code for the Ethereum Virtual Machine for use in smart contracts in blockchain technologies.

6642 questions
1
vote
0 answers

Remix-deployed contract throws the error "We were not able to estimate gas. There might be an error in the contract and this transaction may fail"

I deployed smart contract using the remix online IDE, Whenever I want to perform any of the functions parameters, using etherscan UI interface on the Goerli Network I get the error: We were not able to estimate gas. There might be an error in the…
1
vote
1 answer

Lottery Unit test (""before each" hook for "can only be called after performUpKeep"')

I am getting this error while running the tests on my Lottery (raffle) from freeCodeCamp 32 hour course. Yesterday I was able to run each and every test. Then I pushed the code to GitHub and now I am unable to run any test. The error is as…
Sagar Gund
  • 11
  • 1
1
vote
1 answer

Solidity percentage calculation with variables vs literals gives different answers

contract test { function calculatePrice(uint a, uint b) public pure returns (uint) { return (a * (b / 100)); } function calculatePrice2() public pure returns (uint) { return (80 * (60 / 100)); } } So, the above…
Sam
  • 55
  • 6
1
vote
1 answer

" Error: (Awaiting internal transactions for reason)" when interact with Disperse contract

Disperse contract: https://testnet.bscscan.com/address/0xcfa93bc0033049b2e9f6821e102c5f88f2c92301#code My transaction on blockchain: https://testnet.bscscan.com/tx/0xce413bf421becf8fed400cbd41baf725424ff5599abd9f0c268fd4cc100bf37c Here is my…
Huynh Son
  • 33
  • 6
1
vote
0 answers

Run Mythril tool on a Hardhat Project?

How to run the Mythril tool for analysis on smart contracts compiled by Hardhat? Hardhat project has the contract(.sol) and artifacts(.json) files . Mythril when run with a (.sol) contract uses solc-compiler to compile the contract, whereas…
1
vote
1 answer

Why transaction cost and execution cost are same in Remix IDE all the time?

I'm recently started to learn how to developing smart contract using solidity in Remix IDE. I'm using Remix VM (London) environment. My question is, how can transaction costs and execution costs be the same in all transactions? I know that…
user20319391
1
vote
2 answers

Run Mythril tool using hardhat on contracts?

Mythril fails to import remotely and all-time searches in the local file system - to solve this I used Hardhat to compile my contract - and hardhat compiled contract. Now I am stuck on How to run Mythril on the contract using Hardhat to compile…
1
vote
2 answers

Why would create2 revert?

I'm debugging a reverted transaction on Polygon and this is all the information I have: https://mumbai.polygonscan.com/tx/0xfa86dc4957e3a3da9298b7672b11a20ebe921854fa494dc073920c067c1e693f#internal If I'm reading it correctly, it seems to be saying…
Derek Chiang
  • 3,330
  • 6
  • 27
  • 34
1
vote
1 answer

Failed to compile Module not found: Can't resolve 'react-dom/unstable-native-dependencies'

I'm trying to run this web app from https://github.com/CleverProgrammers/tinder-blockchain-youtube but I'm getting the following error: Image with the error ./node_modules/react-panresponder-web/dist/panresponder.js:7:0 Module not found: Can't…
Ian Black
  • 11
  • 3
1
vote
2 answers

Composition in solidity using sol2uml

I have the following code snippet: contract Bar{ } contract Foo { Bar bar = new Bar(); } When I am generating the class diagram from sol2uml I get the following diagram: I want to have a composition relation between Foo and Bar class. I…
Maliha
  • 45
  • 1
  • 5
1
vote
1 answer

How to return a value from a Solidity function when using Wagmi useContractWrite

I want to get the value being returned in a Solidity function while using Wagmi's useContractWrite. Example Solidity contract: pragma solidity >=0.8.7; contract Counter { uint256 count = 0; function counter(uint256 number) external…
mattblack
  • 1,370
  • 3
  • 13
  • 19
1
vote
2 answers

How to get funID?

need help to get the correct funcID. I've Tried many ways. Will be glad to get your help. Thanks! slugSha256() { slug=$(echo -n "$1" | sha256sum | cut -d' ' -f1) echo -n $((16#"${slug:0:8}")) } functionHash() { hash=$(slugSha256 "$(echo -n…
1
vote
0 answers

When sending some custom ERC-20 tokens to the other accounts, is the other accounts received fewer tokens?

When sending some custom ERC-20 tokens to the other accounts, is the other accounts received fewer tokens? I send my custom ERC20 tokens to the other account on solidity 0.15 the custom tokens. (150000000000000000 Wei) However, The other account…
1
vote
1 answer

Unhandled Exception: type 'Null' is not a subtype of type 'int' in type cast error when trying to call function with no int

Hello I was calling a startelection function from my flutter app on a button click and I got this error the startelection function connects my flutter app with my solidity smart contract and starts the election through infura I don't know why I am…
Abhiram
  • 145
  • 1
  • 1
  • 13
1
vote
0 answers

Is there an event listener that calls a Solidity function upon accessing a QR code?

I'm currently working on a project where I want someone to be able to scan a QR code from their metamask and have that URL endpoint call a solidity smart contract function they can accept after it loads them in. I'm currently using the react package…