1

I'm trying to run the below mandos test, but when running erdpy contract test, the test fails and returns the following error: FAIL: address in "setState" "newAddresses" field should have SC format: address:the_crowdfunding_contract.

The test code is the one from the elrond smart contract tutorial, part 1.

What is the correct format of the SC address in the setState step?

Versions used:

  • erdpy: 1.0.21
  • elrod-wasm: 0.22.9
{
  "name": "tutorial_crowdfunding",
  "steps": [
    {
      "step": "setState",
      "accounts": {
        "address:my_address": {
          "nonce": "0",
          "balance": "1,000,000"
        }
      },
      "newAddresses": [
        {
          "creatorAddress": "address:my_address",
          "creatorNonce": "0",
          "newAddress": "address:the_crowdfunding_contract"
        }
      ]
    },
    {
      "step": "scDeploy",
      "tx": {
        "from": "address:my_address",
        "contractCode": "file:../output/tutorial_crowdfunding.wasm",
        "value": "0",
        "gasLimit": "1,000,000",
        "gasPrice": "0"
      },
      "expect": {
        "status": "0",
        "gas": "*",
        "refund": "*"
      }
    },
    {
      "step": "checkState",
      "accounts": {
        "address:my_address": {
          "nonce": "1",
          "balance": "1,000,000"
        },
        "address:the_crowdfunding_contract": {
          "nonce": "0",
          "balance": "0",
          "storage": {
            "''owner": "address:my_address"
          },
          "code": "file:../output/tutorial_crowdfunding.wasm"
        }
      }
    }
  ]
}
mccuna
  • 471
  • 7
  • 11

1 Answers1

1

SmartContract addresses in mandos should be prefixed using sc:instead of address:

So the correct test would look like this:

{
  "name": "tutorial_crowdfunding",
  "steps": [
    {
      "step": "setState",
      "accounts": {
        "address:my_address": {
          "nonce": "0",
          "balance": "1,000,000"
        }
      },
      "newAddresses": [
        {
          "creatorAddress": "address:my_address",
          "creatorNonce": "0",
          "newAddress": "sc:the_crowdfunding_contract"
        }
      ]
    },
    {
      "step": "scDeploy",
      "tx": {
        "from": "address:my_address",
        "contractCode": "file:../output/tutorial_crowdfunding.wasm",
        "value": "0",
        "gasLimit": "1,000,000",
        "gasPrice": "0"
      },
      "expect": {
        "status": "0",
        "gas": "*",
        "refund": "*"
      }
    },
    {
      "step": "checkState",
      "accounts": {
        "address:my_address": {
          "nonce": "1",
          "balance": "1,000,000"
        },
        "sc:the_crowdfunding_contract": {
          "nonce": "0",
          "balance": "0",
          "storage": {
            "''owner": "address:my_address"
          },
          "code": "file:../output/tutorial_crowdfunding.wasm"
        }
      }
    }
  ]
}

Also your SmartContract address name might be too long, not sure on the exact limits right now. So if the error persists after the above changes try to shorten the SmartContract name.

Additional note: The documentation is somewhat outdated. For newer informations you can take a look at the templates that can be used with the elrond ide vscode extension. They are also on github

Martin W
  • 733
  • 4
  • 12
  • 1
    Switching from `address:` to `sc:` solved the issue, thanks! The smart contract name appears to be ok, so I guess I'm close to the limit with this name (it's a dummy one anyway, but it's good to know about that the max length). Also, thanks for the link to the updated examples! – mccuna Nov 15 '21 at 06:45