0

I have a dApp that leverages ERC721 contract which allows users to upload images onto IPFS and transfer them to each other. User A can upload images fine and transfer them fine to User B. Once transferred User A can still upload new images -perfect! However, when User B then logins onto Metamask and try's to upload sketch's(string value of hash) I am hit with the error message below.

MetaMask - RPC Error: Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"message":"VM Exception while processing transaction: revert","code":-32000,"data":{"0x33acf11f7fb6df195a58a8cd8e21a0f837f2710540f19122548f625ba5a5aef6":{"error":"revert","program_counter":6758,"return":"0x"},"stack":"c: VM Exception while processing transaction: revert\n at Function.c.fromResults (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:194812)\n at w.processBlock (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:42:53376)\n at process._tickCallback (internal/process/next_tick.js:68:7)","name":"c"}}}}'

I have a truffle test which passes when a user uploads, transfers and then uploads again. Do I need a truffle test for a different account accessing and uploading sketch's to expose this problem? If so how do you change the accounts address accessing the contract in truffle test environment? I begin the truffle test.js and expose the contract as follows:

const Sketch = artifacts.require('./Sketch.sol')

require('chai')
  .use(require('chai-as-promised'))
  .should()

contract('Sketch', (accounts) => {
    let contract

    before(async () => {
        contract = await Sketch.deployed()
    })

    describe('deployment', async () => {
        it('deploys successfully', async () => {
            const address = contract.address
            assert.notEqual(address, 0x0)
            assert.notEqual(address, '')
            assert.notEqual(address, null)
            assert.notEqual(address, undefined)
        })

Any help would be great

1
  • You can send a transaction from another account in truffle by appending { from: "0x12341234.." }. So it will look like myContract.myFunc(myParam1, myParam2, { from: '0xabcdefabcdef...'} ).
    – Ismael
    Commented Dec 26, 2020 at 21:57

0

Your Answer

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

Browse other questions tagged or ask your own question.