Compound Borrow Examples 项目教程

Compound Borrow Examples 项目教程

compound-borrow-examplesCode examples for borrowing Ethereum assets from the Compound Protocol.项目地址:https://gitcode.com/gh_mirrors/co/compound-borrow-examples

1. 项目的目录结构及介绍

compound-borrow-examples/
├── contracts/
│   ├── MyContracts.sol
├── examples-js/
│   ├── ethers-js/
│   │   ├── borrow-eth-with-erc20-collateral.js
│   ├── compound-js/
│   │   ├── borrow-erc20-with-eth-collateral.js
│   │   ├── borrow-eth-with-erc20-collateral.js
├── examples-solidity/
│   ├── compound-js/
│   │   ├── borrow-erc20-via-solidity.js
│   │   ├── borrow-eth-via-solidity.js
│   ├── web3-js/
│   │   ├── borrow-erc20-via-solidity.js
│   │   ├── borrow-eth-via-solidity.js
├── scripts/
├── .gitignore
├── LICENSE
├── README.md
├── contracts.json
├── hardhat.config.js
├── package-lock.json
├── package.json

目录结构介绍

  • contracts/: 包含Solidity智能合约文件。
  • examples-js/: 包含使用JavaScript进行借贷操作的示例代码。
    • ethers-js/: 使用Ethers.js库的示例。
    • compound-js/: 使用Compound.js库的示例。
  • examples-solidity/: 包含使用Solidity进行借贷操作的示例代码。
    • compound-js/: 使用Compound.js库的Solidity示例。
    • web3-js/: 使用Web3.js库的Solidity示例。
  • scripts/: 包含一些脚本文件。
  • .gitignore: Git忽略文件。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • contracts.json: 合约配置文件。
  • hardhat.config.js: Hardhat配置文件。
  • package-lock.json: 依赖锁定文件。
  • package.json: 项目依赖和脚本配置文件。

2. 项目的启动文件介绍

JavaScript示例

  • examples-js/ethers-js/borrow-eth-with-erc20-collateral.js: 使用Ethers.js库借入ETH并使用ERC20代币作为抵押。
  • examples-js/compound-js/borrow-erc20-with-eth-collateral.js: 使用Compound.js库借入ERC20代币并使用ETH作为抵押。
  • examples-js/compound-js/borrow-eth-with-erc20-collateral.js: 使用Compound.js库借入ETH并使用ERC20代币作为抵押。

Solidity示例

  • examples-solidity/compound-js/borrow-erc20-via-solidity.js: 使用Compound.js库通过Solidity借入ERC20代币。
  • examples-solidity/compound-js/borrow-eth-via-solidity.js: 使用Compound.js库通过Solidity借入ETH。
  • examples-solidity/web3-js/borrow-erc20-via-solidity.js: 使用Web3.js库通过Solidity借入ERC20代币。
  • examples-solidity/web3-js/borrow-eth-via-solidity.js: 使用Web3.js库通过Solidity借入ETH。

3. 项目的配置文件介绍

hardhat.config.js

Hardhat配置文件,用于配置Hardhat开发环境,包括网络设置、编译器版本等。

module.exports = {
  solidity: "0.8.0",
  networks: {
    hardhat: {
      chainId: 1337
    }
  }
};

package.json

项目依赖和脚本配置文件,包含项目名称、版本、依赖库和脚本命令等。

{
  "name": "compound-borrow-examples",
  "version": "1.0.0",
  "dependencies": {
    "ethers": "^5.0.0

compound-borrow-examplesCode examples for borrowing Ethereum assets from the Compound Protocol.项目地址:https://gitcode.com/gh_mirrors/co/compound-borrow-examples

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

昌寒庆Quillan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值