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

Fallback function in python

is there some kind of fallback function (Solidity analogy) in python? A fallback function is always called when no corresponding method is found in a class. For example I have class A with no methods, but only a fallback function: class A: def…
Mecanicul
  • 11
  • 2
1
vote
0 answers

HTTPSConnectionPool(host='127.0.0.1', port=7545): Max retries exceeded with url: (Caused by NewConnectionError

# compile_standart is going to be the main function that we will use to compile this code. from solcx import compile_standard, install_solc import json from web3 import Web3 import os from dotenv import load_dotenv load_dotenv() with…
whatever12
  • 21
  • 4
1
vote
1 answer

How pass array of numbers to contract function in Etherscan?

I have this piece of code from a solidity contract: function loadMintIDs(uint256[MAX_TOKENS + 1] memory array) external onlyOwner { require(array.length == MAX_TOKENS + 1, "List of IDs must be MAX_TOKENS + 1"); require(!IDsLoaded,…
Swerfer
  • 345
  • 1
  • 9
1
vote
0 answers

How to write a test (using artifact file), needing a DEX router as an input

My necessity is to write a test for the following smart contract method (DeFi) in Hardhat using chai. It searches for a profitable token swap and returns the tokens. I want to use the artifact file to the test, before deploying the smart contract to…
DeFi
  • 77
  • 1
  • 8
1
vote
0 answers

how to get anonymous event arg in solidity?

I'm starting to use anonymous events so i wrote a very simple contract just to see how it works and the problem is when I deploy my contract with a simple event i can get the arg of the events but when i make it anonymous, I can't access them. the…
Jack
  • 13
  • 4
1
vote
1 answer

Aprove function does not increase allowance of ERC20

I am trying to implement a simple token transfer to a Vault but I'm having trouble approving the transaction and when I run tests using foundry, I receive this error: [FAIL. Reason: ERC20: transfer amount exceeds allowance] testDeposit() (gas:…
1
vote
0 answers

How to generate java wrapper for solidity contract with openzeppelin imports

Suddenly I discovered web3j provides an option to auto-generate the Java contract from solidity contract. Sample case you can find here. Unfortunately it does not recognize the import of openzeppelin contracts: Error: Source…
Joe Dow
  • 583
  • 1
  • 3
  • 12
1
vote
0 answers

ERC2981 NFT Royalties Implementation in a ERC721 Marketplace

I've read already many posts regarding this topic, but I just can't wrap my head around this Royalty implementation thing. Pls help me out, I don't know how I should play with this thing. what is feeNumerator? _setDefaultRoyalty(address receiver,…
DevABDee
  • 180
  • 9
1
vote
1 answer

UniswapV2 getAmountsOut execution reverts without a reason string

I'm writing an LP token price aggregator of UniswapV2 on fantom network. I finished the price getting functions so I wanted to test them before and after swaps(imagining flashloan etc..) But execution of getAmountsOut of IUniswapV2Router02 reverts…
1
vote
2 answers

PDF watermarking

I want to watermark a pdf in a document management system using the device's details. When a particular user downloads a pdf document from a document management system, it comes with the user's details watermarked.
Kanchana M
  • 11
  • 1
1
vote
1 answer

Hardhat not installing on Windows 10

I wanted to Hardhat but it's not installing. I first ran "npm init" then I ran the command "npm install --save-dev hardhat" and I kept getting this error message even though I've switched internet network two times: npm ERR! code ENOTFOUND npm ERR!…
Ololade
  • 99
  • 7
1
vote
1 answer

How do I optimize my Gas Cost in react-moralis?

So I am calling one function from my smart contract. I pass the same data, same conditions but the gas estimation in Remix is 0.00126923ETH and gas estimation in Front-end of my application that uses react-moralis has a gas estimation of…
Slowqueso
  • 9
  • 1
1
vote
2 answers

Passing dynamically generated values to ERC20 Constructor

Issue Hi everyone! I'm currently working on an website that autogenerates ERC20 token by the value supplied by user. The biggest concern i've been getting is passing user values to ERC20 constructor since it expects two arguments in the constructor…
1
vote
0 answers

How does proof of humanity increase the balance of the account by 1 UBI per hour

How does Proof of Humanity increase the user balance by 1 UBI per hour? Is it done through the smart contract or it's just a front-end thing? Is doing it through a smart contract possible? Wouldn't it be too expensive or resource consuming?
Amiya Behera
  • 2,210
  • 19
  • 32
1
vote
0 answers

What does the following error mean ERROR: UNKNOWN OPTION '--network'?

WHEN I RUN THIS CODE:- `require("@nomicfoundation/hardhat-toolbox"); require("dotnet").config(); /** @type import('hardhat/config').HardhatUserConfig */ const goerli_RPC_URL=process.env.Goerli_RPC_URL const…
BAJPAIMANN
  • 19
  • 3
1 2 3
99
100