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
2 answers
61 views

How Can I Identify the Blockchain Where a Smart Contract Is Deployed Using Its Address?

I am trying to identify the specific blockchain where a smart contract has been deployed using its deployment address. However, I am unable to find a clear source or method for doing so. When I looked ...
Faisal Hussain's user avatar
0 votes
0 answers
19 views

How is exchange rate calculated on DEX platforms like uniswap and sushiswap?

I started getting into the crypto scene and I read about liquidity pools but I am not sure how to get exchange rates into my javascript code, I looked for API's and SDK's but couldn't find any for the ...
user125002's user avatar
0 votes
1 answer
50 views

Percentage Calculation in Solidity

I am wondering if my idea is correct. Total shares: 11,000 User A's shares : 10,000 User A's share percentage = User A's share / Total share. = 10,000 / 11,000 ...
DHC's user avatar
  • 199
2 votes
1 answer
36 views

Exchange tokens with different decimal

I'm in the process of developing a smart contract that allows users to purchase tokens. However, I'm encountering an issue with the price calculation: The token I'm selling (let's call it "...
Meldum's user avatar
  • 171
0 votes
0 answers
29 views

removeLiqudityWithPermit: Invalid Signature

So, I am trying to remove liquidity from a pancake v2 pair and I do not understand why this is not working. I am looking at the code, and I've triple checked every value, I don' think I am doing ...
Chev_603's user avatar
  • 157
0 votes
1 answer
17 views

How do I update a campaign without it creating a new campaign?

I'm working on the update campaign feature in a project. First Issue - Prefilling the form fields I want first to prefill the form fields then from there, a user can change what they want. In the /...
kihiuFrank's user avatar
0 votes
1 answer
33 views

Using getter function in require statement is resulting in an error

I am using Remix ide to deploy the contract, Order of deployment is Test1 ===> Test2(address of Test1), Amount send for the function in Test2 contract is 1 Ether I am getting an error while ...
Swastik Majhi's user avatar
0 votes
1 answer
15 views

Restricting External Adapter Access to a Specific Smart Contract: Is it Feasible?

How can I ensure that my external adapter is only accessible by a specific contract? Does the Post express middleware in the external adapter have a header key indicating the calling smart contract? I'...
Jp98's user avatar
  • 11
0 votes
1 answer
17 views

Is it possible transaction A get executed while transaction B is in middle of execution in the same block?

Imagine I have deposit function which can receive funds from user and the amount sent will be updated in state based on balanceBefore and balanceAfter of token in the contract: 1: function deposit(...
mahyar's user avatar
  • 65
1 vote
2 answers
109 views

How to get address of deployed smart contract in hardhat

I have two files, Token.sol and Token.js for Testing:- Token.sol // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; import "hardhat/console.sol"; contract Token{ string ...
Shubham's user avatar
  • 13
0 votes
0 answers
13 views

Debugging tools available to better target the errors reported by the safe app and safe provider?

When trying to make my dapp compatible with a safe app, the safe app raised errors when necessary, but for some it's difficult to locate the error in the code (because there's no reference to code ...
Dump's user avatar
  • 11
1 vote
0 answers
12 views

Code 608 when using a dapp with a safe infrastructure locally (Fuji Testnet)

Context I have a perfectly working dapp I'm trying to adapt to a Safe App. To test the dapp, I have to use a test network (Avalanche Fuji Testnet here), which is not supported by the current Safe web ...
Dump's user avatar
  • 11
1 vote
1 answer
28 views

transactionContract.addtoblockchain is not a function

Calling a specific function from smart contract through react jsx file , console is giving me error "transactionContract.addtoblockchain is not a function", even the function is present in ...
Chinmay Tiwari's user avatar
1 vote
1 answer
71 views

Does Foundry Support Dynamical Library Linking in Solidity?

I would like to deploy a contract that has external library dependencies that need to be dynamically linked. This is typically done in hardhat ethers as follows: const MyLibrary = await ethers....
MShakeG's user avatar
  • 1,074
0 votes
1 answer
26 views

how to deploy factory smart contract

// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; contract Car { string public model; address public carAddr; constructor( string memory _model) { model = _model; ...
Nisarg's user avatar
  • 11
0 votes
1 answer
28 views

Error: VM Exception while processing transaction: reverted with reason string 'Can't buy Coffee for free'

deploy.js -> const hre = require("hardhat"); const { ethers } = require('hardhat'); const { utils } = require('hardhat'); // Returns the ether balance of a given address. async function ...
Indul's user avatar
  • 7
0 votes
1 answer
11 views

Wrong argument count for function call: 2 arguments given but expected 1

uint256 adminTokenBalance = balanceOf(owner(), tokenId); require(adminTokenBalance > 0, "Admin does not hold expired token"); _transfer(owner(), msg.sender, tokenId, ...
Rizwan Ali's user avatar
0 votes
0 answers
21 views

Flash loan on Pancakeswap utilizing equalizer.finance provider

I'm trying to write a smart contract on Remix-Ethereum IDE to do a Flash loan on Pancakeswap utilizing equalizer.finance provider. the smart contract function is to borrow token1 swap token1 with ...
ASG's user avatar
  • 1
0 votes
0 answers
8 views

Decentralized E-Authentication System for Student Portal with Ethereum-based Decentralized Identity Management and Access Control

I was given a final year project to build a Decentralized E-Authentication System for Student Portal with Ethereum-based Decentralized Identity Management and Access Control. I'm new to web3, please ...
Damzy0147's user avatar
0 votes
2 answers
155 views

Foundry tests fails with EvmError: Revert Counterexample, when calling transfer

I'm getting an error when trying to test my treasury: [FAIL. Reason: EvmError: Revert Counterexample: calldata=...
Ritzy Dev's user avatar
  • 271
1 vote
1 answer
29 views

--solc --userdoc --devdoc File not found. Searched the following locations: ""

When trying to generate user documentation and developer documentation from the NatSpec of a smart contract with solc --userdoc --devdoc MarketPlaceCustodial.sol by following the official ...
Torof's user avatar
  • 533
0 votes
1 answer
18 views

I am trying to replicate a deployed contract but it doesn't work for me. I want to learn to please tell me what I am doing wrong. Goerli lets me do it

contract : https://codeshare.io/BA1yqK The error : Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Returned ...
newDev's user avatar
  • 1
0 votes
0 answers
36 views

Looking for a free Solidity reversing tool (not decompiler)

I found there is a Solidity reversing plugin for IDA Pro and Binary Ninja, but it costs a lot for students. Are there any free Solidity plugins? Or are there any other free reversing tools that have a ...
Wonjae Choi's user avatar
1 vote
1 answer
36 views

Creating an ICO contract

I'm creating a simple ICO contract, it sends the amount of the token bought to the buyer as soon as the contract receives ether, and then sends the received ether to a different wallet, I've been ...
Santos's user avatar
  • 17
1 vote
0 answers
68 views

How to test Chainlink Operator.sol in Foundry and find cause of revert?

I am trying to rewrite this test from Truffle/Javascript to Foundry/Solidity. This is the specific part I am stuck on: it("should not fulfill from unauthorized job", async function () { ...
palmcivet's user avatar
0 votes
1 answer
28 views

Can a smart contract approval token of wallet address to a spender?

For example, if wallet A calls a method of contract B, and this method authorizes Token X from wallet A to contract C, can the contract B do this?
user2873314's user avatar
0 votes
2 answers
26 views

What are the best up-to-date secure approaches of generating pseudorandom number in Solidity? [duplicate]

I am thinking about creating a lottery with more than one winner and one round for users. Please don't consider usual 'commit-reveal' scheme. However, person can claim rewards on their own at the end ...
Victor's user avatar
  • 13
1 vote
0 answers
19 views

addLiquidityETH : TransferHelper: TRANSFER_FROM_FAILED

I am trying to understand this code. I have tried different variations, but whatever I do, it is not working. I get this Error: VM Exception while processing transaction: reverted with reason string '...
rabTAI's user avatar
  • 21
0 votes
1 answer
63 views

what is the difference between address and target in ethers

const hre = require("hardhat"); const { ethers } = require('hardhat'); // Returns the ether balance of a given address. async function getBalance(address) { const balanceBigInt = await ...
Indul's user avatar
  • 7
1 vote
1 answer
17 views

error Dai/insufficient-allowance even when sufficient amount has been approved

I am testing smart contract interaction with Gains.trade on hardhat mainnet fork. However i always got this error Error: VM Exception while processing transaction: reverted with reason string 'Dai/...
Haziq Raz's user avatar
-1 votes
1 answer
28 views

how can i deploy my Dapp?

what if I have deployed my smart contract on truffle and used ganache to deploy the same and i havn't used any test network, so if I go to deploy it on netlify to demonstrate the same will it work??
kaustubh sharma's user avatar
1 vote
1 answer
164 views

Cannot read properties of undefined (reading 'formatEther')

const hre = require("hardhat"); // Returns the ether balance of a given address. async function getBalance(address) { const balanceBigInt = await hre.ethers.provider.getBalance(address); ...
Indul's user avatar
  • 7
3 votes
0 answers
35 views

Implementing Verkle Trees in Solidity, Generating Proofs, and Using Zokrates

I'm working on implementing Verkle Trees and looking for guidance on how to implement Verkle Trees in Solidity. I have a working python code with implementation of verkle trees, proof generation and ...
Shrigouri's user avatar
3 votes
0 answers
20 views

Smart contract in Solidity: call a function from a contract written in Vyper

I'm writing a contract in Solidity, in which I'm trying to call a function from another contract written in Vyper. To do so, I've checked the corresponding function in the ABI of the Vyper contract, ...
Tom's user avatar
  • 31
0 votes
1 answer
25 views

Solidity GAS Fee different for pure and non-pure functions

I am using REMIX IDE, and running the following codes to learn about the gas limit. GAS LIMIT IS 3000000 First I ran this code, // SPDX-License-Identifier: MIT pragma solidity ^0.8.3; contract gas{ ...
Nitesh Modi's user avatar
1 vote
1 answer
18 views

Hardhat compile code on file change (like remix)

Is there any way (preferably an official Hardhat plugin) to automatically compile the Smart Contracts' code on file change? I'd want to have the same developer experience as when using Remix, or ...
Alexander Herranz's user avatar
1 vote
1 answer
29 views

What does it mean when we say some proposal is compliant with ERC4337?

https://twitter.com/johnrising_/status/1688949899419693068?s=46&t=LOD6kc1r6c1fbygDtT3Qvg I was reading this twitter thread today . Then I read about EIP6900 https://eips.ethereum.org/EIPS/eip-6900 ...
Gaurav Pant's user avatar
0 votes
0 answers
52 views

How to calculate the Max Buy and max sell of an erc20 token even without liquidity

How to calculate the Max Buy and max sell of an erc20 token even without liquidity. There are many Ethereum tokens with a limit to the maximum amount of tokens that can be bought at once and sold. I ...
JoachimScript's user avatar
1 vote
2 answers
26 views

Mint From Existing Contract

I have the following contract that is already deployed (pasted below). I can see where the constructor() method is doing an emit Transfer from the 0x0 (zero) address to the deployer address in order ...
ASumeet's user avatar
  • 15
1 vote
2 answers
35 views

Call revert exception error

I am getting this error when I try to access a string from a dynamic array call revert exception; VM Exception while processing transaction: reverted with panic code 50 [ See: https://links.ethers.org/...
Recep Çankaya's user avatar
0 votes
1 answer
17 views

How can I retrieve the address of an external library in Solidity?

I'm currently working on a Solidity project that involves using external libraries. I need to access the address of an external library within my contract. Is there a way to retrieve an external ...
InterNos's user avatar
0 votes
0 answers
15 views

Type contract is not implicitly convertible to expected type tuple in my foundry setup

I am trying to test my project, but keeps throwing an error in the test setup. //SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {Test} from "forge-std/Test.sol"; import {...
Mayokun's user avatar
0 votes
2 answers
36 views

version problem in hardhat

const hre = require("hardhat"); // Returns the ether balance of a given address. async function getBalance(address) { const balanceBigInt = await hre.ethers.provider.getBalance(address); ...
Indul's user avatar
  • 7
0 votes
0 answers
15 views

How can one OZ Transparent Proxy access data from another OZ Transparent proxy?

Scenario: I have two proxies: Root Proxy, this is created during deployment Secondary proxies, this is created at start of each transaction, and is initialized with the context of the transaction ...
Somjit's user avatar
  • 265
4 votes
0 answers
79 views

Hardhat and foundry, contract bytecode different

I'm developing a contract in hardhat project. But now I want to write test by foundry. My problem is I'm using create2, but when running contract by hardhat and foundry they gave different addresses. ...
CT95's user avatar
  • 163
0 votes
0 answers
6 views

AAVE:COOLDOWN_SECONDS and UNSTAKE_WINDOW

AAVE V1 's redeem() function requires us to wait for COOLDOWN_SECONDS and withdraw money in UNSTAKE_WINDOW. /** * @dev Redeems staked tokens, and stop earning rewards * @param to Address to ...
LEVI_104's user avatar
1 vote
1 answer
40 views

How to handle calls to mapping of big structs

Good day y'all, i'm tying to write a contract which is supposed to interact with another one that has a big struct that i need to retrieve to do some calculation, the struct have 14 properties and it ...
panella87's user avatar
0 votes
2 answers
26 views

What is the purpose of the constructor?

contract Constructor { string public name; // I thought constructor will prevent the name to change but after deployed the contract, calling the function resulted in changing the name????? ...
Majed Alshaikhi's user avatar
0 votes
0 answers
93 views

TypeError: AbiCoder is not a constructor

I am working with patrick solidity course on youtube and have gotten to the point of carrying out unit testing. I am having this issue getting this error const { assert, expect } = require("...
eric Igbinosun's user avatar
0 votes
0 answers
34 views

Is it possible to use Foundry to monitor the mempool?

I have been able to use other frameworks / libraries (e.g., web3.py and ethers.py) to monitor mempool events. I see that anvil has one mention in the docs related to mempool monitoring (a switch for ...
Gnostication's user avatar

1
3 4
5
6 7
346