I have the following snippet

uint256[] public s_results = [84080469561607224741111096759358273404425425552033897563872674800638878201820, 28991411665057923702694279928172111508485190268882343548752035358726143640092, 4073849607285761339133962439822675462101666430911877861844427717241312375805, 93722714462511979473853464262405424366019325671902046999248366992476892740462, 20373670703527142601825187246594349566634034465539917973148147160221536521035, 40957353350900529608244260039239095845058945157988798554139155362716373062366];

uint256[] public s_resultsParsed;

function parseResults() public onlyOwner {
   uint8 idx = 0;
   for(idx = 0; idx < s_results.length; idx++ ){
       s_resultsParsed[idx] = s_results[idx] % 10;

The long uint256[] is a sample response I get from an oracle. What I want to do is to get the large uint, modulo it by 10 and generate numbers ranging from 0-9.

Running this code returns an error.

The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information.

I am really confused as I don't understand how the code could be related to anything payable. My only hunch is I may be handling the array of uint256 inefficiently but I don't know how else to proceed.

  • 1
    You need to allocate s_resultsParsed first, or you can use .push
    – 0xSanson
    Aug 2, 2022 at 13:24

1 Answer 1


Since you included the Remix tag, I'll assume that you are using it to interact with your smart contract. There was an issue where the value field for the transactions didn't clear after sending a transaction in Remix. Manually setting the value of the field to 0 could solve your issue if this is the case. The value field is found here:

enter image description here

  • Hi, thanks for this. I'm not entirely sure which value field I would need to set to 0? If it adds value to the discussion, I dont have any payable methods on the contract.
    – momoja
    Aug 2, 2022 at 9:17
  • Hi, I added the screenshot to the answer, so you can find the field easier. If you are calling the function in another way, would you mind sharing how you do it?
    – OneThunder
    Aug 2, 2022 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.