169 похожих чатов

Hy guys! I have pretty strange problem. Let me explain: So,

I have a method, where I'm getting an object from another contract, then I'm adding msg.value to the one of the field of this object and then I'm just update this value:
function doVote(uint voteID, address voteFor)
external
payable
valueIsEnough
{
IVoteStorager.VoteData memory voteData = voteStorager.getVote(voteID);
// some not important code
voteData.pool += msg.value;
// some not important code
voteStorager.updateVote(voteID, voteData);
}

updateVote method actually pretty simple:
function updateVote(uint voteID, VoteData calldata vote) external voteIsExists(voteID) override {
votes[voteID] = vote;
}

And when I'm calling this method (I use web3.js) I'm getting an error:
Error: Returned error: VM Exception while processing transaction: revert

When I change voteData.pool += msg.value; on the voteData.pool += 123; everything is works fine. I guess it is problem because of how I'm sending value. I use this:
const gasAmount = await contract.methods.doVote(taskArgs.voteId, taskArgs.participant).estimateGas({from: signer.address});
await contract.methods.doVote(taskArgs.voteId, taskArgs.participant)
.send({
from: signer.address,
gas: gasAmount,
value: 100
})

But also seems like everything is fine here also. Could anybody help me guys? I'm trying to fix it whole day and I can't find any info about this. Thanks!

2 ответов

6 просмотров

try it on remix and see if it works there. if it does, then the problem is in your js script

Похожие вопросы

Обсуждают сегодня

а зачем этот вопрос для удаления из чата?
Mёdkinson Medvezhkin
63
Эх кто-то пришел и весь праздник испортил :( You need complex FBX scene importing setup to change things on import? good luck with that. You need navigation and pathfinding? g...
Serg Gini
5
Всем привет! Подскажите. Я написал приложение на Delphi 10.2 Tokyo под Windows 10. И передо мной стал вопрос о том чтобы сделать это приложение кроссплатформенным (под Linux и...
Дмитрий Завгородний
24
Какого хера? /Sources/App/Modules/User/Models/UserLinkApple.swift:21:20: warning: stored property '_id' of 'Sendable'-conforming class 'UserLinkApple' is mutable @ID(...
Alexander Sherbakov
14
У тебя в конфиге нигде нет deny all; или вообще любого deny?
Alexander Sherbakov
10
Привет всем. Подскажите где можно посмотреть, какая версия электрон, поддерживает версии windows? Некий changelog. Мне бы желательно, поддержку 7,8,10... latest, как понимаю и...
Anonym Squad
21
Почему стало ломаться на D11? "739002.86400000' is not a valid timestamp" function IncDateTime(aStamp:TTimeStamp;aKind:TTriggerKind;aInterval:Integer):TDateTime; //aStamp = 2...
Катерина Свиридова
8
Портфолио: Зовут меня Александр, мне 36 лет. Город Пушкино. Общий рабочий стаж: ~14 лет Уровень квалификации: Senior Full-stack developer Где прочесть мой код? https://github....
Magic
10
Ребят, чет я уже не догоняю... Крч в коде на асм там происходит нечто вроде a+число (a+1, a+2 и т.д.). Но почему строка lea ecx, [edx+1] работает как a+1?? В edx берется адрес...
Alan 🔝 Бэброу
4
думаешь я не смогу также сделать? мне это просто не удобно
int 💳 𝙖𝙞𝙧 𝙗𝙞𝙜 𝙗𝙤𝙗 🔫 check bio / spam block / AFK / nohello.com / GMT+3
9
Карта сайта