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
1answer
26 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 ...
1
vote
0answers
57 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 ...
1
vote
2answers
66 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 ...
0
votes
1answer
18 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-...
0
votes
0answers
17 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....
0
votes
0answers
29 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\...
0
votes
0answers
25 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 ...
0
votes
0answers
20 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 ...
0
votes
0answers
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',...
0
votes
0answers
43 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 ...
0
votes
0answers
23 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 ...
0
votes
0answers
168 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 ...
0
votes
0answers
19 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 ...
1
vote
1answer
524 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
2answers
272 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....
0
votes
1answer
27 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 { ...
1
vote
0answers
70 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 ...
0
votes
2answers
163 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....
1
vote
1answer
906 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 '@...
1
vote
2answers
100 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 ...
1
vote
1answer
151 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) }
0
votes
0answers
89 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 ...
0
votes
0answers
54 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 ...
0
votes
1answer
33 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; ...
2
votes
1answer
54 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.
1
vote
1answer
43 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 ...
0
votes
1answer
24 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 (...
0
votes
0answers
35 views

How to deploy a smart contract? [duplicate]

I have the stupidest question. I have the source code of a smart-contract written in solidity. In Remix, it compiles normally, in the BSC test network, transactions pass. And actually, what to do next?...
0
votes
0answers
655 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 ...
0
votes
0answers
34 views

Vesting contract is throwing an error 'subtraction overflow'

I scripted a contract for token vesting taking clue from VestingVault.sol But when I run function addTokenGrant(), it throws an error of subtraction overflow. I believe the error is coming from ...
0
votes
0answers
19 views

Is it possible to derive multiple public addresses for a smart contract to receive ERC-20 tokens?

I have a smart contract that deposits user's fund in the AAVE lending pool on behalf of users: lendingPool.deposit(stableCoinAddress, amount, address(this), 0) Users can deposit at different times ...
1
vote
1answer
715 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 ...
0
votes
2answers
234 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 { ...
0
votes
1answer
1k 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 ...
0
votes
1answer
172 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 ...
1
vote
0answers
78 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 ...
0
votes
1answer
46 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; /** * ...
0
votes
0answers
55 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 ...
1
vote
1answer
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 ...
1
vote
0answers
36 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 ...
2
votes
1answer
491 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....
0
votes
0answers
22 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(...
0
votes
1answer
70 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....
7
votes
1answer
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 ...
1
vote
1answer
482 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 { ...
1
vote
1answer
26 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, ...
2
votes
0answers
254 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....
0
votes
1answer
277 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; ...
0
votes
1answer
320 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 ...
1
vote
0answers
768 views

When to use "memory" and "storage" keyword in solidity 0.6.0?

From what I've learned and noticed. Please add more point and rectify me if I'm wrong. Use of memory keyword 1)When initialising/declaring Struct, Array , and mapping. 2)In the parameters of functions ...