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
chriseth
@chriseth:matrix.org
[m]
Ok, got it reproduced, no need for a complete example :)
cai88112
@cai88112
图片.png
Can't transfer to different address at same time right?
chriseth
@chriseth:matrix.org
[m]
What do you mean by that?
cai88112
@cai88112
It means two transfer in one transaction ,i test it,but only one transfer success,the other one failure without error.
How can i do multi transfer from one sender?
chriseth
@chriseth:matrix.org
[m]
your code looks correct
how do you determine the success of the transfer?
I mean it is your token, you define what a transfer is
FatmaDilaraMeydan
@D97yfm_twitter
Hello, I am trying to set up a modular structure using solidity language. So I always write contracts that interact with each other. Is there any document you can suggest me? What should I pay attention to while writing?
hrkrshnn
@hrkrshnn:matrix.org
[m]
@D97yfm_twitter: You might want to look up about Libraries. Maybe even about delegatecalls and free functions. A general problem with modularizing and calling each other is the additional gas costs for call or delegatecall. On the flip side, if your contract has too many functions, you might end hitting the contract size limit.
FatmaDilaraMeydan
@D97yfm_twitter
Are there any resources for these?
hrkrshnn
@hrkrshnn:matrix.org
[m]
:point_up: Edit: @D97yfm_twitter: You might want to look up about Libraries. Maybe even about delegatecalls and free functions. A general problem with modularizing and calling each other is the additional gas costs for call or delegatecall. On the flip side, if your contract has too many functions, you might end up hitting the contract size limit.
I'd say the docs: https://docs.soliditylang.org/en/v0.8.6/. Look up the sections on libraries, free functions, and delegatecall.
FatmaDilaraMeydan
@D97yfm_twitter
Ok, thanks.
Ryan Cobourn
@rjcobourn
Does anyone know how to approve an erc-20 transaction when writing tests in Remix? I want account-0 to approve my test contract to send a token of theirs. In the real dapp, this would be a button the user would click which would send a transaction to the erc-20 contract to approve my dapp.
danielmedvec
@danielmedvec

Hey guys,

If i got a number 9999 <-- This represents 99.99%

How can we get 99.99% of a token amount if it has 9 decimals?

so lets say we got 30000000000000000 (30m tokens with 9 decimals), how can we get 99.99% of this in solidity?
Blockchain & Smart Contract developer
@lovecodeing1995
amount.mul(9999).div(10000)
danielmedvec
@danielmedvec
<3
Ty :)
danielmedvec
@danielmedvec

@lovecodeing1995 And what about if you need the exact percentage of a token?

So lets say: 60000000000000 (60k tokens with 9 decimals) , how would we get the percentage amount the 60000000000000(60k tokens with 9 decimals) would be from 60000000000000000 (60m tokens with 9 decimals)

Currrently got this:
amountPercentageTokensRemaining = amountUnsoldTokensRemaining.div((allocatedTokensForPresale.mul(1000000000))).mul(10000); //99990000000
but i don't think ti's the correct way
Blockchain & Smart Contract developer
@lovecodeing1995
do you want to divide tax fee by following percent?
danielmedvec
@danielmedvec
Just trying to get the percentage of unsold tokens, and then burn the same percentage from tokens that need to go to pancakeswap
so, ppresale tokens goot 60m, and pancakeswap tokens got 34m tokens allocated
Presale tokens get sold 10% of, (6m tokens). so we need to burn the remaining of that amount(90% remaining), and we need to burn the same percentage from pancakeswap tokens as well (90% of the 34m tokens allocated for pancakeswap)
That's the idea at least
I just cant ge that "90%" right
Blockchain & Smart Contract developer
@lovecodeing1995
percent = sellingToken.mul(100).div(totalSupply)
It(100) can be determined according to the degree of accuracy.
if you want to get 99.99%, you have to set it as 10000
danielmedvec
@danielmedvec
but we can get it even more accurate right?
if we change the 10000 to 1000000000
asxes
@asxes
hello ; What is parserError ?
denemeler/storage-memory-calldata.sol:26:13: ParserError: Expected primary expression. else if (t<30){ ^--^
cameel
@cameel:matrix.org
[m]
@asxes: Something must be wrong with your syntax in that if. Can't say what exactly without seeing the whole statement.
Maybe you're missing a semicolon, parenthesis or have some other simple mistake.
asxes
@asxes
yep , it's too simple. but i cant find it.

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;

contract Function {

  function deneme() public pure returns (uint , bool, uint) {

        return (199,false,299);

}

    // Functions can return multiple values.
function returnMany(uint t) public pure returns (uint , bool, uint) {

           if (t < 10) {
       return (1, true, 2);

    } else if (t < 20) {
        return (3, false, 4);

        else if (t<30){

          return deneme();

        }
    } else {
        return (99, true, 99);
    }

 }
cameel
@cameel:matrix.org
[m]
Also, in general ParserError (as opposed to other kinds of errors) basically means that it's a fundamental error in your syntax that was already detected at the parsing stage.
The compiler could not even start semantic analysis of your code (type checking, etc.).
ok, this looks correct at a glance. Let me try to compile it.
rvmelkonian
@rvmelkonian
anyone know an API that fetches you price of ETH by blocknumber not by timestamp ?
cameel
@cameel:matrix.org
[m]
Ah, it's the second else. You have and else that's missing an if.
@asxes: This is not valid:
        return (3, false, 4);
        else if (t<30){
          return deneme();
        }
Should work if you remove the else.
Also, that part is unreachable because it's after return.
But I guess it's just because you're fiddling with this example trying out stuff?
asxes
@asxes
yes. looking to https://solidity-by-example.org. i've coped that contract from it.
cameel
@cameel:matrix.org
[m]
Oh, I see that you probably wanted this:
    if (t < 10)
        return (1, true, 2);
    else if (t < 20)
        return (3, false, 4);
    else if (t < 30)
        return deneme();
    else
        return (99, true, 99);
It's just incorrectly nested.