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. Mybatis中的jdbcType的作用

    使用MyBatis框架做更新操作时,在该字段需要更新的内容为空时,就会出现1111错误,也就是无效的列类型,这个时候你就要使用jdbcType.至于什么时候要使用到javaType我还没遇到过,而且我 ...

  2. problem-solving-with-algorithms-and-data-structure-usingpython(使用python解决算法和数据结构) -- 算法分析

    1. 计算前n个整数的和 def sumOfN(n): theSum = 0 for i in range(1,n+1): theSum += i return theSum print(sumOfN ...

  3. 使用vue+webpack打包时,去掉资源前缀

    在build文件夹下找到webpack.prod.conf.js文件,搜索 filename: utils.assetsPath('css/[name].[contenthash].css'), 将[ ...

  4. Vue.js 的一些小技巧

    给 props 属性设置多个类型 这个技巧在开发组件的时候用的较多,为了更大的容错性考虑,同时代码也更加人性化: export default { props: { width: { type: [S ...

  5. div实现返回符,倒三角,椭圆+小知识收集

    收集: 1,返回符(伪类元素): .back:before {content: "";width: .3rem;height: .3rem;border-left: .04rem ...

  6. C语言各类型大小,结构体大小 sizeof(struct A)

    C语言类型大小总览 编译器pack指令 #pragma pack(n)——定义n字节对齐 C++固有类型的对齐取编译器对齐与自身大小中较小的一个 32位C++默认8字节对齐.gcc编译器默认4字节对齐 ...

  7. Android Service不能再详细的教程

    这篇包含了: Service后台服务.前台服务.IntentService.跨进程服务.无障碍服务.系统服务 几乎所有Android Service相关的东西. 前言 作为四大组件之一的Service ...

  8. 带你从零学ReactNative开发跨平台App开发[expo 打包发布](八)

    ReactNative跨平台开发系列教程: 带你从零学ReactNative开发跨平台App开发(一) 带你从零学ReactNative开发跨平台App开发(二) 带你从零学ReactNative开发 ...

  9. LeetCode题解之Intersection of Two Linked Lists

    1.题目描述 2.问题分析 使用unordered_set 将链表A中的节点地址全部插入,然后使用链表B中的每个节点在A中查找. 3.代码 ListNode *getIntersectionNode( ...

  10. Windows自带强大的入侵检测工具——Netstat 命令 查询是否中木马

    Netstat命令可以帮助我们了解网络的整体使用情况.根据Netstat后面参数的不同,它可以显示不同的网络连接信息.Netstat的参数如图,下面对其中一些参数进行说明.如何检测本机是否有被中木马, ...