我有一个 Solidity 智能合约ContractFactory,正在RSK上部署并在Hardhat中开发。ContractFactory具有deploy生成新Child智能合约的函数。\n\xe2\x80\x8b
// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\xe2\x80\x8b\ncontract ContractFactory {\n event ContractDeployed(address owner, address childContract);\n\xe2\x80\x8b\n function deploy() public {\n Child newContract = new Child(msg.sender);\n emit ContractDeployed(msg.sender, address(newContract));\n }\n}\n\xe2\x80\x8b\ncontract Child {\n address owner;\n\xe2\x80\x8b\n constructor(address _owner) {\n owner = _owner;\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n在调用该函数之前,我能否知道 新的智能合约将收到RSKdeploy上的哪个地址?Child
我有一个智能合约,可以检查实际块编号是否高于执行某些功能的固定块编号,我需要编写一个单元测试来验证该行为。我在 Regtest 模式下使用 RSK 来执行测试,我需要增加块号而不实际等待时间过去。
智能合约使用区块编号,我需要增加区块编号,而无需实际等待时间过去。
context('once deployed', function () {
it('can only be released after cliff', async function () {
// TODO here I need to increment time or block number
await this.lockup.release();
});
)};
Run Code Online (Sandbox Code Playgroud)
我怎样才能在像上面那样的松露(摩卡)测试中做到这一点?
我想获取特定智能合约的信息 - 部署在 RSK 测试网上 - 以从其存储中获取数据值。我怎样才能做到这一点?我正在使用eth_getStorageAtJSON-RPC,但得到了意想不到的结果。
我需要知道如何为我在 RSK 网络上的交易设置合适的天然气价格。我熟悉eth_gasPrice以太坊的方法:
$ curl https://public-node.testnet.rsk.co -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0x3938700"}
Run Code Online (Sandbox Code Playgroud)
以上是否也推荐用于 RSK?
我正在使用 web3.js 来获得最低 gas 价格,但以下方法不起作用:
web3.eth.getBlock('latest').minimumGasPrice
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
给定部署到 RSK 的智能合约的地址,我如何判断它是否是 NFT?有没有“标准”的方法来做到这一点?
我有一个使用区块号的智能合约,我需要增加区块号,而无需实际等待时间过去。
在 Regtest 中运行 RSK 节点时这可能吗?我怎样才能用 JavaScript 做到这一点?