...move中闪贷的实现
让我们阅读move官方代码库中的案例,了解sui move中如何实现闪贷。
有三个重要结构:
* FlashLender
```solidity
struct FlashLender has key {
id: UID,
/// Coins available to be lent to prospective borrowers
...
...约。
想从前端调用一个地址的币的余额,web3JS 如下做了合约实例化和方法调用:
```
var tokenInstance = new web3js.eth.Contract(tokenABI,"0x6721A1802768D82Df3C113275A4286d6FfCa940E");
tokenInstance.methods.balanceOf("0xCC52C6dF34126e9A00D05766312d1d785241da5...
...,将 lib.rs 文件中的代码替换为以下内容。这段代码实现了通过 CPI 调用 System Program 进行 Sol 转账的功能。为了帮助新手更好地理解,代码中附带了详细的注释:
``` rust
#![allow(clippy::result_large_err)] // 允许编译器忽略关于大错...