Skip to main content

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
9 views

How to Ensure Custom Tax is Applied on Token Swaps in Solidity Smart Contract?

I'm developing a smart contract for a token (FMYNT) using Solidity on the Binance Smart Chain testnet, integrated with PancakeSwap testnet. I've implemented a custom 5% tax feature for buy and sell ...
Awais Ahmad's user avatar
0 votes
0 answers
8 views

Clone of a uups proxy contract is not working

i have a factory contract which is creating clones of an NFT contract. if the NFT contract is not a proxy everything is ok and cloning works just fine. but since i need to have a upgradable UUPS NFT ...
Mostafa's user avatar
  • 51
0 votes
0 answers
14 views

Simple code example to implement tax on sell/buy transactions for a token on Uniswap DEX causing "Your swap is expected to fail.." error

I am trying to implement a sell/buy tax on transactions for my token when users trade on Uniswap DEX. My token's smart contract includes a tax deduction mechanism that functions correctly on EtherScan ...
Awais Ahmad's user avatar
0 votes
0 answers
8 views

call function uniswapv2 swapExactETHForTokensSupportingFeeOnTransferTokens return UniswapV2: INVALID_TO

i call the following function in js : function swapForShare(uint amountOut) public { uint ethBalanceBefore = address(this).balance; require(ethBalanceBefore > 0, "Contract ...
rebwar's user avatar
  • 3
0 votes
1 answer
10 views

Automate the use of approve() without having to do it manually

I'm taking my first steps on Solidity. I would like the user to be able to use their funds by calling the dapp functions, but without having to use the approve() function manually on the token ...
Francesco Rossi's user avatar
0 votes
1 answer
12 views

Why msg.value is not transferred to the owner?

I've deployed a simple wallet contract. The withdraw function goes like this.. function withdraw() external payable { require(msg.sender == owner, "Only Owner can withdraw"); ...
Valli Nayaki Chidambaram's user avatar
0 votes
1 answer
29 views

How does the contract handle tax deductions for simple buy and sell transactions when the token is listed on any decentralized exchange (DEX)?

Could anyone provide an example solidity smart contract code for how to implement tax deduction using a router in a smart contract when list on DEX ? I've noticed that when adding custom tax deduction ...
Awais Ahmad's user avatar
0 votes
1 answer
16 views

What makes an NFT be considered a wrapped NFT?

When you bridge an NFT let's say through Wormhole NFT bridge then on the destination chain it creates a wrapped NFT. This is done by deploying a separate ERC-721 contract for every unique combination ...
Surya M D G's user avatar
0 votes
0 answers
20 views

Buy Tax Error on uniswap

I did override the "_transfer" function from ERC20 that i can deduct taxes on buys / sells if users interact with my smart contract using Uniswap interface. Sells are working fine, but i ...
SolidityNewbie's user avatar
1 vote
1 answer
125 views

How to refer to a library in an interface?

The below code is a function of my smart contract. As you can see, its return data refers to a library. VoteLibrary is a library, and VoteCounting is a struct defined within it. Therefore, VoteLibrary....
Alireza's user avatar
  • 567
0 votes
1 answer
21 views

How to batch multiple calls through a single function?

I have a smart contract that implements monolithic functions. These functions are designed to do one job when called by a user. However, a user may be interested in batching multiple calls into a ...
smol-ninja's user avatar
0 votes
0 answers
11 views

call swapExactTokensForETH in javascript

I have the following function in JavaScript: try { let tx = await router.connect(receiver).swapExactTokensForETH( tokenAmountToSwap, 0, [token.address, await router.WETH()],...
rebwar's user avatar
  • 3
0 votes
1 answer
16 views

Inheritance in solidity

Are private variables in solidity inherited ? Please I need a bit of clarification here from most text I have read about inheritance in solidity they state clearly that private variables of parent ...
Emmanuel Anah's user avatar
0 votes
1 answer
16 views

Metamask transaction error

getting MetaMask - RPC Error: Function object could not be cloned. DOMException: Function object could not be cloned. after signing the transaction This is how i am signing the transaction this....
ashish0411's user avatar
0 votes
0 answers
12 views

Uniswap v3 IQuoter / IQuoterV2 return nothing

I'm trying to get Uniswap v3 IQuoter.quoteExactInputSingle() or IQuoterV2.quoteExactInputSingle()in Arbitrum / Base networks in my solidity contract. In both cases Remix show me that decoded output is ...
Rodion Krat's user avatar
0 votes
1 answer
14 views

I would like to know if with this code after deploy on REMIX IDE,it is possible swap my token in bnb,usdt,btc,eth and sol on Uniswap and Pancakeswap

// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable....
Massimo Fornara's user avatar
0 votes
1 answer
22 views

Swapback issue with BEP20 contract

anothe rissue presents itself! My problem is with the swapback function: (the function is public because i was testing it, it should be internal) function swapBack() public swapping { uint256 ...
CFC's user avatar
  • 3
0 votes
1 answer
22 views

what is the way to find out if a selected token will revert at 0 transfer

How can I find out if the selected token will revert to 0 transfer? Is there a list of tokens that revert at 0 transfer. As far as I understand USDC is one of them, is that correct ? Thanks in advance!...
kane333's user avatar
1 vote
1 answer
24 views

assembly mload offset understanding

I tried asking chat-gpt but it kept shitting the be for the explaination. I have some code which looks like so: function getAuthorityScope(bytes memory authorityScope) public pure returns (address, ...
RitzyDevUk's user avatar
0 votes
1 answer
16 views

Failure to decode JSON

I'm trying to decode the following ZK proof, that lives in a JSON file, into a Solidity struct, using the Foundry book guide for JSON, but I'm getting continuous either errors or the wrong values: ...
dNyrM's user avatar
  • 928
1 vote
0 answers
13 views

Is it safe to use the Diamond Standard in 2024?

I am asking because I wonder if the libraries are mature enough. For non-upgradable contracts, for example, using the OpenZeppelin Contracts library is a no-brainer. Do you think this is the case for ...
FracaShaw's user avatar
0 votes
0 answers
12 views

How the deployer manages to call function manual swap on a burned liquidity renounced contract and drain more money selling tokens he didn't hold

Deployer sold his tokens and left the project. 10 days later I verify he made another sell from tokens that weren't on his deployer wallet. He called a function "manual swap" and somehow I ...
Martin Saints's user avatar
0 votes
0 answers
20 views

I'm working on a NFT Marketplace and help me with BUY function. It's not working?

I'm new to smart contracts and testing some functions. I'm trying on buy nft function. it's not working somehow. Even though I've enough balance, the crypto transfer is not happening. Please find the ...
Vara Prasad's user avatar
2 votes
1 answer
63 views

EIP-3448 really need the metadata length or is it optional?

If you check the specs of EIP-3448, it states: "The last 32 bytes (one word) of the bytecode must indicate the length of the metadata in bytes." However, if this is not included in the ...
Iftikhar uddin's user avatar
0 votes
1 answer
13 views

Account Abstraction on Private blockchain?

I want to know about that is it possible to implement account abstraction on private blockchain (POA) based geth client / Ganache client?
ProgrammerSK's user avatar
0 votes
1 answer
26 views

why is my loop not working in below solidity code

What's happening here in the code and why is my loop not working? And one more thing, should I remove all the warnings from my code before deploying? function sub(uint n, uint a) external pure returns(...
paaras bhardwaj's user avatar
1 vote
0 answers
20 views

How to precisely remove a specific amount of token0 or token1 liquidity from a Uniswap V2 Pair in Solidity

I need to remove an exact amount of token0 or token1 from a Uniswap V2 pair. To achieve this, I must calculate the amount of LP tokens to burn. The calculation formula is straightforward: Where: ...
CryptoBro's user avatar
1 vote
1 answer
16 views

Help Needed: Uniswap Not Finding My Recently Deployed Smart Contract

Help Needed: Uniswap Not Finding My Recently Deployed Smart Contract Hello everyone, I’m facing some issues with Uniswap and could really use your expertise. I recently deployed a smart contract for ...
Wail Haddad's user avatar
0 votes
1 answer
23 views

bundle transaction in bsc with contract address

i want to build bsc bundle like this contract address here is example https://bscscan.com/tx/0x934ad8417862a1e1e81a5b7ec4558f89877f06c33d3b2612293272eba437c869 https://bscscan.com/address/...
user3186594's user avatar
1 vote
0 answers
15 views

InvalidFEOpcode when running Hello ZoKrates

I'm trying to verify a proof by calling verifyTx() on the smart contract output given after running zokrates export-verifier, but it's reverting with the error InvalidFEOpcode on the code block: ...
dNyrM's user avatar
  • 928
0 votes
0 answers
16 views

Deploy script to anvil node foundry

Is it possible to simulate a contract deployment, using a script, to an anvil node but by specifying the localhost in the script itself instead of a flag on the CLI command? Instead of this: forge ...
dNyrM's user avatar
  • 928
0 votes
0 answers
9 views

I am not able to specify network in brownie run

I am not able to specify networks in brownie run. brownie run ./scripts/deployment_v2.py --network ropsten I get error TypeError: 'NoneType' object is not subscriptable error log: PS C:\Users\ADMIN\...
Udayarajan gauthaman's user avatar
1 vote
2 answers
25 views

How can I byte pack these datastructures in solidity to be more efficient?

I have a bunch of mappings that I want to optimize in my Solidity smart contract, is there a way that I can use byte-packing to reduce the size needed to store all the data in these mappings? ...
Barney Chambers's user avatar
0 votes
1 answer
26 views

Having issues swapping brett on base with my web3.py script

Here is my current code (not including abi because its gonna be to long) #Addresses PERMIT_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3' BRETT_ADDRESS = '...
vectorizedaynon's user avatar
0 votes
1 answer
32 views

How to get all my tokens from my contract

I need help getting all tokens in an array . I’m making a geo location based game, where a user can mint an NFT and then pin it to the map. Once the NFT is pinned it gets added to my NFTS array I want ...
piña's user avatar
  • 209
1 vote
1 answer
17 views

Why use circom circuits to generate solidity contracts, instead of directly writing the contract?

I am not able to understand why write a circom circuit and then use it to generate a solidity contract to be deployed. Instead, why not write the code directly in solidity. Is it because zero ...
Surya M D G's user avatar
0 votes
1 answer
25 views

For hardhat-deploy, How to upgrade contract

I can upgrade my contract with hardhat/upgrades. However, if I want to upgrade my contract with hardhat-deploy. How to deal with it? I just want to upgrade my contract deployed before. const ...
AndrewZzzz's user avatar
0 votes
1 answer
29 views

invalid BigNumber value for string

When I try to run the pin function that takes an integer, i keep getting an error invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0) ...
piña's user avatar
  • 209
1 vote
2 answers
30 views

Is it possible to create a queue of transasctions?

I am wondering if it is possible to create a queue of transactions. In my case I want to add all incoming transactions to a queue and randomize which ones are completed and which ones are canceled. ...
Stavros Cotsoradis's user avatar
0 votes
0 answers
10 views

Is there any way to explicitly trigger the fallback's execution if the msg.data matches an external function present in the contract?

I'm wondering whether there's a way to somehow explicitly trigger the fallback method, if the msg.data (calldataload, calldatasize and calldatacopy commands in Yul) already matches one of the ...
Mila A's user avatar
  • 1,254
1 vote
1 answer
13 views

TransferFrom Reverted on Foundry Test

I'm trying to create a test for TradingPairExchange contract where the liquidity provider provide his liquidity tokens by using transferFrom and transfer the tokens to the contract. The next step ...
0xhaz's user avatar
  • 15
1 vote
1 answer
71 views

abi.decode throwing error, panic: out of memory

solidity types data structure is like this: enum RequestType { SpecificReq, ArbitraryReq } enum ChannelType { InterestBearingOpen, InterestBearingMutual, } ...
Nilesh Gupta's user avatar
0 votes
0 answers
9 views

I need the solution for Spurious Dragon in constructor arguments in Solidity [duplicate]

I wrote 5 contracts modulating the whole operation of bonds of fixed income. I created #1- the storage of data, #2- the pool of investment with USDC, #3- the contract to issue, redeem and amortization,...
DoctorWeb3's user avatar
0 votes
1 answer
24 views

Error: Cannot read properties of undefined (reading 'getBalance')

hello guys im running into an error Cannot read properties of undefined (reading 'getBalance') const { ethers, deployments, getNamedAccounts } = require("hardhat") const { expect, assert } = ...
vatsal sharma's user avatar
0 votes
2 answers
39 views

Transaction failing due to Out of gas

My transaction is failing due to Out of gas. Here is the transaction: https://sepolia.etherscan.io/tx/0x84577314e676382314b620d79fba2353cbb7962ed97071f404f81010bf56ea32 I'm using hardhat to deploy my ...
MAYANK CHHIPA's user avatar
0 votes
1 answer
25 views

Two or more base classes define function with same name and parameter types

// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol&...
Kwesili Okafor's user avatar
0 votes
1 answer
33 views

How to Accurately Implement Fractional Daily Interest in Solidity

I'm trying to implement a daily interest rate calculation in Solidity based on an annual interest rate, but I'm facing issues with the precision of fractional numbers. Here's the calculation I'm using:...
Awais Ahmad's user avatar
3 votes
1 answer
54 views

Clarification on Theorem 6 from Uniswap V1 Formalized Model: e_0 < e_2 and t_0 < t_2

References: a link to the parent site Formalized Model Document
Vegetal605's user avatar
0 votes
1 answer
33 views

Foundry tests fail with `[NotActivated] EvmError: NotActivated` while fork test

The fork tests works perfectly well with Hardhat. But when I tried with Foundry using different evm_version in foundry.toml file and also tried compiling with different versions solc = "0.8.18&...
Pankaj Jagtap's user avatar
0 votes
0 answers
16 views

deployer not defined error in smartcontract

hello guys there is an error deployer not defined could you help me finding the error? I have defined deployer in hardhat.config.js whose code i have pasted below and i have commented where deployer ...
vatsal sharma's user avatar

1
2 3 4 5
357