NearProtocol模拟测试示例编译不通过

NearProtocol simulation test example not compiling

TLDR:NEAR 的 FungibleToken 示例是如何编写模拟测试的转到标准,它没有编译。

https://github.com/thor314/FungibleToken 详细介绍了我尝试编译 Fungible Token 示例的艰辛历程,因此我可以从中模拟我的模拟测试。自述文件包含我迄今为止尝试过的内容。

原始仓库位于 near_sdk 仓库中。 https://github.com/near/near-sdk-rs/tree/master/examples/fungible-token


在@sirwillem 的有用回答之后,此 post 已更新以反映 sim 测试中存在的错误:

---- test_sim_transfer stdout ----
thread 'test_sim_transfer' panicked at 'Outcome ExecutionOutcome {
    logs: [],
    receipt_ids: [
        `9S5QHJgLThMCPtgJbtARenx6duSLBu3oCCtVbVpEwdLC`,
    ],
    burnt_gas: 16326564288269,
    tokens_burnt: 0,
    status: Failure(Action #0: The account contract wouldn't have enough balance to cover storage, required to have 116059483300000000000000000 yoctoNEAR more),
} was a failure', /home/thor/.cargo/git/checkouts/near-sdk-rs-7ba52202f378a9d9/ea112e2/near-sdk-sim/src/outcome.rs:87:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

更新二;需要使用构建脚本更新 .wasm 文件。谢谢

感谢您涉足未知领域!我们仍在努力在模拟器所依赖的 nearcore 中发布核心板条箱。一旦我们有了这个,我们就可以发布它。这将使它稳定下来,你不会得到这些类型的错误。

现在修复你的Cargo.toml到最新的标签:

[dependencies]
near-sdk = { git = "https://github.com/near/near-sdk-rs.git", tag="2.2.0" }


[dev-dependencies]
near-sdk-sim = { git = "https://github.com/near/near-sdk-rs.git", tag="2.2.0" }

然后您必须将第 70 行的 general.rs 编辑为:

        contract.transfer(alice.account_id(), transfer_amount.into()),