Questions tagged [solidity]

Solidity is a language for smart contracts for blockchain technologies like Ethereum. It is designed to compile code for the Ethereum Virtual Machine. Use this tag for questions about programming smart contracts using the Solidity language.

Solidity is an object-oriented language whose syntax is similar to that of ECMAScript, but with static typing, and it is designed to compile to code for the Ethereum Virtual Machine for use in smart contracts in blockchain technologies.

6642 questions
1
vote
2 answers

How permit function works

I'm trying to figure out what's purpose of permit function from the Uniswap core I know that ecrecover function ensures, that messages was signed by some address, but that's not clear for me -- why we can use permit function?
1
vote
1 answer

Duplicate information in useState variable

So I'm having the problem of having duplicate information into an array useState variable. This is my code: const [tokens, setTokens] = useState([]); const getTokens = async () => { const nftContract = await getContract(true); const…
asusrid
  • 63
  • 7
1
vote
0 answers

function swapExactTokensForTokens - amountOutMin

I have assigned 'uint amountOutMin' as 1. But when I swap 0.1BNB to btc, amoutOutMin will be less than 1. Will this transaction revert (since amountOutMin is <1). I belive we cannot set it to a value like 0.0001 function swapExactTokensForTokens( …
DeFi
  • 77
  • 1
  • 8
1
vote
1 answer

How to retrieve data from a SmartContract that is not listed in their ABI

I'm trying to retrieve the total supply of an ERC1155 SmartContract. This code was made by my friend and has been deployed. He took the code from OpenZeppelin with Burnable and Pausable presets. The function totalSupply that I am trying to retrieve…
user1034754
  • 71
  • 2
  • 8
1
vote
1 answer

I am trying to write a nodejs that sends and calls functions from the smart contract but to no avail

So, I am building an Iot device integrated with blockchain on a raspberry pi. I have created a smart contract and deployed it on sepolia testnet. And now for testing, I am writing a nodejs to send a function on the smart contract by passing…
1
vote
0 answers

"before each" hook for "is deployed": SyntaxError: Unexpected token u in JSON at position 0

I am trying to test my contract in Mocha. and I am running into this issue where npm run test is giving the following result. PiggyBank 1) "before each" hook for "is deployed" 0 passing (247ms) 1 failing 1) "before each" hook for "is…
Sid111Math
  • 167
  • 9
1
vote
1 answer

Role Object Pattern implementation in Solidity

I am implementing Role Object Pattern in solidity. My implementation looks like this. interface IEmployee{ function getName() external view returns (string memory); function getAge() external view returns (uint256); function…
1
vote
1 answer

How to convert a block.timestamp to a date year/month/day/hour/minute using solidity?

I want to set up a voting system where, as soon as it starts, the user can see on what date the voting started. Demonstrating, voting started on 2022/10/07 at 18:40
lin3d
  • 11
  • 2
1
vote
0 answers

Transaction reverted without a reason string - Chainlink VRF - How I solve that issues?

I'm learning how to use Chain Link VFR to get some random numbers. I have a Localhost Mainnet Forked by Hardhat and Alchemy. I'm using the example contract, I can deploy on my localhost normally, I can transfer some LINK to the contract address, I…
1
vote
0 answers

reverted transaction. Calling another contract inside delegatecall

Can delegatecall and call be chained? A calls B via delegatecall(). Then, when B calls C, execution reverts. Is this expected? When A calls B via delegatecall, Why can't contract B call contract C? Set up: (delegatecall) (call) A…
1
vote
2 answers

Solidity-extension in VS Code can't resolve the imports from node_modules

Please take a look at my environment details. Environment Node installed with nvm Truffle is installed in different node environments which can be switched by simply changing the node by nvm use v16.17.0 In my vs code I have installed Truffle for…
1
vote
1 answer

Console.log for solidity Array of Structure

I would like to use the console.log for displaying an array of structure. I succeed only in displaying an attribute of the structure, not the all structure. I got this error: Member "log" not found or not visible after argument-dependent lookup in…
DamTan
  • 189
  • 1
  • 3
  • 14
1
vote
1 answer

Remix IDE - No store or retrieve button after Compilation

I am busy teaching myself solidity via Patrick Collins instruction video When entering store in SimpleStorage.sol as per video instruction it does not turn green as in the video. It stays white. Same for retrieve function. When compiling no…
1
vote
0 answers

How to manage different version of solidity compilers in smart contract?

source.sol pragma solidity >=0.7.0 <=0.8.4; import "@chainlink/contracts/src/v0.7/ChainlinkClient.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import…
Rexdev
  • 11
  • 1
1
vote
1 answer

User -> proxy -> proxies -> smart contract

I'm writing smart contract for Ethereum using Solidity and OpenZeppelin. I wish to implement this kind of situation this kind of situation Where I deploy a proxy for each user and the proxy uses the same smart contract with the storage of the…
Doe
  • 93
  • 5