Giter Club home page Giter Club logo

aavev2-liquidation-example's Introduction

Aave V2 Liquidation Example

This repo demostrates how a liquidation strategy works on Aave V2 Ethereum Mainnet using foundry.

Installation and Setup

1. Install foundry, if you haven't already.

2. Clone This Repo

Run the following command.

git clone https://github.com/yuichiroaoki/aaveV2-liquidation-example.git

Demo

1. Get Ethereum Mainnet RPC URL

You can get one from Alchemy website for free.

2. Compile Smart Contracts

Run the following command.

forge build

3. Execute a Liquidation Call ๐Ÿ”ฅ

Replace <your alchemy rpc url> with the Ethereum Mainnet RPC URL you get from step 1 and run the following command. This will run test/Liquidation.t.sol, a test contract for src/Liquidation.sol on the Ethereum Mainnet fork network on your local machine.

forge test -vv --fork-url <your alchemy rpc url> --fork-block-number 15780157 --mp test/Liquidation.t.sol

Expected Outputs

Running 4 tests for test/Liquidation.t.sol:LiquidationTest
[PASS] testCollateralAsset() (gas: 10099)
[PASS] testDebtBalance() (gas: 10061)
[PASS] testFlashloan() (gas: 727761)
Logs:
  Earned  25916384485813682 MKR

[PASS] testHealthFactor() (gas: 157336)
Logs:
  health factor 999477489095341547

Test result: ok. 4 passed; 0 failed; finished in 6.29ms

References

AaveV2 Docs / GitHub

Transaction Details

aavev2-liquidation-example's People

Contributors

yuichiroaoki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.