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

Getting an Invalid Address error when trying to interact with smart contract in truffle express box

I have a function where I insert patient's info into a mapping and it works perfectly fine on remix and in the truffle console. function createPatient (uint _SecretNum, string memory _name, uint _dob, ...
user avatar
0 votes
0 answers
6 views

Why am I not able to call a pure function accessing an enum from a library?

I'm working on a token-gated NFT distribution site. I've divided up the 256 bits of the token id & I'm using various parts to represent different aspects of a permissioning system. Central to the ...
user avatar
  • 101
0 votes
0 answers
8 views

How to approve or give permission to access your tokens? Solidity /Metamask?

I'm currently creating a Dex which needs 1inch permission to access the users to tokens/funds. e.g The problem is permission doesn't show up but instead shows 'contract deployment': my current is ...
user avatar
0 votes
0 answers
4 views

Solidity event doesn't include args

I'm emitting an event from a Market.sol contract with three indexed args but they aren't showing up in my frontend after calling the contract function. Contract code: event MarketTokenEvent ( ...
user avatar
0 votes
0 answers
5 views

"Contract should be marked as abstract" but I removed the missing function from interface, still doesn't work

I have seen some of the other threads on this error, but none of them seem to offer the solution I need. I am playing around with the Aave v2 source code, and the AToken contract gets an error saying ...
user avatar
0 votes
0 answers
6 views

Hardhat project can't compile despite using the correct compiler version

I am playing around with the source code for Aave v2 and I can't get any of the contracts to compile using hardhat. Most of the contracts are written using solidity version 0.6.12 so I changed the ...
user avatar
0 votes
0 answers
2 views

How to interpret return after calling a function which returns bool in smart contract solidity

I have a newbie question about return of function call. The call was made with ethersjs 5.6.x and function is in solidity smart contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; ...
user avatar
0 votes
0 answers
7 views

Why are protocols like Sushiswap using multiplier 1e10 instead of 1e18?

I've been reviewing a protocol that utilizes MULTIPLIER for their calculations which increases the precision because there are no decimal numbers in solidity. That is fine, but I've seen a lot of ...
user avatar
  • 48
0 votes
0 answers
11 views

TransferFrom Error - "not visible after argument-dependent lookup in contract Token"

I'm calling a transfer, transferfrom, approve contract following the open-zeppelin ERC20 source. I got not found issues. Maybe I'm omitting something. My Code: token.sol //SPDX-License-Identifier: MIT ...
user avatar
1 vote
1 answer
21 views

What are the most widely used open source DAO frameworks?

I am currently researching what are the best open-source on-chain Governance Tools out there (for beginners / intermediates). I was researching something similar in 2016 / 2017 but I remember the ...
user avatar
  • 66
0 votes
0 answers
15 views

Why does msg.value not value when coding with solidity?

Disclaimer I am very new to coding and trying my hardest to break into this space. However, I am having issues with msg.value. On my version of solidity, I have had a lot of issues msg.value. I am ...
user avatar
0 votes
1 answer
23 views

Governor: proposal not successful

Sorry, I think it's a basic question but I've been trying to solve it for days. I'm learning to create a DAO. I'm following the OpenZeppelin documentation. I created all my contracts using the OP's ...
user avatar
0 votes
0 answers
10 views

Decode number of tokens and token contract address from msg.data (ERC-20)

I have a smart contract with just a fallback function and some logic. I want users to send their tokens directly to the smart contract to do some smart contract logic on receive. I've implemented ...
user avatar
0 votes
1 answer
6 views

Contract via proxy missing functions

I thought that proxy simply uses delegate call to the implementation contract. So the way I see this, is that I can run the same method in proxy and in implementation. However, I did deploy my ERC20 ...
user avatar
  • 78
0 votes
1 answer
13 views

How to get the last element of an array in solidity?

How do i get the last element? I feel like i should use .length, but then what? PLease help! I'd really appreciate that! Thanks in adnvance pragma solidity 0.8.0; contract Players { address[] ...
user avatar
0 votes
0 answers
8 views

Updated Question - Any alternative to while loop in conditional scenarios in solidity?

Referring to the question already posted here. Hi... The previous answer worked for me as posted above... So extending that now I have an updated scenario for a similar situation. Now I am trying to ...
user avatar
0 votes
0 answers
3 views

Find current owner of Token on Etherscan using API

I am trying to find the current owner of the NFT TOKEN Id using etherscan API. The token has multiple transfers on various users. I want to know who is currently owning that NFT token id. I tried with ...
user avatar
  • 105
0 votes
1 answer
5 views

Fakes on OpenSea

Recently, our team faced a small problem. We made an announcement of the collection and showed several nfts. Soon, fakes of our collection and our profile appeared on OpenSea. How to resist this ? ...
user avatar
0 votes
1 answer
8 views

How to define a constant `bytes32` in Solidity v0.8 and above?

I want to define a constant bytes32 like this: bytes32 internal constant FOO = bytes32(0x01); But I'm getting the following error when compiling the code above: Explicit type conversion not allowed ...
user avatar
0 votes
0 answers
5 views

Deployment of the Open sea contract

I want to host my nft collection on OpenSea, how do I do it? Please share guides, links or your experience) Thank you very much in advance
user avatar
1 vote
0 answers
13 views

Contract verification. How can I check contract already verified or not (with code)?

I use: await hre.run("verify:verify", { address: CONTRACT.address, constructorArguments: [ARGUMENT] }); but sometimes it returns: Reason: Already Verified I want to ...
user avatar
  • 11
0 votes
2 answers
8 views

How can I get the price of NFT on Opensea using chainlink?

I have tried to use the chainlink and contract address of NFT to fetch the price but I am not sure where I am wrong pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/interfaces/...
user avatar
0 votes
1 answer
13 views

Can We Transfer Token to The HighestBidder Automatically in NFT- MARKETPLACE Contract? i want this auto

i have A claim Function , when highest bidder call the function After auction times end , but i want this auto , when auction times end nft automatically transfer to the highest bidder : kindly help ...
user avatar
0 votes
3 answers
20 views

Transfer contract ownership from one contract to another

I'm a newbie here so take it easy. My setup is that I'm trying avoid redundancy. I have 2 contracts: 1 = Factory.sol 2 = Project.sol The factory creates new projects which is initiated by the user. As ...
user avatar
1 vote
0 answers
12 views

How does Solidity implement C3 linearization?

The solidity documentation does not offer a lot of insights into their implementation of the C3 linearization to resolve methods in a multiple inheritance scenario. There it states that You have to ...
user avatar
  • 177
0 votes
0 answers
16 views

Remix is not loading all the methods of my SmartContract

I'm very new to ERC20, ERC1155, SmartContracts, Remix, etc, so please forgive me if my question is quite stupid. I've created an RC1155 SmartContract in Remix, with several methods. When I publish it ...
user avatar
0 votes
0 answers
7 views

Error: The transaction has been reverted to the initial state

Here is My Simple Payable Contract Code: // SPDX-License-Identifier: MIT pragma solidity 0.8.15; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract ...
user avatar
0 votes
0 answers
37 views

What are the tests that can be or should be written for this smart contract? [closed]

I have the following contract for a dutch auction with a specified function to get the price at any given point. // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/...
user avatar
0 votes
0 answers
11 views

fetch the event data in the console

please what should I put inside the console.log() to fetch the 2 returned addresses of the event(args[0], args[1])? and thank you! const filter = { address: '0xbc4...', topics: [ ...
user avatar
  • 3
0 votes
0 answers
4 views

how to extend ERC20 Token to ERC20Capped

I have been trying to Update ERC20 Token to ERC20Capped token how can I do this ? I have been using Openzepplin documentation
user avatar
  • 21
0 votes
0 answers
11 views

Can We Transfer Token to The HighestBidder Automatically in NFT- MARKETPLACE Contract?

This is bidding function : function createBidOnItem( uint256 itemId ) public payable nonReentrant { uint price = idToMarketItem[itemId].price; uint tokenId = idToMarketItem[itemId]....
user avatar
0 votes
2 answers
8 views

How IncreaseAllowance and DecreaseAllowance function solve mitgation problem?

I was going through openzeppline code for ERC20 Token and found that While working with approve function in IERC20 interface they describe mitigation problem : Link I don't understand how ...
user avatar
  • 21
0 votes
0 answers
6 views

How to deploy Ethreum Smart Contract on Kava Testnet using kavatools?

suppose I have a contract and want to deploy it on Kava testnet pragma solidity ^0.8.0; contract MessageContract { string message = "Hello World"; function getMessage() public constant ...
user avatar
0 votes
1 answer
16 views

Calling mint function from UI causes Error minting character Error: cannot estimate gas

im testing a contract but cant seem to get it to work from the ui. the hardhat task works after adding the value property, but not sure how to implement it when minting from the ui. hardhat task: task(...
user avatar
  • 1
0 votes
0 answers
8 views

Can't Receive Payments in Remix

I am trying to run SimplePaymentChannel as shown on the solidity docs in remix. I have made some modifications to the code so that it is essentially just a transfer or money. I deploy the contract ...
user avatar
  • 1
0 votes
0 answers
11 views

ProviderError: execution reverted using hardhat deploy plugin

I am working on a mini-version of a DEX and I am using the hardhat-deploy plugin. I was trying to test my createNewPairing method and ran into this error: AssertionError: Expected transaction to be ...
user avatar
0 votes
0 answers
11 views

What is keccak256 in Solidity? [duplicate]

I’ve been having a rough time trying to understand how to use it. I know that this function takes in any amount of inputs and converts it to a unique 32 byte hash. I just don’t understand when when ...
user avatar
0 votes
1 answer
13 views

Verify that a method call is initiated from a specific Smart Contract

As my smart contract is >24k, I read that I need to break it into multiple (smaller) smart contracts. So, my current design is to have a Core contract that has all the data in arrays. This Core has ...
user avatar
1 vote
0 answers
7 views

NFT2.0 from coding point of view

Can anyone explain NFT2.0 from a coding(Solidity) point of view? or introduce a source.
user avatar
0 votes
1 answer
49 views

Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)

I was doing the Patrick Collins tutorial and link got this error Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2) when I was ...
user avatar
  • 15
0 votes
1 answer
18 views

Why does Web3j listen to events every 15 seconds?

I use web3j in my Java application. In the smart contract, an event is defined. event sendEvent(string name); I subscribed to that event in my app. contract.sendEventEventFlowable(filter) ....
user avatar
1 vote
1 answer
17 views

How does Chainlink deal with faulty/malicious nodes?

I am trying to understand how chainlink, or any oracle solution for that matter, can deal with a node not providing accurate data. How would you detect that the data is faulty to begin with, and how ...
user avatar
  • 113
0 votes
1 answer
15 views

What is the difference between:= and : in Solidity?

I’ve been having a hard time trying to figure out the difference between “:=” and “=” in Solidity. I keep on thinking it is the same thing but I’m not sure about it. Can you please tell me the ...
user avatar
0 votes
0 answers
12 views

How would I access a variable defined in solidity from my `JS` script

I am trying to write test for a function addPerson() that takes stirng name and uint256 favNumber and creates a People object and add it to the people list, this addPerson() is defined in Solidity and ...
user avatar
0 votes
0 answers
9 views

storage to storage value type assignment

pragma solidity 0.8.15; contract DemoStoragetoStorageValueTypeAssignment{ uint stateVar1 = 20; uint stateVar2 = 40; function getUInt() public returns (uint) { stateVar1 = stateVar2; ...
user avatar
0 votes
0 answers
11 views

_disableInitializers() vs initializer vs reinitializer(uint8 version) in Openzeppelin/contracts-upgradeable?

Initializable.sol provides an initializer modifier and a _disableInitializers() internal function. I need help in understanding why a _disableInitializers() might be needed if we already have a ...
user avatar
0 votes
0 answers
8 views

Passing transaction origin address from one contract to another without use of tx.origin Solidity

I am currently working on a project that the user will buy/sell Contract A and receive another token from Contract B. Contract B is a crowdsale contract of a 0 value ERC20 token used as proof of ...
user avatar
0 votes
1 answer
8 views

Loading data from JSON files to a smart contract

I am new to solidity blockchain. I have transaction dataset in JSON files. I want to load it automatically to blockchain using ethereum solidity in https://github.com/itzmeanjan/merklize-sha. How can ...
user avatar
0 votes
1 answer
27 views

Call to contract doesn't work when sending a merkle proof (using ethers & JS)

I basically have a contract whose mint function looks like this: function mint(uint256 _mintAmount, bytes32[] calldata merkleProof) public payable isValidMerkleProof(merkleProof, ...
user avatar
  • 1
0 votes
0 answers
8 views

Reading return data from a Solidity `call`

Given a call to an external contract, (bool success, bytes memory returnData) = addr.call(abiEncoding); how do I read a single value of a given type from the return data, without using assembly? The ...
user avatar

1
2 3 4 5
296