Skip to content

Commit

Permalink
feat: add aave v2 into lending package
Browse files Browse the repository at this point in the history
  • Loading branch information
weizard committed Nov 24, 2023
1 parent b9e8286 commit f4fc422
Show file tree
Hide file tree
Showing 33 changed files with 2,939 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/lending/src/protocol.type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as common from '@protocolink/common';
import * as core from '@protocolink/core';
import * as logics from '@protocolink/logics';

export interface Market {
id: string;
Expand Down
21 changes: 21 additions & 0 deletions packages/lending/src/protocols/aave-v2/abis/AToken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "scaledBalanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
44 changes: 44 additions & 0 deletions packages/lending/src/protocols/aave-v2/abis/DebtToken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "delegatee",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approveDelegation",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromUser",
"type": "address"
},
{
"internalType": "address",
"name": "toUser",
"type": "address"
}
],
"name": "borrowAllowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
15 changes: 15 additions & 0 deletions packages/lending/src/protocols/aave-v2/abis/ETHPriceFeed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"inputs": [],
"name": "latestAnswer",
"outputs": [
{
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"stateMutability": "view",
"type": "function"
}
]
147 changes: 147 additions & 0 deletions packages/lending/src/protocols/aave-v2/abis/LendingPool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
[
{
"inputs": [],
"name": "FLASHLOAN_PREMIUM_TOTAL",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "asset",
"type": "address"
}
],
"name": "getReserveData",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "uint256",
"name": "data",
"type": "uint256"
}
],
"internalType": "struct DataTypes.ReserveConfigurationMap",
"name": "configuration",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "liquidityIndex",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "variableBorrowIndex",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "currentLiquidityRate",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "currentVariableBorrowRate",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "currentStableBorrowRate",
"type": "uint128"
},
{
"internalType": "uint40",
"name": "lastUpdateTimestamp",
"type": "uint40"
},
{
"internalType": "address",
"name": "aTokenAddress",
"type": "address"
},
{
"internalType": "address",
"name": "stableDebtTokenAddress",
"type": "address"
},
{
"internalType": "address",
"name": "variableDebtTokenAddress",
"type": "address"
},
{
"internalType": "address",
"name": "interestRateStrategyAddress",
"type": "address"
},
{
"internalType": "uint8",
"name": "id",
"type": "uint8"
}
],
"internalType": "struct DataTypes.ReserveData",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "getUserAccountData",
"outputs": [
{
"internalType": "uint256",
"name": "totalCollateralETH",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "totalDebtETH",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "availableBorrowsETH",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "currentLiquidationThreshold",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ltv",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "healthFactor",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
40 changes: 40 additions & 0 deletions packages/lending/src/protocols/aave-v2/abis/PriceOracle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "asset",
"type": "address"
}
],
"name": "getAssetPrice",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "assets",
"type": "address[]"
}
],
"name": "getAssetsPrices",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
}
]
Loading

0 comments on commit f4fc422

Please sign in to comment.