今日长缨在手,何时缚住苍龙。这篇文章主要讲述etherlime-3-Etherlime Library API-Deployed Contract Wrapper相关的知识,希望能为你提供帮助。
Deployed Contract Wrapper部署合约的封装Wrappers封装One of the advancements of the etherlime is the result of the deployment - the
DeployedContractWrapper
etherlime的进步之一就是部署的结果-DeployedContractWrapper
The
DeployedContractWrapper
is a powerful object that provides you with
ethers.Contract
amongst other functionalities. This allows you to start using your deployed contract right away as part of your deployment sequence (f.e. you can call initialization methods)
【etherlime-3-Etherlime Library API-Deployed Contract Wrapper】DeployedContractWrapper
是一个能够在其他功能中提供给你
ethers.Contract
的强势的对象。这将允许你马上开始使用部署的合约作为部署序列的一部分
In addition it exposes you
verboseWaitForTransaction(transaction,
transactionLabel)
function. This function can be used to wait for transaction to be mined while giving you verbose output of the state. In addition it allows you to specify a label for the transaction you are waiting for, so that you can get a better understanding of what transaction is being waited for. This comes in handy when deployment scripts start to grow.
除了暴露给你verboseWaitForTransaction(transaction,
transactionLabel)
函数。当给你状态的详细输出时,这个函数可以用来等待交易被挖矿。除此之外还允许你给你等待的交易指定标签,这样你就可以对正在等待的交易有更好的理解。当部署脚本开始增长时,这非常有用。
const contractWrapper = await deployer.deploy(ICOTokenContract); const transferTransaction = await contractWrapper.contract.transferOwnership(randomAddress); const result = await contractWrapper.verboseWaitForTransaction(transferTransaction, ‘Transfer Ownership‘);
verboseWaitForTransaction函数的作用就是等待交易成功被记录在区块上,然后返回交易的receipt
Working with previously deployed contracts使用以前部署的和合约Sometimes you want to work with already deployed contract. The deployer object allows you to wrap such an deployed contract by it’s address and continue using the power of the wrapper object. The function you can use to achieve this is
wrapDeployedContract(contract,
contractAddress)
.有时你想要使用已经部署的合约。部署对象将允许你通过它的地址来封装这个部署合约,然后就可以继续使用这个封装对象的功能。你可以使用
wrapDeployedContract(contract,
contractAddress)这个函数来得到封装对象
const deployedContractWrapper = deployer.wrapDeployedContract(SomeContractWithInitMethod, alreadyDeployedContractAddress); const initTransaction = await deployedContractWrapper.contract.init(randomParam, defaultConfigs); const result = await deployedContractWrapper.verboseWaitForTransaction(initTransaction, ‘Init Contract‘);
推荐阅读
- 读取 Android 设备内核日志的方法
- sonarqube扫描安卓代码
- android license status unknown解决办法
- idea中applicationContext-dao.xml文件中Cannot resolve file***** :spring xml model validation问题
- 区块链资产管理钱包APP软件系统开发搭建
- Android 目录结构
- android手机使用Fiddler
- Appium 学习三(Appium-Desktop 填坑)
- Spring监听,ApplicationListener