Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 10 2017 22:42
    @jpitts banned @etherchamp1_twitter
  • Jun 05 2016 10:33
    @chriseth banned @adamskee
Joseph Cardwell
@Joseph-Cardwell
0x8EE4899534A83774EE2DF97ECC496c11d3a2B660
Sehrish Shafeeq
@sehrixhshafeeq
Hello, I want to run the same loop over two different arrays; each time only the array it is running on changes. How can I write it forexample “for (uint256 i=0; i<array1.length; i++)…” each it changes forexample to array2, array3 etc.
1 reply
Gabriel Moraes
@Gabrielmoraesp
Hello guys.
I need to send 1000 tokens to 5000 wallets.
Is it possible to create a contract where it is possible to make this shipment only once?
chriseth
@chriseth:matrix.org
[m]
usually, you don't really send the tokens. instead you create a specialized erc20 token that "knows" that these changes have taken place
so it is possible, but it's rather expensive
Hasiib Ali
@HasiibAli_twitter
Hello, Can anyone assist me on what is an interface?
Naz Kulinich
@galliaCodeWorld
how to get maxfeepergas eip-1559 in solidity?
Michael Roche
@Michael78065695_twitter
@HasiibAli_twitter an interface in solidity is function which only returns output usually external or public or even private this type of func cannot be used to change state variable but can return current state of the variables for instance your getBalance func is an interface which returns the current balance of an account after a transactions. You can also check for more on the documents on solidity website for more details on interface.
Tom
@EmmanuelTom

I'm having this error on v 0.6.0

project:/contracts/Item.sol:21:56: ParserError: Expected ';' but got '{'
(bool success, ) = address(parentContract).call{value: msg.value}(abi.encodeWithSignature("triggerPayment(uint256)", index));

6 replies
image.png
Please how can i fix this?
S0AndS0
@s0ands0:matrix.org
[m]

@EmmanuelTom: Tip, use triple back-ticks to post pre-formatted text instead of screen-shots; many clients even understand MarkDown fenced code-blocks, eg.

receive() external payable {
  require(msg.value == priceInWei, "We don't support partial payments");
  require(paidWei == 0, "Item is already paid!");

  paidWei += msg.value;

  (bool success, ) = address(parentContract).call{ value: msg.value }(
    abi.encodeWithSignature("triggerPayment(uint256)", index)
  );

  require(success, "Delivery did not work");
}

... As for the error, based on provided code it seems there is a missing function key-word, and I recommend the following patch;

- receive() external payable {
+ function receive() external payable {
2 replies
aathan
@aathan
@s0ands0:matrix.org that's incorrect. Each contract may have exactly one receive ether function, and the declaration is correct as is (see https://docs.soliditylang.org/en/latest/contracts.html#receive-ether-function)
Tom
@EmmanuelTom
Okay, thank you @aathan
aathan
@aathan

@HasiibAli_twitter The answer provided by @Michael78065695_twitter is not quite correct. Maybe he is speaking in general terms, however, I believe you are specifically asking about an interface such as:

interface ISomething { function someFunction(...) external; }

These are language elements that allow you to specify a set of functions that together define the "interface" called ISomething. This basically means "in the world, there exist contracts that have the following set of functions, and I am going to call those types of contracts ISomething".

Later in the code, if you have an address a that you know has those functions, you can say ISomething(a).someFunction(...);

In other words, by defining the "interface ISomething..." you can later tell the Solidity compiler that some address is an ISomething. You can also later declare that a given contract implements that interface. This helps the compiler create the right code to actually make the calls you need, and know the correct types for the arguments and return values.

https://docs.soliditylang.org/en/latest/contracts.html?highlight=interface#interfaces

Hossein Shahmohammadi
@imhshahdi
hi
I have two or three questions, thank you for your help.
How many methods do we have to keep String type in Solidity?
Explain the Visibility Quantifiers in Solidity language in detail
Michael Roche
@Michael78065695_twitter
Thank you sir, the learned one I'm blessed by the insight you gave @aathan
Michael Roche
@Michael78065695_twitter
@aathan please explain these terms and their application in solidity 1) interface, 2) libraries. 3) can you provide a conceptual guide on how these applications interact to assist in implementing a functional DApp with included benefits on how to factor codes for less gas fees. Don't mind how big the question is do your best please.
1 reply
Please anyone can contribute their own idea to the question please. Solidity is a nut tough hard to crack and going crazy ready docs and white papers, red and litmus papers to get around it. Thanks a lot
Please anyone can contribute their own idea to the question please. Solidity is a nut tough hard to crack and going crazy ready docs and white papers, red and litmus papers to get a
around it
McRoche764
@McRoche764
So you'll have to figure out it's application through research and learning and asking questions
Lucien Loiseau
@Marlinski
hey folks, using remix solidity unit testing, how can I check assert that a tx actually fails given wrong input ?
1 reply
it really frustrates me to have unit test failing even though it is expected behaviour :)
actually just found the answer, using try atch
0xRAS
@0xRAS

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.9.0;

contract Boolean {

string public gender1 = "Male";
string public gender2 = "Female";

function nameGender(string memory _name1, string memory _gender1) public {

string memory name1=_name1;
string memory gender1=_gender1;

}

function verifyNameGender() public view returns (bool) {
if ((string memory name1) == (string memory gender1)) //Facing error here in remix please guide.....................
return true;
else
return false);
}

}

aathan
@aathan
if (name1 == gender1) //Facing error here in remix please
Iuliu Horga
@iuliu.horga:devtelsoftware.com
[m]

hi guys. i'm trying to synchronize a full geth node and after 3 days of synchronizing in a 2TB Samsung SSD with great internet connection, I'm at ~40%.

> eth.syncing
{
  currentBlock: 5793255,
  healedBytecodeBytes: 0,
  healedBytecodes: 0,
  healedTrienodeBytes: 0,
  healedTrienodes: 0,
  healingBytecode: 0,
  healingTrienodes: 0,
  highestBlock: 14790910,
  startingBlock: 5304492,
  syncedAccountBytes: 0,
  syncedAccounts: 0,
  syncedBytecodeBytes: 0,
  syncedBytecodes: 0,
  syncedStorage: 0,
  syncedStorageBytes: 0
}
> console.log(100* eth.syncing.currentBlock / eth.syncing.highestBlock);
39.17067306879699

INFO [05-17|09:29:38.349] Imported new chain segment               blocks=31   txs=4463  mgas=203.282  elapsed=8.306s      mgasps=24.474  number=5,794,214 hash=3745fa..1d1606 age=3y11mo3w  dirty=1021.34MiB

INFO [05-17|09:29:46.362] Imported new chain segment               blocks=40   txs=4918  mgas=243.038  elapsed=8.012s      mgasps=30.331  number=5,794,254 hash=cd2e9c..d409eb age=3y11mo3w  dirty=1020.20MiB

any idea why this is taking soo long?....

Aniket
@Aniket-Engg
Hi Solidity Team
5 replies
Can you suggest what are the valid values of output selection for the setting: stopAfter: "parsing",
Phy740708
@Phy740708
Why is my remix ide installed locally and the browser starts with only one logo.
aathan
@aathan
Is the most efficient way to do a fifo in solidity, basically a mapping(uint => thing) and uint tail;uint head; ?
3 replies
cameel
@cameel:matrix.org
[m]
But yeah, there's no built-in data structure other than the mapping that would let you remove elements from both ends. You'd have to implement an appropriate data structure yourself.
I'm assuming you'd like it to be efficient, i.e. avoid having to copy all elements once you remove the first element.
You could actually implement something like this with assembly. But you'd have to manually manage storage pointers.
I.e. you'd put it at a random address in storage and then you'd be free to manually erase stuff also from the beginning.
11 replies
lucasjames666
@lucasjames666:minds.com
[m]
0xd868B4d72eaD84FCE6256a4f1f17d48c67621858
Rodrigo Cruz
@rodrigocruzy_twitter
@lucasjames666:minds.com give me some eth: 0x4fD65FA321B558Ff62f8dC9cE26cCCe22Cc89278
Mert YILMAZ
@yilmazmertm
Hey everyone , is there a reason to use some old solidity version ? arent new versions always better and fixed ? Can you give some spesific situation for me to understand. Im a newbie so dont judge.
2 replies
plaaz
@sparkandflash
hello, is there a function to compare an address to an array of addresses like in javascript
4 replies
require(msg.sender == citizens);
where citizens is an array of addresses
cameel
@cameel:matrix.org
[m]
Like, you have a much higher chance of randomly generating a private key matching someone's address (there are only 2^160 addresses) than hitting any given slot (there are 2^256 slots).
Usually there are many occupied slots but that's still a minuscule number compared to their total number.
adhusson
@adhusson
Is there a way to use some pure yul code from within solidity?
5 replies
(not inline assembly but strict assembly)
cameel
@cameel:matrix.org
[m]
Unfortunately no. You cannot import .yul files because they do not have all the semantic information the compiler needs at the Solidity level.
Just curious - what are you trying to do? Maybe there's some other way to achieve it.
aathan
@aathan

Am I forgetting some basic syntax? I've initialized s.slot of some Struct storage s via yul. There doesn't seem to be a convenient way of expressing a storage reference variable as a contract scope storage variable. Am I right? What I'm doing instead is storing a uint256 of its slot, and in all functions that need to access it, I have a Struct storage s that I set the s.slot of as a first step.

Also, is there a sizeof() operator for structs?