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)

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');
 
 

etherlime-3-Etherlime Library API-Deployed Contract Wrapper的更多相关文章

  1. Google Ajax Library API使用方法(JQuery)

    Google Ajax Library API使用方法 1.传统方式: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7. ...

  2. etherlime-2-Etherlime Library API-deployer

    Etherlime Library API 库API Deployer部署者 Deployer functionality The main functionality the deployer ex ...

  3. 试写foxit reader的ConvertToPDF功能的wrapper

    相比于直接fuzzing大型程序本身,针对程序的某一特定功能写wrapper后再fuzzing则要高效的多.网上搜了下,仅有两篇关于foxit reader的wrapper文章,一个用python,另 ...

  4. TensorFlow Lite demo——就是为嵌入式设备而存在的,底层调用NDK神经网络API,注意其使用的tf model需要转换下,同时提供java和C++ API,无法使用tflite的见后

    Introduction to TensorFlow Lite TensorFlow Lite is TensorFlow’s lightweight solution for mobile and ...

  5. 使用Java Service Wrapper在Linux下配置Tomcat应用

    前言 Java Service Wrapper是Tanuki Software的一个产品,可以将Java应用注册成Windows或Linux服务,使其可以随系统开机启动,同时可以监控Java应用的状态 ...

  6. Java Service Wrapper配置详解

    #encoding=UTF-8 # Configuration files must begin with a line specifying the encoding # of the the fi ...

  7. Windows api 函数全部列表 (未完成)

    网上找了很久,发现没有完整版的,msdn上面有,但是不方便查阅,所以想自己整理一下:由于工程量过于庞大,希望大家共同完成.MSDN:http://msdn.microsoft.com/en-us/li ...

  8. wrapper x64 版本发布到centos

    背景: 项目需要在spark任务提交服务器节点上自动提交任务到spark集群上.因此创建了一个固定时间监控任务项目,使用timer定时监控oracle数据库中是否有spark提交任务,如果有spark ...

  9. 完全自主创建Wrapper Tomcat容器

    Wrapper Tomcat 使用说明1. Wrapper Tomcat 简介1) Wrapper Tomcat 是使用Apache Tomcat 整合 Java Service Wrapper 的一 ...

随机推荐

  1. spring boot入门笔记 (二) - application.properties配置文件

    项目最重要的一个东西,用来定义整个项目的一些东西(端口.访问项目的名称.数据源.日志.集成mybatis等框架.静态资源目录.thymeleaf.热部署等),很重要很重要的. #整个项目的端口号,默认 ...

  2. Element ui 中使用table组件实现分页记忆选中

    我们再用vue和element-ui,或者其他的表格的时候,可能需要能记忆翻页勾选,那么实现以下几个方法就ok了 示例如下 <el-table :data="tableData&quo ...

  3. 【canvas系列】canvas实现“ 简单的Amaziograph效果”--画对称图【强迫症福利】

    标题很难引人入胜,先放个效果图好了 如果图片吸引不了你,那我觉得也就没啥看的了. demo链接: https://win7killer.github.io/demo_set/html_demo/can ...

  4. 如何利用API导出带有页眉页脚的excel

     在报表中设置的页眉页脚在页面中是看不到的,如下图: 页面中的效果: 在打印的时候,可以看到页眉页脚的效果: 那么,如果将页眉页脚导入到导出的excel中呢.我们可以通过API来进行设置: < ...

  5. 线程间的通信方式3--Handler

    Android的消息处理有三个核心类:Looper,Handler和Message.其实还有一个Message Queue(消息队列),但是MQ被封装到Looper里面了,我们不会直接与MQ打交道,因 ...

  6. pageHelper插件

    mybatis的分页插件使用总结 环境准备工作:    1.在使用pagehelper插件时,我已经搭建好了ssm(spring+springmvc+mybatis) 在这简单描述一下ssm搭建过程 ...

  7. Windows 安装mkvirtualenv虚拟python环境

    pip install virtualenvwrapper-win mkvirtualenv --python=python.exe 新python虚拟环境名称 使用方法 所有的命令可使用:virtu ...

  8. 2 python全局变量如何指定(是在模块内,还是函数内)

    示例代码1 xx=1 def __recurrence(): # #前面的0到sentence_length-1的下标,存储的就是最原始的词向量,但是我们也要将其转变为Tensor global xx ...

  9. 【Java】解析xml

    xml: <?xml version="1.0" encoding="GB2312"?> <RESULT> <VALUE> ...

  10. commonjs详解

    marked here a well written artical http://javascript.ruanyifeng.com/nodejs/module.html