首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >失败:"setState“"newAddresses”字段中的地址应为SC格式: address:the_crowdfunding_contract

失败:"setState“"newAddresses”字段中的地址应为SC格式: address:the_crowdfunding_contract
EN

Stack Overflow用户
提问于 2021-11-14 21:22:51
回答 1查看 65关注 0票数 1

我试图运行下面的mandos测试,但是当运行erdpy contract test时,测试失败并返回以下错误:FAIL: address in "setState" "newAddresses" field should have SC format: address:the_crowdfunding_contract

测试代码来自elrond smart合同教程,第1部分

setState步骤中SC地址的正确格式是什么?

使用的版本:

  • erdpy: 1.0.21
  • 埃尔罗德-瓦姆: 0.22.9
代码语言:javascript
复制
{
  "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"
        }
      }
    }
  ]
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-14 22:39:56

mandos中的SmartContract地址应该使用sc:而不是address:作为前缀。

所以正确的测试应该是这样的:

代码语言:javascript
复制
{
  "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"
        }
      }
    }
  ]
}

另外,您的SmartContract地址名称可能太长,目前还不确定确切的限制。因此,如果在上述更改后错误仍然存在,请尝试缩短SmartContract名称。

补充说明:文档有点过时了。对于更新的信息,您可以查看与elrond vscode扩展一起使用的模板。它们也在github

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69967295

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档