【问题标题】:NEAR smart-contract error: "Contract is not initialized"NEAR 智能合约错误:“合约未初始化”
【发布时间】:2021-12-30 03:36:00
【问题描述】:

我使用汇编脚本创建了 NEAR 智能合约并部署到测试网。 当我调用任何函数时,我收到合约未初始化的错误(合约已添加到 asconfig.json 中的工作区):

Error: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: contract is not initialized, filename: \"src/token/assembly/index.ts\" line: 123 col: 3"}}
ServerTransactionError: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: contract is not initialized, filename: \"src/token/assembly/index.ts\" line: 123 col: 3"}}

First lines of my contract

【问题讨论】:

    标签: assemblyscript near


    【解决方案1】:

    我在我的代码中使用了单例样式,因此需要在使用前初始化我的合约。 最简单的方法:只使用函数(不使用 Singleton)。

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2021-06-14
    • 1970-01-01
    • 2022-06-23
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 2021-01-12
    • 2022-06-22
    • 2023-01-25
    相关资源
    最近更新 更多