Questions tagged [solidity]

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

Filter by
Sorted by
Tagged with
0 votes
0 answers
2 views

Im trying to build a cryptocurrency(USD tether just like USD) that works with ethereum and polygon,

I happen to be relatively new to block chain, have an understanding of PoW and PoS, I'm learning Solidity at the moment, I'm supposed to design thi cryptocurrency that is compatible with ethereum and ...
0 votes
3 answers
435 views

What is the contract address of a deployed token?

A bit new to ETH development. I am trying to create a contract that helps me receive tokens of a particular address on the ETH network. For testing purposes, I am creating my own Token on the testnet ...
0 votes
1 answer
383 views

Gnosis-safe - Get all owners of Gnosis-safe

I have created a Gnosis-safe. In general I wonder, how I can interact contractually (using web3) with the Gnosis-safe contract. The Gnosis-safe address links to a proxy contract. My question is how I ...
1 vote
1 answer
1k views

How to add NFT Royalties Feature to a marketplace

I'm currently working on an NFT marketplace, and I would like for creators to be able to add a certain percentage as royalties for future sales like rarible does. So what I wanna know is do I add this ...
1 vote
1 answer
576 views

Honeypot - Cannot Approve - Frontrunners still can though

I fell for a scam where the approve function is dodgy (you can approve as many times as you like but can never swap) The interesting thing is frontrunners are the only other accounts besides the devs ...
0 votes
1 answer
8 views

Foundry console.log and emit logs not working!

Running forge test -vv does not show the logs, but only test passed. Only forge test -vvvv `shows the traces, which shows the logs. pragma solidity 0.8.20; contract Testing is Test { function ...
0 votes
1 answer
9 views

Calling Uniswap Multihop Function returns Error

Deployed on Polygon Mumbai. Code compiles fine on REMIX and is meant to perform multihop swaps on Polygon Mumbai, but it returns error after function is called. Deployed Contract always funded with ...
1 vote
1 answer
402 views

What's the difference between transact and buildTransaction?

I noticed that there are two options to create a transaction / call a state-changing function. In the first one we receive the transaction hash (tx_hash) by building the transaction, signing the ...
2 votes
1 answer
345 views

How can I execute transferFrom function in node js

There is solidity erc865 code function transferFromPreSigned( bytes _signature, address _from, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public ...
0 votes
0 answers
4 views

Not able to fetch correct APY in aave mumbai

I am following this doc - APY and APR - Developers to fetch lending and borrowing rates in mumbai for usdc but they doesn’t seem to be correct and are different from aave staging UI, how can I solve ...
0 votes
1 answer
13 views

Solidity - Function Selector Loading onto the stack: why DIV instead of SHR?

I'm currently learning about how the function selector is loaded from calldata. The algorithm is like so: PUSH4 ffffffff PUSH29 0100000000000000000000000000000000000000000000000000000000000000 PUSH1 ...
0 votes
2 answers
319 views

When To Prompt for Signing Message?

What is the usecase for a user signing a message? For example, I see in many login tutorials, that once we get the wallet address from Metamask, we have to have the user sign a message with a provided ...
0 votes
1 answer
2k views

Using "hardhat deploy" plugin, and it is not getting the deployed contracts

I'm using the hardhat-deploy plugin to deploy the contracts, the plugin successfully deployed the two contracts but, not performing the same this time, what I've done is... import { ...
0 votes
1 answer
2k views

Transactions on BscScan don't add up

I'm creating a web application for which I want to log transactions specific to a single wallet and a single token on the BSC network. I would like to do this programmatically by using the bscScan API....
23 votes
12 answers
30k views

The reason for "Could not find artifacts for" in truffle?

Any ideas about the reason for the following error from truffle? The contract is from the solidity docs. Truffle.js - //var Set = artifacts.require("./Set"); var Consumer = artifacts.require("./...
3 votes
3 answers
1k views

hardhat-shorthand is not working

I installed hardhat-shorthand using the yarn package manager. However, running hh <code> throws the following error: hh: command not found hardhat I'm using the following code for installing ...
0 votes
2 answers
464 views

How to solve Unhandled Rejection (Error): invalid address error with web3 js

Whenever I run the code I get an error saying "Unhandled Rejection (Error): invalid address (argument="address", value=["0xF628D397c2C1c4cB485BDF5441ac723B229f4F8f"], code=...
1 vote
1 answer
519 views

Uncaught error: VM Exception while processing transaction:out of gas

pragma solidity^0.4.18; contract project3{ address owner; struct Users{ string companyName; string role; string country; string city; uint phoneNo; string physicalAddress;} constructor (uint ...
0 votes
1 answer
647 views

Which method do "Buy"/"Sell" functions from UniSwap calls in smart contract?

I am trying to create a smartcontract but I am unable to understand which method will be used when someone tries to buy/sell from any swap platform. I've checked transfer and transferFrom but from the ...
1 vote
1 answer
23 views

How can a bytes32[] variable have a custom method (i.e., verifyCalldata)?

Code: https://www.contractreader.io/contract/mainnet/0x0C7D4bdA40CF78F9F1BAf6e3D5774f1E22c9CC4B My question is about this verifyCalldata() call: function verifyAddress( uint256 _projectId, ...
0 votes
1 answer
1k views

Uncaught TypeError: Cannot read properties of undefined (reading 'getInfo') at index2.js:20:20

i am going to call a smart contract method in web.js ( i am using legacy web.js) my solidity code as follow : pragma solidity 0.5.4; contract Register { string private info; function setInfo(...
0 votes
1 answer
411 views

How to fix Note: The called function should be payable if you send value and the value you send should be less than your current balance

I want to transfer per second of given time but I got Error: Note: The called function should be payable if you send value and the value you send should be less than your current balance. pragma ...
0 votes
1 answer
1k views

ParserError: Source file requires different compiler version

I am a beginner working on brownie using vscode related to a lottery smart contract. Please don't mind if I am doing any rookie mistakes I am still trying my best to understand it as much as I can :) ...
0 votes
0 answers
13 views

Adding Uniswap interface to a ERC20 token smart contract

I just started learning Solidity, as browse through various smart contracts for tokens listen on Uniswap, I notice that most of them use IUniswapV2Factory and IUniswapV2Router02 and a small amount don'...
1 vote
3 answers
2k views

Provider error hardhat

When i want to deploy my contract with this command: npx hardhat run --network goerli scripts/deploy.js I get this error: ProviderError: HttpProviderError at HttpProvider.request (/Users/alirezamac/...
0 votes
0 answers
7 views

Cannot import correctly uniswap's permit2

Hello i am trying to import the permit2 following the official uniswap's guide but i cannot manage to import it correctly since it lacks of the structs and more things even if i don't get any error ...
0 votes
1 answer
534 views

Identifier already declared

event transfer(address indexed from, address indexed to, uint value); event Approval (address indexed owner, address indexed spender, uint value); constructor(){ balances[msg....
0 votes
0 answers
6 views

The function runs external, but not internal

mapping(string => mapping(uint256 => Order[])) buyOrders; mapping(string => mapping(uint256 => Order[])) sellOrders; function placeBuyOrder(string memory stockName, uint256 price, uint32 ...
1 vote
1 answer
768 views

Undeclared Identifier in Solidity

I've just started learning solidity and I tried to make a contract in which you are able to add names to Santa's naughty or nice list, and I want to be able to enter a name and I want the output to be ...
0 votes
1 answer
101 views

Custom V3 router (Is it a Universal router)

I came accross a concept i have no idea about. The concept of custom router. As per my research may be Uniswap V3 is offering Universal router. Is it possible to deploy instance of universal router as ...
21 votes
6 answers
19k views

Computing the Uniswap V3 pair price from Q64.96 number

I am trying to compute a Uniswap V3 pool token price in Solidity. I can get the square root price of Q64.96 number as uint160 (e.g., 1234217676608908277512433764 - value of DAI/ETH pool (price at that ...
0 votes
1 answer
333 views

nonReentrant modifier on mint method

Is _safeMint() of ERC721 safe from re-entrancy attack? Is nonReentrant modifier should be used with safeMint()
0 votes
0 answers
4 views

USdt ERC20 1006

I am confused about this "Usdt erc20 1006" . In a website for withdrawal it is written "your Usdt Erc20 1006".. This is certainly address but which type of address is this.
3 votes
1 answer
1k views

Error Ganache: Run out of gas - Works in Remix/Not from dApp

I am working on an application that stores and retrieves personal data on/from the ethereum blockchain. Just working on this to improve my Solidity and SC expertise and get comfortable with the ...
0 votes
1 answer
859 views

How to call a payable function with multiple parameters using web3 in Truffle Console

Here's my contract code: pragma solidity 0.8.9; contract hodl { event printNum(uint num); event printValue(uint val); function deposit(uint number) payable public { emit printNum(number); ...
1 vote
2 answers
3k views

How do I execute the withdraw function to withdraw token from smart contract?

Total newbie here. So I deployed a contract and already did the flash loan, but now I want to withdraw the remaining funds that I deposited into the smart contract (for the premium fee). How do I ...
0 votes
0 answers
10 views

ERC20 Multisend works on Sepolia Testnet but Fails on Mainnet

I've got a smart contract function that takes an erc20 contract address, an array of addresses and an array of amounts and then sends the each amount to each address of the specified token. I've got ...
1 vote
1 answer
401 views

mstore8 assembly instruction makes call goes out of gas

My solidity code example: // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.2; library TestLibrary { function sz_varint(uint256 i) internal pure returns (uint256) { uint256 ...
2 votes
2 answers
479 views

Writing a file and linking to blockchain

I've found parts of a smart contract and I have an idea how to add things but I'm currently stuck. Maybe you can help me with that. The contract looks as following: pragma solidity 0.4.15; contract ...
0 votes
1 answer
2k views

"UPDATED : " "VM Exception while processing transaction: revert"

I tested signature verification of the code presented HERE as follows: running testRPC : root@ubuntu:/home/s# testrpc EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2) Available Accounts =============...
0 votes
0 answers
7 views

Redeploy safe with same address on OP

I deployed the Safe on Ethereum using this factory: 0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2. Now, I'd like to deploy the same Safe address on Optimism. Could you please provide guidance on the ...
0 votes
2 answers
1k views

SyntaxError: Unexpected token o in JSON at position 1

Hi I am trying to deploy a contract but keep getting this error. I am new to solidity. I am running the cmd node deploy.js error message const interface = JSON.parse(compile).contracts["lottery....
1 vote
2 answers
638 views

Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable; error in line 4

pragma solidity >= 0.7.0 < 0.9.0; library search { function findIt(uint [] storage numb, uint value) public view returns(uint){ for (uint i = 0; i < numb.length; i++) if (numb[1] == ...
2 votes
1 answer
68 views
+50

abi-decoder's decodeMethod returns undefined

I am trying to decode the input field of this transaction as below, const decodedInput = abiDecoder.decodeMethod(transaction.input); but decodedInput returns undefined despite the my ABI having the ...
0 votes
1 answer
256 views

selfestruct() in soldity

Hey I'm trying to use selfdestruct in solidity but I'm getting this error when I'm trying to run selfdestruct(address*) : TypeError: Invalid type for argument in function call. Invalid implicit ...
0 votes
0 answers
13 views

Brownie Request for Random number (Mock VRF) reverts

Using chainlink tutorial and concept for testing a random request locally, Request Randomness fails to execute in brownie for VRFCoordinatorV2Mock, however, I tested the same code in remix IDE and it ...
0 votes
1 answer
25 views

Rebasing tokenomics

I have the following variables where all values are multiplied by 1e18 to represent fixed-point numbers on the EVM: uint totalShares = 100; uint sharesAlice = 20; uint sharesBob = 30; uint ...
0 votes
1 answer
9 views

Reliably disassamble bytecode to opcodes across various evm versions

Is there a reliable way of disassembling bytecode into opcodes across different EVM versions, to make it agnostic to the EVM version used during compilation? As the second best option - is there a ...
0 votes
1 answer
497 views

Import wants >=0.6.0 but the import of the import is ^0.5.0

that solidity compiling is a mess :frowning: I’m trying hours to find out why my contracts sometime compile and sometimes not … Now I got it … I'm using a local ganache server and the online IDE remix....
1 vote
1 answer
716 views

How can i `ecrecover` in solidity to verify the digest produced by `web3.utils.soliditySha3` in JS side?

Javascript side: id = 128 uri = "xxx://xxx" hash = web3.utils.soliditySha3(id,uri) sign = web3.eth.accounts.sign(hash1, privateKey) Solidity side: function(uint256 id, string memory uri,bytes v, ...

1
2 3 4 5
349