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
0 votes
1 answer
25 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; ...
user avatar
  • 1
2 votes
0 answers
22 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 ...
user avatar
  • 21
0 votes
1 answer
58 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 ...
user avatar
0 votes
1 answer
199 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 ...
user avatar
0 votes
1 answer
69 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 ...
user avatar
  • 62
2 votes
1 answer
187 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 ...
user avatar
1 vote
2 answers
239 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 ...
user avatar
0 votes
1 answer
66 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-...
user avatar
  • 105
0 votes
0 answers
35 views

iam getting brownie compiler error while running lottery in brownie test network

PS E:\smartcontract-lottery> brownie test --network mainnet-fork INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum Compiling contracts....
user avatar
0 votes
0 answers
50 views

i am getting value error while compiling brownie in python

brownie compile INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum File "C:\Users\scs\AppData\Local\Programs\Python\Python310\lib\...
user avatar
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 ...
user avatar
0 votes
0 answers
81 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 ...
user avatar
0 votes
0 answers
15 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',...
user avatar
0 votes
0 answers
135 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 ...
user avatar
0 votes
0 answers
24 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 ...
user avatar
0 votes
0 answers
394 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 ...
user avatar
  • 1
1 vote
0 answers
46 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 ...
user avatar
1 vote
1 answer
994 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 ...
user avatar
0 votes
2 answers
426 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....
user avatar
0 votes
1 answer
30 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 { ...
user avatar
3 votes
0 answers
108 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 ...
user avatar
0 votes
2 answers
348 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....
user avatar
  • 167
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 '@...
user avatar
1 vote
2 answers
149 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 ...
user avatar
  • 141
1 vote
1 answer
397 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) }
user avatar
  • 117
0 votes
1 answer
165 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 ...
user avatar
  • 13
0 votes
0 answers
125 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 ...
user avatar
  • 13
0 votes
1 answer
37 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; ...
user avatar
  • 13
2 votes
1 answer
101 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.
user avatar
  • 121
1 vote
1 answer
77 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 ...
user avatar
  • 41
0 votes
1 answer
29 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 (...
user avatar
0 votes
0 answers
840 views

How To Copy And Paste Token Code

i want to copy and paste this code and use it for my token just want to change symbol and everything . https://bscscan.com/address/0xf38acb6cea8f6701b06ec759f6cbc3fe23f377d3#code i try to post code ...
user avatar
1 vote
1 answer
1k 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 ...
user avatar
  • 105
0 votes
2 answers
512 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 { ...
user avatar
0 votes
1 answer
2k 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 ...
user avatar
0 votes
1 answer
287 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 ...
user avatar
1 vote
0 answers
99 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 ...
user avatar
  • 107
0 votes
1 answer
78 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; /** * ...
user avatar
  • 495
0 votes
0 answers
73 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 ...
user avatar
  • 1
1 vote
1 answer
2k 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 ...
user avatar
1 vote
0 answers
41 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 ...
user avatar
  • 626
2 votes
1 answer
1k 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....
user avatar
  • 626
0 votes
0 answers
27 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(...
user avatar
  • 97
0 votes
1 answer
121 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....
user avatar
  • 97
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 ...
user avatar
  • 258
1 vote
1 answer
807 views

Using inherited constructor in Solidity >=0.5.0

I want to use a contract inherit from another contract and use the parent constructor after using another commands in inherited constructor. So I wrote: pragma solidity ^0.5.10; contract A { ...
user avatar
1 vote
1 answer
32 views

Payable function that should not accept the money if X but still write changes

I have a function that is payable. Upon some checks, if it meet the condition, it should write some changes BUT refund the payable amount that was just sent. See: function rent(uint256 tokenId, ...
user avatar
  • 520
2 votes
0 answers
384 views

How to get event from geth ethereum node using web3.js

I have created a simple contract where I am trying to write a value to a state variable in solidity smart contract, and emit that written value. I am using Truffle v5.1.28 (core: 5.1.28) Solidity - 0....
user avatar
  • 21
0 votes
1 answer
396 views

Issue with dynamic matrices in solidity

I have a matrix in solidity like that string x[][] I'm trying to write functions to return rows and colums The following code works well: // SPDX-License-Identifier: unlicensed pragma solidity ^0.6.0; ...
user avatar
  • 31
0 votes
2 answers
516 views

Convert a string in scientific notation to a number

my smart contract uses an Oracle to retrieve the price. The price is returned as a string in scientific notation, for example, "3e-8". How I can convert this to number (uint)? The token has ...
user avatar
  • 217