Building Migrations for 1155 Discussion

Do you have a file called Marketplace.json in your build folder?

no i dont have that file in my built/contract folder

how would i get this file?Selection_421

Build is where you compiled contracts end up. But where is your marketplace contract? I donā€™t see it in you contracts directory either?

my Marketplace contract is safed as Marketplace.sol in /test/helpers?? i think thats where the problem si let me test it

now I moved my Marketplace.sol file to /lib/

i ran truffel develop- which works and migrate --reset throws the same error as beforeSelection_423

ok dude i figuered it out

I now moved Marketplace.sol to /contracts/ and it works
so the solution was the path that I had to change toSelection_424

/contracts/Marketplace.sol

1 Like

Yes all your contracts need to be in /contracts

I encountered the same issue. Thanks for this clarification!

1 Like

Iā€™m going through the ā€œBuilding Migrations Part 4ā€; Iā€™ve copied everything and it compiles, migrates but when I run the balanceOf command, I get 0 no matter the id. So it spawned a couple of questions as I was trying to troubleshoot:

  1. The 4_ migration file for creating the tokens, it calls the create and mint functions multiple times, shouldnā€™t these be transactions on the blockchain resulting in a cost? When I look at that part 4 video, the migrate for the 4_ā€¦ migration file shows ā€œTotal cost: 0 ETHā€ as does mine. The other migration files show a cost and transaction details. So that makes me think the last one didnā€™t really mint the tokens?

  2. This makes wonder how do I troubleshoot/debug something like this? No errors or warnings were spawned to my knowledge. But possibly the tokens didnā€™t get created, but I have no ability to see why.

  3. Finally, I tried to ā€˜mintā€™ a token manually through the truffle console. I verified the gametoken contract address and the marketplace recepient address but it gives me an error ā€œVM Exception while processing transaction: revertā€. Are we able to manually call this command if everything was run correctly? Is there something Iā€™m missing?

(await GameToken.at(ā€œ0x0c6f3E65C46E0e9B192d2da91B90C10f90f21097ā€)).mint(4,[ā€œ0x11f7D6c5F1231Ae900E83A566F0eCe4E4342f769ā€], [10])

Thank you!

Itā€™s difficult to debug. I would start by checking so that you are minting and running balanceOf with the same address, because otherwise the balance would be 0 regardless of the ID. So when you are running balanceOf in the terminal, are you sure you are using the Marketplace contract address?

  1. Thatā€™s normal. Iā€™m not 100% sure actually, but I would assume itā€™s because truffle is rounding down. But it happens to me as well and is not a problem.

  2. Itā€™s difficult to debug. You have to think through step by step and try to go through in your head what might have gone wrong. The first check to make is what I suggested above. Then another way after that could be to run the same thing to ropsten and then checking through a block explorer to see whatā€™s going on.

  3. Seems like you get the error because you are sending the address as a string. Should not have the quotes.

Thanks Filip;

I will look into that and let you know!

Awesome job on the content btw!

FYI for anyone interested having this problem; the ERC1155 standard was/is still changing. The receiver requirement is what was causing my inability to mint tokens.

In the version with the videos, the receiver kekkak return value appears to be different? So I took the ā€˜mock receiverā€™ code from the ERC-1155 page and incorporated it in place of our receiver function in the marketplace contract. Once I did that the minting of tokens were able to be performed.

Iā€™m obviously a noob and would love a detailed walk through of this process myself. But for the new students this should be noted.

It also sucks that truffle does not provide adequate errors when performing a migrate. This is proof/reason to ensure proper code testing is done prior to any actual deployment.

1 Like

I will check this out, thanks :slight_smile:

would like to know how you solved this. having the same warnings too, thanku

Always getting 0 balance from all 3 tokens when i fetch balanceOf :confused: I feel like the problem lies in the function onERC1155Received in the Marketplace contract but not sure. Anybody else having this problem?

also would like to add when I compile, 4_create_tokens migration spends 0 eth. I would assume it would consume some if it is minting tokens?

Those warnings are normal since the function parameters are not used. Donā€™t worry about that.

I had the same problem with getting 0 for the balance of tokens created in the marketplace for all tokenId. For me the problem lied with the space after the commas in the string given as the argument of the function keccak256 in the method onERC1155Received defined in the marketplace.sol file. There should be no spaces in that string!

I had the same problem with getting 0 for the balance of tokens created in the marketplace for all tokenId. For me the problem lied with the space after the commas in the string given as the argument of the function keccak256 in the method onERC1155Received defined in the marketplace.sol file. There should be no spaces in that string!

I had the same problem with getting 0 for the balance of tokens created in the marketplace for all tokenId. For me the problem lied with the space after the commas in the string given as the argument of the function keccak256 in the method onERC1155Received defined in the marketplace.sol file. There should be no spaces in that string!