Skip to Content
精通区块链
book

精通区块链

by Lorne Lantz, Daniel Cawrey
March 2022
Intermediate to advanced
293 pages
5h 31m
Chinese
China Electric Power Press Ltd.
Content preview from 精通区块链
196 7
以下是将闪贷智能合约发布到
Ropsten
网络所需的步骤。
1.
复制智能合约代码(你可以在
GitHub
上找到它),并将其粘贴到
Remix
中。
2.
使用编译器版本
0.6.6+commit.6c089d02
编译代码(要查看编译器版本,
请点击
Remix IDE
左上角第三个按钮)。
3.
将代码发布到
Ropsten
环境中。一定要在
Deploy
按钮旁边的字段中输入
Aave LendingPoolAddressProvider
合约的地址。这个参数会在创建闪贷合
同时传递给构造函数方法;它主要是告诉闪贷合同在借款时如何与
Aave
通信。
4.
Remix
中点击
Deploy
,然后在
MetaMask
中确认部署。
闪贷智能合约现在的地址如下。
0x978e5f2149024D5742476Bc2d3b5B820926537A2
7.5.3
执行闪贷
要执行一笔闪贷,请构造一笔交易去调用函数
flashloan(address _asset)
在这个例子中,我们要执行一笔闪贷,借入
1
DAI
。闪贷合约是在
Ropsten
环境中,所以我们需要传递的参数是
Ropsten
DAI
代币合约的地址。这个
地址是
0xf80a32a835f79d7787e8a8ee5721d0feafd78108
请记住,
Aave
会收取一定的费用,如果
Flashloan
合约无法支付该费用,就
会出现错误。为了确保你能支付这笔费用,请确保
Flashloan
合约持有至少
0.0009 DAI
。可以使用以太坊上的智能合约工具进行铸币,然后将资金转入 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu
编写整洁的Python代码(第2版)

编写整洁的Python代码(第2版)

Posts & Telecom Press, Mariano Anaya

Publisher Resources

ISBN: 9787519863166