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

Identifier not found or not unique. using SafeMath for uint

I keep getting this error when I try to run my contract on truffle....(Identifier not found or not unique. Using SafeMath for uint). Truffle v5.1.39 (core: 5.1.39) Node v14.19.0 Below is the contract ...
Edward Ilemba's user avatar
0 votes
2 answers
38 views

Deploying contracts at same address

// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /* Let's say Alice can see the code of Foo and Bar but not Mal. It is obvious to Alice that Foo.callBar() executes the code inside Bar.log(). ...
kumar's user avatar
  • 41
0 votes
1 answer
37 views

How to Download dependencies when auditing a hardhat project?

I just attempted to audit smart contracts that were tested using the Hardhat framework. In Foundry, after cloning the repository, I know that I can install all the necessary dependencies by simply ...
kumar's user avatar
  • 41
2 votes
1 answer
53 views

Possible way to hack Solidity into executing a function directly from a struct as a method? (v0.8.20)

pragma solidity 0.8.20; contract SolidityLimitTest { mapping (address => Hack) private Hackable; struct Hack { uint amount; function(uint) returns (uint) ten_x; } ...
Ashraile's user avatar
2 votes
1 answer
194 views

Failed to parse as type `uint256`: a character is not in the range 0-9

I am following Patrick Collins Smart Contract Lottery development and trying to run the deploy script test net ( sepolia ) but I am getting this error Error: Failed to parse as type `uint256`: a ...
Iftikhar uddin's user avatar
1 vote
0 answers
38 views

Creating a sufficiently random number via computation entropy without an oracle

I am creating a token that requires a sufficiently random number for an internal lottery. uint randomX; function semirandomize(uint prevRandom, uint time) private view returns (uint) { ...
Ashraile's user avatar
0 votes
0 answers
21 views

How to find a local variable declaration in an AST object

How can I find the exact location of where a local variable was declared from an AST object? I am using solidity-parser-antlr to visit AST nodes. Lets say this is a sample Solidity code that we have: ...
Salman Fazal's user avatar
1 vote
2 answers
57 views

Is it possible to deploy a smart contract using multi-sig? i.e. contract will deploy only when multiple parties approve the tx?

Is it possible to deploy smart contract using multi sig fetaure?
user124711's user avatar
0 votes
1 answer
19 views

How much would be too much data to save in a public mapping?

So I know that in solidity for larger data we wouldn't use contract to save the data but rather we'd use some kind of external database. But I'm not sure how large is too large and what would happen ...
The matador's user avatar
0 votes
1 answer
26 views

What is the best gas efficient way to reset all values for keys in a mapping?

As far as I understand there is no way to automatically reset all values of a mapping to default in solidity. now lets say I have a mapping mapping with 7 keys and values set. to refresh all the ...
The matador's user avatar
0 votes
0 answers
17 views

trying to perform a batch transaction for finally obtaining the smart account address

well i was trying to batch three deploy transactions into one, by creating another smart contract for it. note: these contracts are deployed for creating smart account wallet (aa) and for calling the ...
Gautham Krishhna's user avatar
0 votes
1 answer
52 views

Problem with testing mappings and structs in foundry

Hey everyone I'm using foundry for solidity development and I have some issues with using mappings and structs in my tests. here are my problems: Problem 1 the problem : the function below lets users ...
emtothed's user avatar
0 votes
1 answer
38 views

Unable to deploy the smart contract from my terminal using hardhat

I've created one contract and trying to deploy it locally to test it. But it's not deploying. It throws this error, This is the code in scripts/deploy.js file, async function main() { const ...
Santhosh's user avatar
0 votes
0 answers
7 views

NFT based webapp - Best architecture approach to render data to the front more agile

I am building a book marketplace where each different book launch a limited series of N copies. Therefore for each book I create an ERC-721 contract with a totalSupply = N. In each ERC-721 contract I ...
gilvictor's user avatar
0 votes
0 answers
8 views

Market Cap: $Infinity

What can cause this to happen on poocoin?, Market Cap: $Infinity I have been trying to deploy an erc20 token and the deployment was successful but on poocoin, after adding liquiduty, it shows Market ...
KeNs's user avatar
  • 1
0 votes
1 answer
41 views

What is the correlation between "Hash" (Method ID) & "Name"

I was checking Etherscan and come across a deployed contract (Create contract), but the method id was 0x60a06040. I then used https://openchain.xyz/signatures?query=0x60a06040 and found out that the ...
anon's user avatar
  • 25
0 votes
0 answers
31 views

Solidity query works in dev environment but not in production build (nextJS)

I am calling a function that queries the token balance of a user. The query works on a dev environment but not in production build. I am using metamask and ethers to interact with my contract on the ...
Ciirno's user avatar
  • 11
0 votes
1 answer
71 views

Has the way to access public member variables in solidity through deployed contracts changed?

I have a public contract member defined like this, which is later assigned a value in the constructor AggregatorV3Interface public priceFeed; I want to access this variable's value and I am trying ...
Pankaj Sehrawat's user avatar
0 votes
0 answers
22 views

Missing transaction details in MetaMask (only showing gas fees) dApp testing

I'm building a presale dApp as an experiment, and when I hit the buyButton, MetaMask successfully opens for me to approve spending my USDT (labelled a contract interaction). However the transaction is ...
HAT0ken's user avatar
0 votes
2 answers
30 views

Can we override the private variable in base contract?

Background: I'm using an opezeppellin Erc20 contract. but i want to use it for minimal proxy pattern(eip-1167). so for that reason i cannot use constructor and have to use the initialize method. Now I'...
Saad Suri's user avatar
0 votes
1 answer
50 views

Cannot recover signer

I am facing a problem where recoveredAddress is not restored correctly. We assume that the address of the owner who originally deployed the smart contract is returned. Am I making some big mistake? ...
tgf8faf's user avatar
0 votes
1 answer
22 views

Use offchain date time

in my contract, I need to do something based on time, and this is quite sensitive, and as we know, you cannot rely on the block.timestamp because it can be changed, I want to know if there is a way ...
Mehran Ra's user avatar
  • 481
1 vote
0 answers
30 views

How to get transaction fees and minus it from balance

I created an auction exchange smart contract using solidity programming language and I am using ganache for testing this is a test file written in JavaScript. seller is the creator of auction and ...
Huzaifa Ahmed's user avatar
0 votes
1 answer
87 views

How to use anvil accounts in the Foundry Test

How can i use anvil accounts into the foundry tests? Like in hardhat node i can getNamedAccounts() but how can I use the anvil accounts into my forge Tests?
Saad Suri's user avatar
1 vote
2 answers
170 views

Remove the element from array where order matters?

I am presenting my use case here. Let's think of a dating app where each candidate enters their preferences and we store their data and add them to an array. when someone enters that matches with any ...
Rashid Ul Haq's user avatar
0 votes
1 answer
15 views

How to import external files?

I'm trying to create a fund function that allows users to fund their wallet after signing. I had my contract address & ABI stored in an external file and tried to export and import, but that didn'...
SABER's user avatar
  • 1
0 votes
1 answer
16 views

How can I verify & publish source code on bscscan?

Can someone please help me verify & publish the source code for this token? I keep getting error message saying invalid constructor arguments (please make sure they are in ABI encoded format). ...
Toya Brown's user avatar
1 vote
2 answers
59 views

How can I fix a problem with transferring ERC721 by approved contract?

Hey everyone I'm new to NFT development and developing an ERC721 token for property ownership and marketplace. I implemented two functions to enable a user to put their token on sale for another user ...
emtothed's user avatar
0 votes
1 answer
26 views

How do you use the Diamond Pattern for escrow upgrades?

I am creating a contract with the diamond pattern so I can evolve and add new features to my contract. Contract facets: Contract A: an ERC721 that takes care of minting its own NFTs Contract B: ...
Piyush Chittara's user avatar
0 votes
0 answers
12 views

Why or where should one use Twos Compliment in Solidity?

I was reading through Solidity Docs and came across Bit Operations section https://docs.soliditylang.org/en/v0.8.21/types.html#bit-operations Couldn't figure out why one would use this. However, I do ...
Ishan's user avatar
  • 51
0 votes
1 answer
10 views

Do you have to explicitly state in the body of a function that it should return something?

I'm looking at the following function which is supposed to return (uint8 id, uint8 nextId). I see that in the body of the function, the return statement is within an "else" statement - see ...
auditor_chick's user avatar
0 votes
1 answer
38 views

ERC721 token image not showing in wallet

Hey everyone I'm new to NFT development. I developed an ERC-721 token used for property ownership and I deployed and minted a token both on Anvil and sepolia. I can import the token on metamask but ...
emtothed's user avatar
1 vote
1 answer
41 views

how come loading the funcSig from data isn't enough, you have to shift it also to use it in the rest of the code/function

basically we have this function function FlaggedMethods( bytes memory data ) public returns (address) { bytes4 funcSig; assembly { // Shift right by 224 bits ...
owl's user avatar
  • 13
0 votes
1 answer
26 views

Instantiation of Solidity Interfaces

There is an interface called IiZiSwapFactory (source), which declares a method named swapX2YModule() (source). IiZiSwapFactory.sol interface IiZiSwapFactory { /// @notice emit when successfuly ...
Jim's user avatar
  • 103
0 votes
0 answers
36 views

approve spender to swap

i'm trying to swap using 1inch aggregator api and when i try to swap, it says "Not enough allowance. Amount: 4600000000000000. Allowance: 0. Spender: 0x1111111254eeb25477b68fb85ed929f73a960582&...
Biruk Damte's user avatar
0 votes
1 answer
13 views

Creating a local variable in an if statement?

I'm looking at a function that creates a local variable in an if statement. If someone called that function and the condition to the if statement was not triggered, that local variable wouldn't exist, ...
auditor_chick's user avatar
0 votes
2 answers
16 views

Explain this constructor inheritance solidity

Is BranchBridgeAgentFactory the parent contract? Will there be two different address? Or just one? pragma solidity ^0.8.0; contract TestBranchBridgeAgentFactory is BranchBridgeAgentFactory { /*////...
anonauditor's user avatar
0 votes
1 answer
76 views

NFT metadata for property ownership ERC721 token

Hey everyone I'm new to NFT development and I'm trying to develop a simple property ownership and marketplace using the ERC721 token standard. since I'm so unfamiliar with json I have some problems ...
emtothed's user avatar
0 votes
2 answers
61 views

provide steps to deploy this contract from solidity by example

When i tried deploying this contract using 10 ethers, and then providing : claimPayment() -> amount - 9000000000000000000 i.e 9 ethers -> nonce - 123 -> signature - ...
ImBatman's user avatar
1 vote
0 answers
15 views

Is there any way to read block attestation from inside a solidity smart contract?

Are there any precompiles, or any other native ways to get block attestation data from ETH2 POS inside a solidity contract?
Bruce's user avatar
  • 927
1 vote
1 answer
79 views

How do I hide or mask the sending address when sending tokens or eth

I am trying to build a crypto payment gateway. But when users initiate a withdrawal to credit their customers, the transaction can be tracked up to the point that shows the system address where the ...
Starbody's user avatar
0 votes
2 answers
33 views

Failing deposit transaction

The following deposit transaction on Mumbai test net is failing as opposed to this transaction on Polygon main net which had succeeded years ago. There are no fundamental differences from code or ...
Pulsares's user avatar
0 votes
1 answer
24 views

How to extract the custom reverted message inside the transaction object when we're using solidity error keyword?

// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; error Unauthorized(); contract VendingMachine { address payable owner = payable(msg.sender); function withdraw() public { ...
0xbeny's user avatar
  • 193
0 votes
2 answers
84 views

eth_call vs eth_sendTransaction

During my development process, I've spotted differences between calling function in my contract from script and from dApp. Whole thing is done on hardhat local network. Script call: eth_call ...
Lidjan's user avatar
  • 11
0 votes
1 answer
40 views

are there other ways to send bundle of transactions without using flashbot?

I am wondering if there are some ways to send bundle of transactions without using flashbot? I am not sure how this area works, would you please give me practical sources to learn ?
DHC's user avatar
  • 313
0 votes
0 answers
19 views

org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not generated after 600 seconds

Yesterday I could deploy the code successfully, but today onwards I am facing the below error. I tried to reduce/increase the gas fees yet the error is still not resolved. If anyone is willing to ...
Selva Kumar's user avatar
0 votes
0 answers
32 views

Sending data to the contract from the react frontend is not working

I've made an twitter contract, where we can send and get tweets from the frontend React. While sending the data to the contract, The metamask popup is opening, But it shows warning like this. I don't ...
Santhosh's user avatar
0 votes
1 answer
60 views

Tick range of negative tick - Uniswap v3

I am looking for a formula to calculate the tick range for a negative tick. Ex1: tick: -15 tickSpacing: 10 range: [-20, -10) Ex2: tick: -20 tickSpacing: 10 range: [-20, -10) I was ...
KunLun's user avatar
  • 197
0 votes
1 answer
21 views

Getting Error in the code ParserError: Function, variable, struct or modifier declaration expected

pragma solidity >= 0.8.2 <0.9.0; contract Types {  // Declaring a dynamic array uint[] data;  uint8 j = 0; function loop() public returns(uint[] memory){ while(j < 5) { j++; data.push(j); } ...
Moody's user avatar
  • 111
0 votes
1 answer
57 views

Signing message using web3 and using ethers gives different result. Why?

I'm encoding a message using ethers' solidityPackedKeccak256() const encodedMessage = ethers.solidityPackedKeccak256( ["address", "uint256", "uint256"], ...
ujjwalvinze's user avatar

1
4 5
6
7 8
349