We changed our privacy policy. Read more.

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

Importing Existing tokens on blockchain!

I'm trying to create a Farming smart-contract. I'm completely new to solidity so i want to know if there's a way i can import an existing token from the blockchain, then call methods on that token's ...
0
votes
1answer
26 views

Allowance in a smart contract

I have a smart contract that takes in tokens. I was curious if those tokens owned could be added to the allowance of another owner? When they submit the tokens, I verify allowance and transferFrom. ...
0
votes
1answer
17 views

ERC721Burnable TypeError: Definition of base has to precede definition of derived contract

I'm getting an error due to Burnable but it's not even in my contract. @openzeppelin/contracts/token/ERC721/ERC721Burnable.sol:12:46: abstract contract ERC721Burnable is Context, ERC721 ...
0
votes
1answer
29 views

payable function not working the way I expect it to work

When sending some ether to the Proxy contract (payable method addBalance) and forwarding it to Token contract I expect the ether balance of Token contract to increase with the ether amount. However ...
0
votes
0answers
11 views

How do I use memory?

I am learning solidity, and are trying to get "totalBuyFee" to be constantly reducing each time the function "greenwallbuyfee" is called. Do you guys know how I can retrieve the ...
1
vote
1answer
14 views

inheritance behavior of 2 contract when deployed

I would like to implement two contracts that extend another contract with an information store. Example: contract MonsterData { struct Monster { string name; int8 category; } ...
0
votes
1answer
35 views

Types in storage containing (nested) mappings cannot be assigned to

i have set wallet address that only owner can change, but i can not read the wallet address. my view functions giving me this error here is the code pragma solidity 0.8.0; // SPDX-License-Identifier: ...
0
votes
2answers
46 views

Issue while migrating to Ropsten network

I am trying to migrate the contract to ROPSTEN network. It fails for the following reason. Please advice. migrate command $env:MNEMONIC=' XX XX XX';truffle migrate --reset --network ropsten Error ...
0
votes
1answer
11 views

Get mapping value in hardhat

I have a mapping in my contract mapping (uint256 => uint256) totalBoostedPercent; I am using hardhat and typechain to generate type from my contract. In my test file.ts, I tried to access the ...
0
votes
1answer
8 views

Getting Empty strings back - Ethereum

I am developing E-Voting system and when I enter my Data it works fine but when I retrieve my data it return my empty strings. .Sol File: // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; ...
0
votes
0answers
9 views

What is meant by new BigNumber() not a base 16 number: 0x[object Promise] Code: BigNumber Error?

I am working on a dapp solution that has this following function in smart contract: function addFood(string memory _name, uint _price, bool _available) public onlyOwner { foods[numberOfFoods].name ...
0
votes
1answer
21 views

How do I set the price automatically?

I have a question related to billing for NFT, is it possible to prescribe in the smart contract function to set the price ? The problem is that after posting the nft you need to press Salle, set the ...
0
votes
0answers
12 views

How to avoid preflight check

How to avoid preflight transaction execution check in wallets like metamask? I want too see my revert message on chain explorer, is this possible to fix preflight check on smartcontract side?
0
votes
0answers
10 views

Reset array require an additional "(0)"

I'm writing a contract where I need to reset an array (contract attribute) to an empty array: pragma solidity >=0.6.0; contract MyCon { address[] public arr; function test() ...
0
votes
1answer
28 views

How to get and test a contract-created contract in hardhat tests?

I've got a contract which creates another contract, stores it in a map, and returns the contract to the caller with a get function. What I am trying to do is retrieve the created contract stored in ...
0
votes
2answers
28 views

RPC Error: execution reverted

I am Developing EVoting system as my final year project and i am encountering this error RPC Error: execution reverted Voting.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract ...
0
votes
0answers
44 views

invalid BigNumber value (argument="value") Error trying to trigger contract method from ABI

From the ABI in a VueJS frontend I'm trying to trigger the following method in my contract: // Payout.sol function checkStatusAndPay(bytes32 _gameId, int _winner) public notDisabled onlyOwner returns ...
1
vote
1answer
39 views

Is "tx.origin" always an externally owned account (EOA)?

The Solidity docs on Global Variables say this about tx.origin: sender of the transaction (full call chain) But that is a bit vague. Can we always be sure that ts.origin is an externally owned ...
2
votes
1answer
60 views

Disassemble "delete array" in solidity

am trying to learn about EVM bytes code, but faced this problem. First, this is the solidity code pragma solidity ^0.8.0; contract Assembly { function f() public { uint8[3] memory a = [1, ...
0
votes
0answers
11 views

Authenticating tokenUri before minting?

i'm tinkering with a concept for NFT minting with generative music and art and trying to work out the best way to make sure that people can only mint essentially ‘approved’ content. I.e from the ...
0
votes
0answers
8 views

What are the benefits of using hard coded gas values in smart contract?

I was reading the docs of Arbitrum and found this hard coded gas values should be adjusted (or better yet, removed entirely if possible (it's probably possible; really now, why are you hard-coding a ...
1
vote
0answers
9 views

Can't assign to an array because it's not implemented

Ships.TokenHarvest[][] public nameToCost; function addNameToCost(Ships.TokenHarvest[][] memory costs) public onlyOwner { nameToCost = costs; } The above code gives this error: Copying of type ...
0
votes
1answer
36 views

How o start code in Solana contract? [closed]

Hello guys try to code in Solana contract, but didnt know how to start it. Will be happy to any advise how to start :)) Thank u :) May be exist some video course in youtube or something like crypto ...
0
votes
1answer
17 views

Is it possible to create a crowdsale contract that instead of eth/bnb to buy tokens, token will be use to buy tokens?

Is it possible to create a crowdsale contract that instead of eth/bnb to buy tokens, token will be use to buy tokens? like swap token to token? This is my crowdsale contract: // SPDX-License-...
0
votes
1answer
12 views

Why is array.length giving "length" not found or not visible after argument-dependent lookup in mapping?

Here's how I defined an array of my struct: struct FoodItem { string name; uint price; bool available; } mapping(uint => FoodItem) public foods; Now I want to delete an ...
0
votes
1answer
39 views

Can someone please help me understand the params and sign requirement of this legacy rarible mint function? (ERC-721)

Below is a mint function from a legacy Rarible ERC-721 smart contract: function mint(uint256 tokenId, uint8 v, bytes32 r, bytes32 s, Fee[] memory _fees, string memory tokenURI) public { ...
0
votes
0answers
11 views

Uniswap fork: addLiquidity VM Revert error

I'm trying to fork uniswap in Remix, and I did those steps until now: Deployed core contract - uniswap factory Deployed WETH contract (got the code from WETH contract on https://rinkeby.etherscan.io/...
0
votes
0answers
18 views

What is new keyword instentiate in solidity and how can use it

I try to understand variable scope in solidity But what that mean in this example new keyword instentiate to a contract Whtat concept use in this logic can someone explain me pragma solidity ^0.5.0; ...
0
votes
0answers
9 views

Payment not showing up in wallet

I have the following solidity function that a wallet calls: function giveupStake(uint amount) public payable { if (initialStakes[msg.sender] >= amount) { initialStakes[msg....
0
votes
0answers
8 views

Can I use an existing (deployed) contract on ethereum mainnet instead of deploying myself? (NFT)

I'm trying to learn how to mint NFT's in an economic way. I have some experience with smart contracts but it's a while ago. I have looked for an answer to this question but could not find it. I have ...
0
votes
1answer
25 views

How to call method and send ether to it from web3? [duplicate]

Have this in solidity function claim() public payable nonReentrant { ...... require(mintingFee <= msg.value, "Not Enough Ether Required To Mint"); .... } Trying to call it ...
0
votes
0answers
14 views

Is it possible in Solidity to get the previous transactions of the current block?

When a transfer is being executed in a Solidity contract, is it possible to obtain the previous transactions that have occurred in the same block? Specifically I need the path of the previous ...
0
votes
0answers
14 views

Can I modify token to not to trade on exchange?

I don't want user to buy token from exchange they only can sell it from exchange. Actually I want user will buy it from my website using referral id and once they paid a fixed amount, it will ...
0
votes
1answer
92 views

How to integrate EIP-2981 with this basic ERC-721 contract

I'm looking to integrate these two things together into one contract for a basic 1/1 NFT. How exactly is this written together? Note they are two different compilers and they both need to be the same ...
0
votes
1answer
27 views

Constructor owner = msg.sender problem [duplicate]

I set a constructor in Solidity (currently 0.8.7) The code is in following address payable owner; constructor() public { owner = msg.sender; } But when i tried to compile the code, the Warning: ...
0
votes
1answer
52 views

Do I need to front the cost of gas to sell a collection of NFTs

Forgive me if this has been asked before, if it has please provide any resources so I can learn more! I'm having trouble wrapping my head around the development process of creating an NFT.Say I want ...
0
votes
1answer
20 views

What stops someone from flooding ethereum blockchain with infinite data?

If smart contracts can have arrays, and they are persisted in the blockchain, what mechanisms are there to avoid one malicious developer from uploading a smart contract having an array initialized ...
0
votes
1answer
54 views

swapTokensForEth transaction fail when called within a contract in a swap

I have this token test contract: The contract has a transaction tax of 1%. The transaction fee is converted to (myContractToken to bnb) and sent to a wallet. It is used the balance of the token that ...
0
votes
1answer
23 views

Is there any way to store data without fee in solidity

I wonder if there is any way to store data in smart contract which does not charge fees or can we use any external EASY data from smart contract. In my contract I have to update lots of fields on ...
0
votes
2answers
32 views

Decimal in Solidity [duplicate]

I'm new to solidity but I program in other languages, solidity looks a bit like javascript but recently I noticed a problem with solidity. it doesn't accept decimals and float numbers, like "0....
0
votes
0answers
11 views

How to call .increaseAllowance() from another token

I'm deploying a contract that is the owner of a token. In that contract i want to say that the token increaseAllowance to msg.sender and the amount that msg.send have putted in arguments of the ...
0
votes
1answer
42 views

Best security practices for contract deployment?

I'm using Truffle to develop an ERC721 smart contract. Truffle expects HDWalletProvider to be installed so that Truffle can sign transactions for you, however this requires storing your mnemonic ...
2
votes
0answers
40 views

Error! Invalid constructor arguments provided. Please verify that they are in ABI-encoded format, I tried (https://abi.hashex.org/) but still no luck

Good afternoon! I want to create a NFT and my code is working fine in remix. An error occurred while adding source code to ropsten: Error! Invalid constructor arguments provided. Please verify that ...
0
votes
1answer
10 views

Unhandled Rejection (Error): This contract object doesn't have address set yet, please set an address first

await contract.methods.set(98,"h").send({ from: accounts[0]}); I am trying to store uint and string but the error always came up: Unhandled Rejection (Error): This contract object doesn't ...
0
votes
0answers
35 views

'Error: invalid arrayify value (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.0.5)\n'

I have the following solidity function that I'm calling from truffle: function safeTransferFrom( address from, address to, uint256 id, uint256 amount, ...
0
votes
0answers
21 views

I am unable to publish and verify my contract on etherscan kovan test network. (Year 2021)

I am trying to publish my contract on kovan testnet but in the compiler output section, I am getting the same error again and again. I tried to do everything which was asked there, but couldn't find a ...
0
votes
0answers
21 views

How to addLiquidityETH in truffle console?

I'm trying to addLiquidityETH in truffle console but keeps running into ds-math-sub-underflow error. The pool pair is created at contract constructor and the wallet has more than enough for myToken ...
0
votes
0answers
15 views

Is it possible to remove the tokens from token contract address?

tHIS IS THE CONTRACT, Can thetoken from contract transfer back to owner/deployer address contract Token is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; ...
0
votes
1answer
27 views

How to make sure your contract is receiving ETH

I'm playing around with a test contract & am learning how to transfer & hold funds. I currently have a pool set up, which is set to receive ETH & nothing else. However, when writing my ...
0
votes
0answers
6 views

Eth2.0 and Eth1.0 contracts in the future

We are all waiting for the new eth. But I can't figure out if blockchains will be interoperable in the distant future? Imagine that I have created a TimeLockContract that will be exposed in 8 years. ...

1
3 4
5
6 7
230