Guys is there a way to allocate more gas to an internal transaction in solidity?

Jul 18, 2021, 4:16 PM
Forcing metamask to put a higher gas limit eventually
Jul 18, 2021, 4:17 PM
No... and I think that would probably not be the right approach to the problem. What problem are you really trying to solve?
Jul 18, 2021, 4:21 PM
https://testnet.bscscan.com/address/0x3bb65ac5ef9fd0899a2d51385041d9a85a09f660 I'm often getting an internal transaction failing cause of too little gas (the transaction that sends bnb to the dividendTracker in a tiki fork)
Jul 18, 2021, 4:23 PM
Is this using try/catch?
Jul 18, 2021, 4:25 PM
yes
Jul 18, 2021, 4:26 PM
I don't think it's running out of gas.
Jul 18, 2021, 4:27 PM
or rather, no sorry the failed tx isn't in a try catch
this is what is failing
Jul 18, 2021, 4:28 PM
"Although one or more Error Occurred [execution reverted] Contract Execution Completed"
Jul 18, 2021, 4:28 PM
I think so as on tenderly I see it gives just 913 gas for that call, which is clearly not enough
Jul 18, 2021, 4:29 PM
If it's not in a try/catch, how is the txn succeeding (completing execution) if an internal txn is failing. I am not sure that's possible (without try/catch)
The limit was estimated at ~400k and only about ~200k was used.
yeah lines 316 & 317 have try/catch blocks
Jul 18, 2021, 4:44 PM
yeah but looking here I can see that it sends only ~900 gas to that call
yeah but the failing call is at line 343
Jul 18, 2021, 4:45 PM
ok, let me take a look
Jul 18, 2021, 4:45 PM
I found this sintax idk if I should try that but I would happily not mess with the gas limit😅
Thanks
Jul 18, 2021, 4:46 PM
I'm honestly not sure what that line is trying to accomplish
.call is some raw shit
Jul 18, 2021, 4:46 PM
it calls the fallback of DividendPayingToken which is
receive() external payable {
distributeDividends();
}
if I call directly distributeDividends passing the amount of wei would it be better?
Jul 18, 2021, 4:49 PM
I think you can specify gas
{value: msg.value, gas: 5000}
Jul 18, 2021, 4:50 PM
doing ike this dividendTracker.distributeDividends{value: bnbToDividends}();
Jul 18, 2021, 4:50 PM
maybe that will help you, I'm not sure
Jul 18, 2021, 4:50 PM
yeah
Jul 18, 2021, 4:50 PM
Still, I'm not sure it's a gas problem. The estimated gas should be correct unless something changed between the time you sent the txn and the time it was mined.
but maybe it is
I mean if you're trying to distribute to many addresses, that's going to rack up amount of gas needed. I'd have to really sit down and analyze the code to begin to have better ideas.
Jul 18, 2021, 4:58 PM
function distributeDividends() public override payable {
require(totalSupply() > 0);

if (msg.value > 0) {
magnifiedDividendPerShare = magnifiedDividendPerShare.add(
(msg.value).mul(magnitude) / totalSupply()
);
emit DividendsDistributed(msg.sender, msg.value);

totalDividendsDistributed = totalDividendsDistributed.add(msg.value);
}
}
this is the distributeDividends to which I think too little gas is passed
It doesn't actually distribute dividends but it updates the price of each share
Jul 18, 2021, 5:02 PM
Ah...
Well I don't think it should take much gas
I don't see any loops
Jul 18, 2021, 5:02 PM
yeah but it receives only 900😅
Jul 18, 2021, 5:02 PM
And it's only writing to storage once or twice
hmm... well .send and .transfer are both 23000, maybe you should try using those instead of .call?
Jul 18, 2021, 5:03 PM
https://testnet.bscscan.com/address/0xf6403be0fe2ac090d9a9dd0e8a666767aee58f7c I tried deploying a version like this but on pancake testnet it doesn' let me sell
Jul 18, 2021, 5:03 PM
or 2300, I forget
Jul 18, 2021, 5:03 PM
yeah 2300
I think it uses more than 2300, I tried sending via transfer before
Jul 18, 2021, 5:04 PM
I can't imagine writing 2 uints to storage costs more than 2300
Jul 18, 2021, 5:05 PM
Yeah it should take around 27k gas
Jul 18, 2021, 5:05 PM
what does remix estimate for the function?
Maybe it can't because of the if
Jul 18, 2021, 5:06 PM
You can specify gas amount on function call, just like how you pass value
^ this exactly
Jul 18, 2021, 5:07 PM
Yes, like this... have you tried specifying it here?
Jul 18, 2021, 5:07 PM
https://testnet.bscscan.com/tx/0x764b72f195e76dd5aab294101d4319a0eb7ca96b8c9c109da2d7b28816767b4e this is a similar case, in which I verified the dividend tracker, from here I can see that the distributeDividends uses smth like 26k gas
now I try, I first tried this approach
Jul 18, 2021, 5:09 PM
(bool success,) = address(dividendTracker).call{value: bnbToDividends, gas:2700}(""); — you could try that, I'm not sure, this kind of stuff is maybe out of my league.
Jul 18, 2021, 5:11 PM
Yeah ahahah
Yeah now I try
Jul 18, 2021, 5:11 PM
or take away the ``gas`` parameter
and make sure your code is not vulnerable to re-entrancy
Jul 18, 2021, 5:12 PM
It already doesn't have a gas parameter.
Jul 18, 2021, 5:13 PM
then limiting gas won't help
Jul 18, 2021, 5:13 PM
So that param is only used when you want to limit gas
That makes sense to me
Jul 18, 2021, 5:14 PM
I think what you are doing is redundant. Taking bnb from your own contract and sending that to itself just to trigger fallback? Why not call the function directly?
Jul 18, 2021, 5:14 PM
Wait I dunno
Jul 18, 2021, 5:14 PM
No it's not sending to itself, but to another contract
Jul 18, 2021, 5:15 PM
This dividend contract lies on a different address?
Jul 18, 2021, 5:16 PM
wait, whats wrong?
Jul 18, 2021, 5:16 PM
Yes
Jul 18, 2021, 5:16 PM
Aah then try combining them. Its basically 2-3 more functions to add
Won't go over code size
Jul 18, 2021, 5:17 PM
Yes, A sends to B some BNB, and B does what it always does when it receives BNB
Jul 18, 2021, 5:17 PM
what is wrong?
Jul 18, 2021, 5:17 PM
Take the code from the eip link itself
Jul 18, 2021, 5:17 PM
I tried now on this version but I guess it reverts somewhere, on pcs on testnet (the one with ui) it doesn't let me sell
Jul 18, 2021, 5:18 PM
maybe its a problem with B ?
Jul 18, 2021, 5:18 PM
I think you should go with this version and figure out why it's reverting
Jul 18, 2021, 5:18 PM
you only showed the code of A
not B ?
Jul 18, 2021, 5:18 PM
B is also visible, B is DogeearnDividendTracker
Now I am trying verifying it's code on bscscan but it's giving me problems, maybe cause it was deployed by another contract
Jul 18, 2021, 5:19 PM
Like, I don't think it's a gas problem. I think something is reverting for a reason other than gas. If you're sure that's not the case, then maybe a gas problem but one that is over my head I think.
Jul 18, 2021, 5:20 PM
Is this B?
Jul 18, 2021, 5:21 PM
Yeah I just checked and looks like its only using half of the set gas limit
Jul 18, 2021, 5:21 PM
yeah that's what is being called
Jul 18, 2021, 5:21 PM
Niccolo mentioned above some tool is telling him it needs more than what it's getting
Jul 18, 2021, 5:22 PM
also, are you sure its coming from the contract call?
Jul 18, 2021, 5:22 PM
yes
Jul 18, 2021, 5:22 PM
maybe its because of overflow / underflow on the B contract
also, require(totalSupply() > 0);
maybe the total supply is 0?
Jul 18, 2021, 5:24 PM
I have to go but please DM me if you end up solving this, it's an interesting issue
Jul 18, 2021, 5:24 PM
its either:
a) overflow or underflow
b) totalSupply is 0
c) bnbToDividends is 0 on the A contract
Jul 18, 2021, 5:25 PM
You're probably right man😅
Jul 18, 2021, 5:25 PM
if it is something else then i may be stupid
Jul 18, 2021, 5:26 PM
Yeah sorry that went over my head, I tried to force the swap sending tokens to the contract and forgot about that ahahah
Jul 18, 2021, 5:26 PM
👍
Jul 18, 2021, 5:26 PM
Thanks man I appreciate it :D
Jul 18, 2021, 5:27 PM
Something I noticed is the dividend processing is not being executed well. If you check the event, it shows 0 iterations always
Jul 18, 2021, 5:27 PM
Yeah that should be linked to the 0 holders of the dividend tracker 😅
Jul 18, 2021, 5:28 PM
Btw, does anyone know why the faucet is only giving 1 BNB now, it used to be like 12. Kind sucks.
Jul 18, 2021, 5:28 PM
i have 1000 bnb
there used to be an LP pool that allowed swapping 10 BUSD to 1k testnet bnb
lol
Jul 18, 2021, 5:29 PM
Huh then how come it uses 300k for 0 processing?
Jul 18, 2021, 5:29 PM
lol awesome
Jul 18, 2021, 5:30 PM
Idk, they got greedy with testnet bnb ahahah, if I get 0.1 btc can I swap it to bnb getting profit? ahahah
Jul 18, 2021, 5:30 PM
do you want some?
Jul 18, 2021, 5:30 PM
Nvm, I understood😅
Jul 18, 2021, 5:30 PM
I tried but couldnt find a router with that btc
Jul 18, 2021, 5:30 PM
oh awesome ahahahah
damn
Jul 18, 2021, 5:30 PM
Hah I did the same
Sushiswap?
Jul 18, 2021, 5:31 PM
why isn't that info widespread😂
Jul 18, 2021, 5:31 PM
I emptied the pool last time
Jul 18, 2021, 5:32 PM
Oh, you might also check this: https://gitter.im/ethereum/solidity there might be some good devs in there but I haven't really been involved much there.
Jul 18, 2021, 5:32 PM
bakeryswap
Jul 18, 2021, 5:32 PM
Nice, I got busd from Venus and did it on sushi
Jul 18, 2021, 5:33 PM
bakeryswap or sushiswap
they have a bunch of LPs
on testnet
Jul 18, 2021, 5:33 PM
let me see
Jul 18, 2021, 5:33 PM
guys give some addresses please ahahahah
Jul 18, 2021, 5:35 PM
i can give
some testnet BNB if you neeed
Jul 18, 2021, 5:35 PM
0xD1F902fE17159eF90Fa8d0D03DC2BB726E135960
Jul 18, 2021, 5:35 PM
but rinkeby is the best either way
Jul 18, 2021, 5:35 PM
here pleasee ahah
Jul 18, 2021, 5:35 PM
how much do you need?
Jul 18, 2021, 5:35 PM
how much can you send?
Jul 18, 2021, 5:35 PM
up to 1k
Jul 18, 2021, 5:35 PM
https://testnet.bscscan.com/address/0x6ce8da28e2f864420840cf74474eff5fd80e65b8

it this the same BTCB sent from faucet?
wtf 50BNB is enough thanks
Jul 18, 2021, 5:36 PM
ok, one sec
Jul 18, 2021, 5:36 PM
thanks
Jul 18, 2021, 5:36 PM
0x70DE365CC744Fbd6380fe8c319B485e25a34e862 here too man please ahahah get me out of misery😂
Jul 18, 2021, 5:36 PM
50 as well?
Jul 18, 2021, 5:37 PM
yeah pls
Jul 18, 2021, 5:37 PM
ok one sec
Jul 18, 2021, 5:37 PM
wtf
Jul 18, 2021, 5:38 PM
Try sushi busd
Jul 18, 2021, 5:39 PM
busd is better
busd or eth
Jul 18, 2021, 5:39 PM
busd no liquidity
Jul 18, 2021, 5:39 PM
someone must have milked it iut
Jul 18, 2021, 5:40 PM
👀
Jul 18, 2021, 5:40 PM
ahah
Jul 18, 2021, 5:40 PM
i didn't take everything lol
i kept the change in the pool
Jul 18, 2021, 5:40 PM
sushi doesn't have btc seems
Jul 18, 2021, 5:41 PM
sent
ok, sending in a sec
Jul 18, 2021, 5:48 PM
busd to bnb, I sent you some bnb
Jul 18, 2021, 5:48 PM
thanksss
Jul 18, 2021, 5:49 PM
Hi is there any better ide than remix?
Jul 18, 2021, 5:49 PM
vs code with hardhat
Jul 18, 2021, 5:49 PM
but sushi says not enough liquidity
Jul 18, 2021, 5:49 PM
and the solidity extension
and a good theme
Jul 18, 2021, 5:49 PM
Ok thanks
Jul 18, 2021, 5:49 PM
thx
Jul 18, 2021, 5:49 PM
I know, keep it for later
Jul 18, 2021, 5:50 PM
okok thnaks
Jul 18, 2021, 5:50 PM
at least give the line its bugging out on
Jul 18, 2021, 5:53 PM
I thought it's a name problem, but I have changed to different ones and still doesn't work
Jul 18, 2021, 5:56 PM
sent
ERC20 isn't defined?
Jul 18, 2021, 5:58 PM
Thanks!
Jul 18, 2021, 5:59 PM
Np
Jul 18, 2021, 5:59 PM
how to define it?
Jul 18, 2021, 6:03 PM
import openzeppelin ERC20 or whatever you want to use?
for next time you need more testnet BNB
10 BUSD = 21 bnb
Jul 18, 2021, 6:05 PM
Thanks man I didn't know about this ahahah
Bake?
Jul 18, 2021, 6:06 PM
bakeryswap
Jul 18, 2021, 6:06 PM
Yeah, and for the busd you get it from faucet or there's another pair/ dex on which to get it cheaper?
Jul 18, 2021, 6:07 PM
in pancake router are tehre some busd?
0xed24fc36d5ee211ea25a80239fb8c4cfd80f12ee this is BUSD used by bakery if someone need it
Jul 18, 2021, 6:11 PM
in the normal faucet
it gives out 10
in the same faucet
it gives out 10
Jul 18, 2021, 6:14 PM
Thanks
Jul 18, 2021, 6:14 PM
thanks
Jul 18, 2021, 6:26 PM
only thing we need now is a bsc testnet => mainnet bridge
1:1
:P
1 day it will happen eventually
Jul 18, 2021, 6:27 PM
you must have at least one holder to see symbol etc
Voips are not allowed
Jul 18, 2021, 7:29 PM
wdym voip?
Jul 18, 2021, 7:31 PM
more accounts, same person
so same person that spam, spam, spam
I had like 4 chats with same question from that man.
Jul 18, 2021, 7:33 PM
oh lol
Jul 18, 2021, 7:34 PM
lol on OZ too
Jul 18, 2021, 7:35 PM

© 2024 Draquery.com All rights reserved.