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
1 answer

Error HH604: Error running JSON-RPC server: Unknown transaction type 106

I try to fork mainnet by running yarn hardhat node and I get that error. Error HH604: Error running JSON-RPC server: Unknown transaction type 106 My hardhat.config.js file has forking…
Sergen
  • 11
  • 2
1
vote
1 answer

Solidity Error: We were not able to estimate gas. There might be an error in the contract and this transaction may fail

I have dapp web app with smart contract deployed on rinkeby testnet. In my dapp website, I have token swap and stake function. Link: https://doxa-staking.netlify.app When I swap my ether for my token it works fine. Now on the dapp stake function,…
1
vote
1 answer

How do I send data to Smart Contract via Ethers?

I am able to deposit amount of Ether into my smart contract via the depositFunds function like below: async function depositFunds() { console.log(`Depositing Funds...`); if (typeof window.ethereum !== "undefined") { const provider = new…
brandon
  • 23
  • 3
1
vote
0 answers

When using require statements in my Smart Contract MM doesnt show the require error

I have the following function within my smart contract function setRewardTokenForShareholder(address RWRD) external { require(customRewardsAllowed, "Contract: setRewardTokenForShareholder:: Custom Rewards arent allowed"); //…
Andy
  • 679
  • 2
  • 10
  • 25
1
vote
1 answer

RPC Error: excution reverted" when calling smart contract from next.js

I've looked at similar answers regarding this error, and it seems like the majority of them have to do with using the wrong contract address or the abi. In my case, I do not think this is likely because I am using file saver to update contract…
user19438046
1
vote
1 answer

how to send a transaction with encoded data from within a solidity smart contract

I want to send a transaction from my solidity smart contract to another smart contract, and all the actions are already encoded Ex(0x7a1eb1b9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a …
Zyz
  • 13
  • 3
1
vote
1 answer

How come there is "Integer Overflow and Underflow" in string variables in smart contracts?

I was analyzing a contract in Oyente. The contract is : pragma solidity ^0.4.21; contract Test{ address admin; function Test() public{ admin = msg.sender; } string str = ""; function setStr(string _str) public{ …
MHS
  • 25
  • 1
  • 6
1
vote
2 answers

How to test a solidity payable function with hardhat

I have the following smart contract function: function safeMint(address to, uint256 tokenId) public onlyOwner payable { require(msg.value >= mintPrice, "Not enough ETH to purchase NFT; check price!"); _safeMint(to, tokenId); } and the…
Maliha
  • 13
  • 2
1
vote
2 answers

Optimiser settings in truffle config is not working while migrating open-zeppelin proxy using deployProxy

I have added the compiler options in truffle-config.js - compilers: { solc: { version: "0.8.16", settings: { optimizer: { enabled: false, runs: 200 } } } } I am deploying an upgradable…
1
vote
2 answers

Solidity compile error. (Contract should be marked as abstract.)

I have two questions. 1) I am getting the following error: TypeError: Contract "MyToken" should be marked as abstract. --> contracts/MyToken.sol:8:1: According to my understanding, contract should be abstract when there is a unimplemented…
DeFi
  • 77
  • 1
  • 8
1
vote
0 answers

fulfillRandomWords callback is not getting executed after calling fulfillRandomWords on the VRF v2 contract

I am following this tutorial and I am doing the exact same in terms of deployment, subscription funding, and unit testing. But the problem is in the last unit test, when I call fulfillRandomWords on the vrfCoordinatorV2Mock contract, I expect it to…
Anas Latique
  • 357
  • 5
  • 13
1
vote
1 answer

Solidity compiler error loading specific function

Well, here we are once again.. It seems like there is literally NO docs for the usage of the Solidity compiler in Node.js.. Here is my question. Context : I want to load a specific version of the Solidity compiler in my Node.js program. In order to…
1
vote
1 answer

how to make onRecivedERC20 function?

I would like to make a function for receiving ERC20 in contract and after receiving ERC20 token it should transfer that ERC20 to another wallet. the flow should be if a user uses that function first it should send that ERC20 to the contract and…
1
vote
2 answers

Issue installing solc npm

When I try to install solc (npm install solc or npm install -g solc) I actually can install it BUT when looking for it (through the command which solc) nothing shows up. Another strange thing: when looking for solcjs (through the command which solc)…
JoshuaDev
  • 53
  • 4
1
vote
1 answer

How to write custom errors and return messages with error keyword Solidity

I tried to make a custom error but it doesn't return a message to revert How could I make it return a message? /// custom error error MyCustomError(address _address); if user { revert MyCustomError({address: msg.sender}) } I got this error Runtime…
1 2 3
99
100