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

UniswapV3 Quoter throws error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION)

I am working with the Quoter from Uniswap V3, here is the part of the function that challenges me: ... // Reformat Amount In if (!isNaN(amtIn)) {amtIn = amtIn.toString()} let amountIn = ethers....
Christopherus's user avatar
0 votes
1 answer
122 views

ERC721: invalid token ID"

I'm minting an NFT and listed it on my NFTMarketplace, after minting I keep getting ERC721: invalid token ID, whenever I try to create the sale on the market place. this is my nft code // SPDX-...
Santos's user avatar
  • 17
1 vote
1 answer
104 views

Where to place special functions receive() & fallback()?

receive() external payable { fund(); } fallback() external payable { fund(); I want to find out where exactly should these special functions be wrriten; should they come before the contract ...
progress Ibrahim's user avatar
1 vote
1 answer
69 views

Is it possible to import foundry anvil in rust?

I successfully installed and used anvil from the wsl shell. I have some rust code, where i want to import foundry anvil instead of running from shell, cause i want to be able to control it from the ...
Sherlock zaguero's user avatar
2 votes
1 answer
74 views

Where in the code of this unstake function is ETH actually transferred?

I am looking at this repo, which is contracts for a decentralized pegged asset issuance system backed by liquid staking tokens like rETH. Specifically, I have a question about the functions unstake in ...
auditor_chick's user avatar
0 votes
1 answer
31 views

I need to use ‘selfdestruct’,How to prevent the implementation of eip-4758?

I found a very useful idea compared to the traditional deposit method on exchanges. Using this method, not only does it not need to manage secret keys, any account can perform token collection, but it ...
詹文杰's user avatar
0 votes
1 answer
17 views

Unable to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 41
1 vote
1 answer
26 views

How to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 41
0 votes
0 answers
18 views

Treating two assets as equal in a smart contract that aren't equal

I am auditing a protocol that creates a token yETH representing a basket of liquid staking tokens such as rETH and stETH. I noticed that the protocol treats yETH as if it is 1:1 with ETH when it's ...
auditor_chick's user avatar
0 votes
1 answer
24 views

Batch NFT mining

I am trying to create a project where users can specify a total supply on a minted NFT, will the NFT all have the same address but with different tokenId's or they will have different addresses
Santos's user avatar
  • 17
0 votes
1 answer
42 views

How to give allowance to a contract and send erc20 between accounts

I wrote the following contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract enviaToken { address public ...
CaioBonani's user avatar
0 votes
1 answer
10 views

How the uint changes to address type in solidity when using delegatecall?

pragma solidity ^0.8.18; contract One{ address public first; address public second; address public third; function setaddress(address _address)public { third = _address; }...
kumar's user avatar
  • 41
1 vote
2 answers
24 views

Create a new Erc20 contract through Ether.js

I've a functionality in my nextJs application to create an ERC20 token on a fly. Like user can input a contract name and symbol, and behind the scene through the Ether.js a new contract gets created ...
Saad Suri's user avatar
0 votes
1 answer
18 views

Can you refer to a contract inside itself?

Sorry this is a very minor question but the following is part of a contract called LibOrders.sol. The function below calls LibOrders.cancelOrder....normally I think you would just put "...
auditor_chick's user avatar
0 votes
1 answer
39 views

Can I edit in the msg.sender value for the called contract?

let's assume following solidity contracts: contract EntryPointContract { address one = '0x...'; address two = '0x...'; address delegateContract; constructor(address ...
Jaroslaw Piatek's user avatar
0 votes
0 answers
7 views

Card.jsx is not properly rendering

I'm beginner in the field of developing Decentralized applications. Currently i'm working on a project, in which i'm developing a crowdfunding application using NextJs, HardHat, Solidity. I'm facing ...
Vansh Batra's user avatar
1 vote
2 answers
68 views

Error: VM Exception while processing transaction: reverted with reason string '12'

I'm getting an error like: Got 20000000000000000 WETH. Approved! Depositing... Deposited! You have 20000000000000000 worth of ETH deposited. Yoy have 0 worth of ETH borrowed. You can borrow ...
manu sharma's user avatar
0 votes
1 answer
117 views

Fork specific blocknumber on BSC Mainnet call deployed contract failed

I want to call Quoter Contract on BSC Mainnet which is deployed already. I'm using HardHat or Foundry to fork Mainnet specific blocknumber, here is HardHat Config JS: module.exports = { solidity: &...
Sylar's user avatar
  • 1
1 vote
1 answer
30 views

Is it secure to use multiple admin

im trying to do multiple admin system in my solidity and here is example //SPDX-License-Identif`ier: MIT pragma solidity 0.8.15; import "@openzeppelin/contracts/access/Ownable.sol"; ...
Mert Tanıtan's user avatar
0 votes
1 answer
26 views

Read from a state variable without sending a transaction

https://solidity-by-example.org/state-variables/ the site says "you can read state variables, for free, without any transaction fee". But when I do a get - call in Remix, a transaction is ...
Forgotten Semicolon's user avatar
1 vote
1 answer
172 views

What solidity version is used when you give a range to the compiler e.g. pragma solidity >0.7.0 <0.9.0?

I am new to Solidity but have learned you can tell the compiler to use a range of Solidity versions e.g ^0.8.10 || > 0.7.0 < 0.9.0 when deploying smart contracts. My question is how does the ...
davidastro's user avatar
0 votes
0 answers
14 views

What happens if you divide a uint256 by a uint88 using divU64?

I am looking at the following function. It takes a uint256 (ercDebtSocialized) and uses safemath divU64 to divide it by a uint88. I assume this would just throw an error? I unfortunately cannot test ...
auditor_chick's user avatar
0 votes
0 answers
42 views

Swapping contract tokens to ETH on all Uniswap buys fails, sells work

Consider this code: // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.10; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import &...
Ken Adams's user avatar
0 votes
1 answer
183 views

SafeERC20: low-level call failed

I have the following function and when I execute it is returning an error, any idea why? function BuyPilaWithUSDT(uint256 _amtUSDT) external { require(_amtUSDT > 0, "Unsuitable Amount"...
Roger that's user avatar
1 vote
1 answer
57 views

Two people calling this function at exactly the same time

I was looking at Rocket Pool's docs on interacting with other contracts and they included a simple example function that another protocol could use to accept deposits of ETH, forward it to RP, and get ...
auditor_chick's user avatar
1 vote
1 answer
22 views

How to call a function from a separate contract

I have a already deployed contract and it has a withdraw() function. And i want to create another contract that first send some ETH to the target contract and then call the withdraw() to withdraw ...
Arkonomi's user avatar
0 votes
2 answers
110 views

Make Uniswap v2 swap through inline assembly

I'm trying to make swap tokens in smart contract using Uniswap V2. My main goal is to make part where you need to work with Uniswap router as assembly block. I'm not good in assembly, so I need your ...
Fuga14's user avatar
  • 23
1 vote
2 answers
187 views

For a given block, how to extract only transactions that involve newly minted NFTs, with either Foundry or ethers.js?

Firstly, I’ll say that I prefer to do this with Foundry, but if it turns out to be too much of a pain, I’m open to doing this with ethers.js as well. Take this block, for instance: https://etherscan....
user72364's user avatar
  • 135
1 vote
2 answers
43 views

Error in reading properties of JsonRpcProvider Error: TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

This is the entire error message: Error: TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider') at interactWithContract (contractInteraction.js:6:1) at handleAddProduct (...
Dhananjay Joshi's user avatar
2 votes
1 answer
33 views

Getting error ERC20: insufficient allowance even after the user approving the tokens. Need help with debugging

The following code is from a Stablecoin project. To gain more context, please refer to this Github repo. I've added a new function to the DSCEngine.sol name collapseDsc() which is responsible for ...
alfheimrShiven's user avatar
2 votes
0 answers
84 views

Hardhat public network fork: Error calling view functions with ethers.js on browser

I have my hardhat network configured as a fork of Binance Smart Chain like this: const config: HardhatUserConfig = { solidity: { version: "0.8.0", settings: { optimizer: { ...
Alexander Herranz's user avatar
0 votes
1 answer
28 views

Unable to Estimate Gas When Calling withdraw Function in Solidity Contract on Polygon Network

I've deployed a Solidity smart contract on the Polygon network, which includes a withdraw function. The contract code is based on Solidity version 0.8.16 and leverages the OpenZeppelin library for ...
Peno's user avatar
  • 1
0 votes
2 answers
35 views

Can a function call itself?

Can a function call itself...specifically, I am looking at this code and I can't figure out how this could work properly...the parameter vault would be the first parameter in the line that calls ...
auditor_chick's user avatar
1 vote
1 answer
16 views

Can you return something only some of the time with a function in solidity?

I am looking at a function that says it returns two uints, but the return statement is inside an else statement, so obviously there are conditions under which nothing would be returned. Can you have ...
auditor_chick's user avatar
0 votes
2 answers
13 views

How relevant is front end knowledge to landing a job coding in solidity, or just coding in Solidity in general?

I am very interested in learning how to code in Solidity and work with smart contracts, but I have much less interest in working with front end. Since I don't want to slog through hours and hours of ...
Wynand Malan's user avatar
0 votes
1 answer
47 views

How to generate a valid Private Key using CLI?

I am trying to create a private key which is valid and can be used for production work. What tool should I use to create a Valid Private key on my system using Terminal/CLI?
Megabyte's user avatar
0 votes
1 answer
16 views

Revert inside a for loop

If there is a revert inside a for loop that is inside a function, and the revert is triggered, will the whole function revert?
auditor_chick's user avatar
0 votes
1 answer
14 views

Contract events logs: string data field divided

I got this event signature: event Event(address indexed from, address indexed to, string text); Which I call inside this method: function emitEvent(address to, string calldata text) external { ...
Francesco Stucci's user avatar
0 votes
1 answer
20 views

Triggering User Defined Jobs On-Chain

I have been working on this dapp lately that allow users to create a product with an expiration date (don't mind the specifics of the app). Once expired, a call to a smart contract should be made (...
eyalmen's user avatar
0 votes
1 answer
53 views

Is there any way to mint an NFT with metadata without passing URI in mint?

I want to create an application that receives a contract address and create a frontend for other users to mint the NFTs from that contract. But I don't have any metadata for that contract, could this ...
Vitor M. Almeida's user avatar
0 votes
1 answer
100 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 ...
Malik Mehmood's user avatar
0 votes
0 answers
36 views

Require WETH liquidity on uniswap v2 pair to be min 1 ETH to trade

I want to launch a token with a significant part of the supply being airdropped (no vesting). I'd like to implement a requirement so that airdropped holders won't sell into initial liquidity (1 ETH). ...
soliditynoob's user avatar
2 votes
1 answer
21 views

What is the purpose of curly bracket blocks in solidity?

I was reading the code of the Uniswap LP contract to get a better understanding in a couple of methods there are parts of code in curly brackets, what is the meaning of those? For example, a method ...
Dogu Deniz Ugur's user avatar
0 votes
0 answers
49 views

Getting Quote Exact single input to work on quickswap

So im trying to check how many tokens i'll get before i do a swap on quickswap like (1USDC -> 0.1655....LINK), I've tried to use: try{ const amountOut = await quickquoter.callStatic....
Paucar's user avatar
  • 11
1 vote
0 answers
10 views

Struct string not saving to storage from mapping

Good morning guys, I would like to get some help with some declaration that I am doing in my solidity contract, basically I want to have some data on my registry from a user, such as if it is admin, ...
Marxian's user avatar
  • 21
0 votes
0 answers
11 views

Flashloan script does not return GAS or loan amount [duplicate]

I got the script from get-flashloan website. The script requests loan and performs arbitrage and then the profit can be withdrawn. The problem with the script is, it deducts the balance from the smart ...
engageub's user avatar
2 votes
1 answer
83 views

It is safe to use allowUnlimitedContractSize: true?

I'm trying to deploy with Hardhat a Smart Contract which has too much code, even after refactoring and using libraries. The only solution would be a total refactor following the diamond pattern, or ...
Alexander Herranz's user avatar
1 vote
1 answer
24 views

Can approve function be malicious?

I'm so confused on how approve functions works: If myToken contract has an approve function but the owner did not approve the contract B. Then contract B deploys a function and create a function that ...
anonauditor's user avatar
0 votes
1 answer
95 views

TypeError: Cannot read properties of undefined (reading 'match')

I'm new to Solidity and ether js. I'm stuck with error below in VSCode. Can anybody help explain what this error means and advise how to fix this? Thank you so much! ERROR BELOW: (node:5884) ...
David Blake's user avatar
2 votes
1 answer
65 views

Fuzz Testing for Solidity Smart Contract

I'm deeply involved in smart contract security, and I'm currently exploring the world of fuzz testing for Solidity smart contracts. Fuzz testing seems to hold significant promise for identifying ...
Mehran Ra's user avatar
  • 481

1
5 6
7
8 9
349