Hello i'm writing an 1155 contract and have a function as follows:

  function creditPowls(address _to) public onlyOwner {
    uint256[] memory ids; 
    uint256[] memory vals; 
    for (uint i=0; i<=12; i++) {
      ids[i] = minted;
      vals[i] = 1;
    _mintBatch(_to, ids, vals, "");

but i'm getting the following error even though i'm not really dealing with payment.

revert: 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.

thanks in advance for any guidance.

  • 1
    Is the contract deployed on a testnet somewhere? Can you share its address? Commented Feb 1, 2022 at 14:10
  • it isn't i'm stil testing it on the remix ide built in accounts.
    – fedesc
    Commented Feb 1, 2022 at 14:12
  • 1
    The error is 100% misleading. Nothing to do with being payable. It is just a default revert statement. You might want to make sure that you use the owners account when you mint, and also that the _to address is not 0x0 Commented Feb 1, 2022 at 17:34

1 Answer 1


solution for whom have a similar problem:

Kenzo Agada — Today at 3:29 PM That error is misleading, it might show it sometimes even when the error is not related to payable The problem is probably in how you use the arrays - they seem to be a dynamic type, no length, but you assign to them at a specific location - that location is not created yet Will your array always have size 12? 13 actually

Kenzo Agada — Today at 3:31 PM So change your declaration like this

uint256[13] memory ids;  
uint256[13] memory vals;

This should create the arrays with size 13, and so when you'll do ids[0] for example, it will be able to set it

OWLΞTH — Today at 4:08 PM @Kenzo Agada i was getting and invalid explicit conversion from a fixed to dynamic type, writing it with a fixed size (mintBatch wants it dynamic). found a solution on the internet to do

uint256[] memory ids = new uint256[](12).  

all errors are gone now but i'm not sure about this syntax .. it's giving length to a dynamic array instead of a pre-fixed size?

Kenzo Agada — Today at 4:32 PM Yay I found the mythical post I was referring to Working with structure arrays in solidity

static vs dynamic

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.