New answers tagged

0

I got confused in the explanation, but I believe what you're trying to achieve is reading and updating the state of the parent contract from child contract. Here is how you can achieve it: pragma solidity ^0.6.0; contract parent { uint public num; function setValue(uint _value) public { num = _value; } function ...


1

Just for the others who might be facing the same issue (it took me quite a while to fix it). The problem I faced was that I was calling function addLiquidityETH() without sending the ethers to Uniswap smart contract, so {value: msg.value} has to be added to the call: uniswap.addLiquidityETH{ value: msg.value }( token, amountTokenDesired, ...


1

Just add calldata to the parameter. So the signature should be: function performBonusCredit(string[][] calldata _toPayArgs) external payable { You can read more about these data location markers here: https://docs.soliditylang.org/en/v0.8.0/types.html#data-location


0

You can look at the function's parameters bid(bytes32 _blindedBid), it's a bytes32 type. An example of a valid bytes32 value is 0x6b5fc80c91d15ca5b4cf5b965ce20114777022aec8a50912bacde96a9558b22e. But yeah, you need to pass in a bytes32 value that makes sense to you. You can find some comments written above the bid function in the code, they are to guide you ...


0

Easy way: https://cointool.app Harder way: Source code: https://github.com/rstormsf/multisender/blob/master/contracts/contracts/multisender/UpgradebleStormSender.sol function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable { uint256 total = 0; require(_contributors.length <= arrayLimit()); ...


0

You probably need to activate the plugin first. Go to the plugins tab (second icon in the menu on your screenshot), under "Inactive Modules" search for "Solidity compiler" and "Deploy & run transaction" and activate them. Then the other tabs should show up in the menu bar.


0

I faced the same problem, try changing the compiler versions, it worked for me.


1

Solidity enables constructors which have code executed at contract creation. So you need to instantiate owner in the constructor to catch the contract deployer address : address payable owner; constructor() public { owner = msg.sender; } There are also standardized contracts to manage ownership. Exemple of implementation can be found here : https://github....


0

I was facing same issue once dealing with ganache. Make sure to keep same gas limit on ganache-cli and remix IDE. Things to do: If you haven't installed ganache-cli, please try following command. npm install ganache-cli Then navigate to your account by using following command. ganache-cli -a Then you could get gas limit and make sure keep same gas limit to ...


0

In both requestTransfer and confirmTransfer you are modifying a object in memory Transfer memory transfer = transfers[transferId]; .. transfer.buyer = msg.sender; transfer.seller = seller; transfer.fromAccount = fromAccount; .. Memory is transient and at the end of the transactions it is erased. To persist the ...


0

Use explicit type conversion: return address(0x00);


0

I got the answer, you have to pass the full length address to remix. even if it is an address or 0x0 in this case it will be : 0x0000000000000000000000000000000000000000


0

After this: require(voter[msg.sender].voterRStatus == false); Add this: voter[msg.sender].voterRStatus = true; As an improvement suggestion, consider changing this: Voter[] public voters; To this: address[] public voters; And this: voters.push(Voter(_name,_age,false,msg.sender,true)); To this: voters.push(msg.sender); Since voter[voters[i]] gives you ...


1

Your array is composed of Proposal but you are trying to push a 0 into a struct member. You can only push a Proposal on to an array of Proposal. Try this: pragma solidity 0.7.6; // SPDX-License-Identifier: UNLICENSED contract Vote { struct Proposal { uint votecount; } Proposal[] proposals; constructor(uint ...


1

The Proposal[] proposal declaration in your code is of a storage array. As such, you don't need to initialize it with proposal = new Proposal[](...);. You can simply push into it as many items as you'd like. The only thing actually missing there is an access-level (public/internal/private). As with regards to your push attempt, simply change this: proposal....


1

Just to add into Shane's answer, if you are testing with ganache-cli, you can also do this: const ganache = require('ganache-cli'); const Web3 = require('web3'); const options = { a: 100 }; // NO OF ACCOUNTS const provider = ganache.provider(options); const web3 = new Web3(provider); I hope that helps.


0

Remix stores your code but not in plaintext. If you can't find your code, I may ask you what browser you've used and if you have adblock & anti trackers that clean your storage once in a while. Alternatively, maybe it's just a bug. If you used Chrome we can find out about the solution fast. Open the Chrome Developer Tools by pressing F12 on Remix page, ...


0

You can use either this: address[] public players; ... players.push(msg.sender); ... payable(players[index]).transfer(...); Or this: address payable[] public players; ... players.push(payable(msg.sender)); ... players[index].transfer(...);


Top 50 recent answers are included