【发布时间】:2021-12-29 07:30:21
【问题描述】:
处理合同结构,从the sample开始。
TvmCell stateInit = tvm.buildStateInit(templateCode, templateData);
code 和data 是模板合约的TvmCells,必须作为参数传递。
我们可以通过这种方式从模板合同中获取这些信息:(tvm.code(), tvm.getData()); 或 tonos-cli decode。然后像这样转换成TvmCell
TvmBuilder cb;
cb.store(code);
TvmBuilder db;
db.store(data);
templateCode = cb.toCell();
teamplteData = db.toCell();
使用 TONOS SE 命令行工具,工作流程基本上如下所示:
tondev c r Contract GetCodeAndData | pcregrep -M -o1 'value0\": \"(.+?)\"' | base64 -d | xxd -p | tr -d '\n' > code.hex
tondev c r Contract GetCodeAndData | pcregrep -M -o1 'value1\": \"(.+?)\"' | base64 -d | xxd -p | tr -d '\n' > data.hex
tondev c r Fabric deployWithCodeAndData -i code:$(cat code.hex),data:$(cat data.hex)
这看起来像预期的那样工作,一个新的合约地址被返回。但是,尝试运行已部署合约的任何方法都会导致
Running...
Error: Contract execution was terminated with error: Compute phase isn't succeeded, exit code: -5 (integer overflow).
Possible reason: Contract did not accept message (integer overflow).
在原始合约上运行相同,该代码用于模板,没有错误。看起来序列化或反序列化不正确。 怎么了?
【问题讨论】:
标签: command-line-interface solidity ton