Questions tagged [solidity-0.6.x]

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. Solidity version 0.6.0 is a specific version that includes a number of changes to the language and introduce new features.

Filter by
Sorted by
Tagged with
1 vote
1 answer
24 views

how to revert transaction excuted by low level call

Hello ethereum community. I'm experimenting with low level calls and i want to revert the transaction made by low level call, if i didn't get the desired result. Is it possible? (bool success, ) = ...
Biruk Damte's user avatar
0 votes
0 answers
73 views

Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545

Acutally I create a smart contract that the user create an auctions for things, so whenever some buyer come in website and see the acutions if he want to buy then he will create an offer. Same as if ...
Yasir Saeed's user avatar
0 votes
1 answer
260 views

While I was working on solidity project I got the following error

npx hardhat run scripts/deploy.js --network localhost is not working. It says TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider') My deploy script const hre = require("...
tikker's user avatar
  • 5
1 vote
2 answers
262 views

How do I withdraw/transfer USDC back into my wallet from my copied/created contract? [duplicate]

I copied/created a front running bot contract that has a WETH contract address. I made a mistake and sent USDC to the contract. Can anyone advise how to get the USDC funds sent back to my wallet ...
user113381's user avatar
0 votes
0 answers
26 views

Reverted Transaction For Any Adress (require not functioning as intended) in Solidity

I'm in the process of making a decentralized polling web app (relatively new to smart contract development). The idea is that a user connects their wallet via MetaMask, creates a poll or votes on a ...
user20295118's user avatar
2 votes
1 answer
3k views

Got scammed using bad code to create front running bot [duplicate]

I got scammed by bad code on a front running bot. I used the code in Remix, deployed it, and then sent money to it. (Put another way, I don't code, had no idea what I was doing, but decided to try it ...
Mighty Mike's user avatar
1 vote
1 answer
250 views

solc compiler --allow-paths fails

I'm trying to compile a contract using standard JSON through a script via the solc compiler CLI. I have a folder structure for storing the .sol files, the input JSON, and the compiled JSON output. No ...
pdmoerman's user avatar
  • 131
0 votes
1 answer
33 views

Looking for data in Smart contract

// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; contract Storage { struct People { uint256 personId; string vorname; string nachname; uint256 birthdate; ...
maxver's user avatar
  • 1
2 votes
0 answers
112 views

What's the purpose of single-variable expressions per line?

When doing the ethernaut exercises, I've stumbled upon some expressions that I don't know how to make sense of, like this; or _amount;. I don't understand what's their purpose since to me it doesn't ...
Piotr's user avatar
  • 21
0 votes
1 answer
214 views

i am getting list out of index error while trying to run my lottery smart contract with brownie

PS E:\lottery-smartcontract> brownie run scripts/deploy_lottery.py INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum ...
Kamal Shah's user avatar
2 votes
0 answers
114 views

ParserError: Expected '{' but got reserved keyword 'override' ) external override returns (bool) { ^------^

Can someone fix the code problem below? I compile in remix.ethereum.org , it show ParserError: Expected ';' but got '}' } external override The code: pragma solidity 0.5.8; /** Ropsten instances:...
funny cartoon's user avatar
0 votes
1 answer
499 views

I am getting a Source error when importing @Chainlink. My project will compile. How can I avoid this error, or should I just ignore it?

I do not know what the issue is as I am on version 0.6.6 Solidity both in my compiler and in my code, and I am using all of the same versions of the packages that Patrick used. I find it even more ...
Gray Blanchard's user avatar
0 votes
1 answer
170 views

solidity interface - Contracts calling unimplemented functions

I'm new to solidity and OOP. I'm trying to understand the code in this simple lottery game example: https://github.com/alphachainio/chainlink-lottery/blob/master/ethereum/contracts/ I am confused when ...
toddash's user avatar
  • 92
2 votes
1 answer
324 views

I am getting virtual machine error while running my brownie fundme contract

PS E:\brownie_fund_me> brownie run scripts/fund_and_withdraw.py --network ganache-local INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for ...
Kamal Shah's user avatar
1 vote
2 answers
309 views

i am getting rinkeby error while running my deploy_and_create.py in brownie python

PS E:\NFT-DEMO> brownie run scripts/deploy_and_create.py --network rinkeby INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum ...
Kamal Shah's user avatar
0 votes
2 answers
218 views

why do not I get an division error when I put 5/2 with the use assignment operator

I just found that when I do 5/2 with assignment operator, it does not give any error immediately and just give the result as 2 instead of 2.5. Would you please let me know why it is ? // SPDX-License-...
DHC's user avatar
  • 313
0 votes
0 answers
27 views

getting file not found error while running brownie deploy.py [duplicate]

PS E:\brownie_simplestorage> brownie run scripts/deploy.py INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum ...
Kamal Shah's user avatar
1 vote
0 answers
315 views

Two metadata hashes at the end of the bytecoe

doing my own research i saw that the metadata hash is added to the end of the bytecode and i can extract and decode it with cbor. I know that we can identify them by different ways, in this case with ...
Víctor Hernández's user avatar
0 votes
0 answers
17 views

Solidity array address delete remains Zero address [duplicate]

i have an array address[] allAssets which holds list of addresses and it is populated with [ '0xc778417e063141139fce010982780140aa0cd5ab', '0xaD6D458402F60fD3Bd25163575031ACDce07538D',...
vinod tonda's user avatar
0 votes
0 answers
543 views

Return JSON from view function

I'm trying to find the "best practice" to return a JSON formatted string from a view function. Basically, I plan to loop through a set of data stored in contract state, build it all into a ...
pdmoerman's user avatar
  • 131
0 votes
0 answers
28 views

How do i get the price of an erc20 token from solidity smart contract [duplicate]

I'm building a dapp, i'm trying to get the erc20 token price in usd from my smart contract how do i go about this? this is very necessary as smart contracts cannot read from outside networks. I don't ...
Benjamin's user avatar
1 vote
0 answers
624 views

How to send ether to call fallback function

Im currently working on a project which can create a uniswap liquidity pool on the fallback function however the transaction is not even broadcasted to the blockchain when trying to send some ETH via ...
Felix's user avatar
  • 11
1 vote
0 answers
75 views

Getting the same hashes on the web3 and Solidity side

How can I repeat this operation on web3.js and get the same hash function test(uint a, uint b) pure public returns (bytes32) { bytes32 hash = keccak256(abi.encodePacked(uint40(a), b); return ...
Dmytro Slutskyi's user avatar
1 vote
1 answer
2k 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 ...
user2983041's user avatar
0 votes
2 answers
599 views

I wonder where this hack started from

before I start, let me first give you the txn history. https://polygonscan.com/tx/0xc7927d4a8b0549dfd650eeab8b9570195d8fb9161884785e9b328c04b6a49232 And also adding my Metamask adress history for WETH....
0xstackexchange's user avatar
0 votes
1 answer
39 views

Alter data in a struct using solidity

I am trying to create a students record using remix I am trying to replace data from an already stored struct. How can I do that? Below is my implementation untill now. contract StudentContract { ...
Andrei Cristodorescu's user avatar
3 votes
0 answers
181 views

Include library function without function body

Using solc 0.5.0 it's possible to compile a contract that has a library function implemented with no body. For example: library Hasher { function MiMCSponge(uint256 in_xL, uint256 in_xR) external ...
GeraldHost's user avatar
0 votes
2 answers
714 views

How to generate Natspec docs using version 0.6.x of the Solidity compiler

I'm trying to run solc --userdoc --devdoc myContract.sol to generate natspec. However, the compiler complains that the contract has a different pragma-version. In fact the contract pragma is at ^0.6....
Marlo's user avatar
  • 297
3 votes
1 answer
2k views

NotFoundError: Key not found in database [hn]

I'm playing Ethernaut (https://ethernaut.openzeppelin.com/). I'm currently on level 3 (Coin Flip). This is the Coin Flip contract: // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import '@...
António Gonçalves's user avatar
1 vote
2 answers
188 views

Getting an error even using the same compiler version (Visual Code)

I made a contract using Remix and it's working perfectly. When I create a project in Visual Code (in order to make a DApp) I'm getting this error when I import a source of Chainlink: If I compile ...
Joncarre's user avatar
  • 281
2 votes
1 answer
1k views

What is the ':= ' operator?

I am familiar with the walrus operator := in Python but cannot understand its use in solidity. A sample snippet is : assembly { codehash := extcodehash(account) }
Pe Dro's user avatar
  • 127
0 votes
1 answer
303 views

TypeError: No matching declaration found after argument-dependent lookup

How do I fix this? TypeError: No matching declaration found after argument-dependent lookup. require(instance.execfunct(address(this),2100,gaslimit,hex"00")); ^-----^ Candidate: function ...
garm's user avatar
  • 13
0 votes
0 answers
182 views

ParserError: Expected ';' but got '{'"?

ParserError: Expected ';' but got '{' aion.ScheduleCall{value:callCost}( block.timestamp + 1 minutes, address(this), 0, 200000, 1e9, data, true); pragma solidity ^0.6.0; contract Aion2 { using ...
garm's user avatar
  • 13
0 votes
1 answer
45 views

I read the description, but I don't understand it. Thank you for every day

ParserError: Expected type name function execfunct pragma solidity ^0.6.05; abstract contract AionClient is Aion, Context, Ownable{ using SafeMath for uint256; address private AionAddress; ...
garm's user avatar
  • 13
2 votes
1 answer
290 views

delegatecall call internal functions from caller contract

Is it possible to call internal functions from a function called using delegatecall? Contract A call contract B using delegatecall, contract B needs to call an internal function from contract A.
Steffel's user avatar
  • 121
1 vote
1 answer
223 views

call method in compiler 0.8

how can i change this for older compiler versions like 0.4.24? (bool success, ) = transaction.to.call{value: transaction.value}(transaction.data); and if you have time please explain to me the call ...
ali's user avatar
  • 41
0 votes
1 answer
50 views

Error Occurred while changing compiler version

below is my contract with compiler version >=0.6.0. when I change the compiler version ^0.8.2 I am getting error as: Return argument type address is not implicitly convertible to expected type (...
Prabhakaran Mathiyalagan's user avatar
1 vote
1 answer
2k views

How to call a function in parent contract from children contract?

I am new to solidity.. please bear with my foolish question I would like to get the variable called num in a parent contract from its children. So, what I have in my mind is to try to get the address ...
DHC's user avatar
  • 313
1 vote
2 answers
843 views

How to I initialise an array inside the contructor in solidity?

I'm using the remix IDE.I want to define the size of the array at the time constructor is called. Someone please help. This is what I tried : pragma solidity >=0.7.0 <0.8.0; contract Vote { ...
Vasvi Sood's user avatar
0 votes
1 answer
3k views

getting data from events

versions: solidity 6.0.0 python3.8 web3 5.13.1 I am trying to get return data from a smart contract function that changes a struct on the contract. I cannot do that using return because the ...
will3dev's user avatar
1 vote
1 answer
554 views

Hyperledger Besu: Unable to decode the hex string returned by solidity function containing multiple values

I have set up a Hyperledger Besu network for private transactions using Orion. I am using a javascript client to write to and read data from a smart contract written in Solidity. I am following the ...
Christian Schepp's user avatar
1 vote
0 answers
145 views

TypeError: Library functions must be implemented if declared for solc compiler version ^0.6.0 library implementation

Suppose I have the following code: // SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <0.7.0; library SomeLib { function add(uint256 a, uint256 b) public returns(uint256); } contract ...
user76333's user avatar
  • 167
0 votes
1 answer
151 views

Sending Ether between two contracts not working

I am trying to transfer some Ether between two contracts but it is just not working for me. Here is my code: pragma solidity ^0.6.0; contract ContractA { uint public tips; /** * ...
Donut's user avatar
  • 537
0 votes
0 answers
93 views

amount of gas used in receive and fallback functions in truffle tests

I have a contract that is written in solidity ^0.6.4 and has a simple implementation of reverting funds when someone directly transfers some eth or calls an unhandled function. Now it appears to be ...
Mehrad's user avatar
  • 1
2 votes
1 answer
3k views

How to deposit to WETH in Solidity 0.6 and above?

Solidity 0.6.0 introduced a breaking change in how ETH transfers are performed. The following doesn't work anymore: weth.deposit.value(amount)(); What is the latest syntax for depositing ETH into the ...
Paul Razvan Berg's user avatar
1 vote
0 answers
50 views

What's the difference between this.function() and function() in recursion?

I stumbled across some odd behavior that I can't explain regarding recursive functions in Solidity. As a note, I have attempted to run this on ganache in case it is actually ganache that is throwing ...
Shiri's user avatar
  • 766
5 votes
1 answer
2k views

Calling super class external functions

Is there a way in Solidity to call super class external functions? Normally with inherited contracts, when overriding inherited functions you can also call the original function logic with super....
Shiri's user avatar
  • 766
0 votes
0 answers
32 views

Issuing 1-1 eth for token problem

pragma solidity 0.6.6; // import "./XYZToken.sol"; contract Vault { mapping(address => uint256) balanceOf; mapping(address => bool) hasDepositedEther; mapping(...
Lucus's user avatar
  • 107
0 votes
1 answer
206 views

Transfer funds to inherited smart contracts [closed]

How would I make this work - the balanceOf[Pool, System + Cube] doesn't seem to work ;-; // SPDX-License-Identifier: GPLv2 pragma solidity ^0.7.0; import "./Pool.sol"; import "./Cube....
Lucus's user avatar
  • 107
7 votes
1 answer
2k views

How to import both VRFConsumerBase and ChainlinkClient in same contract

I would like to use 2 of the functionalities of Chainlink, One is VRF and another is making API requests. So I am importing two libraries together. ChainlinkClient.sol and VRFConsumerBase.sol Which ...
Jeevanjot's user avatar
  • 258