Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MuesliW committed Jan 14, 2025
2 parents c34fa84 + 5085d1c commit 19e3a14
Show file tree
Hide file tree
Showing 5,480 changed files with 125,256 additions and 70,003 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module.exports = {
"rules": {
"no-case-declarations": "off",
"no-unused-vars": "off",
"no-useless-escape": "warn",
"no-prototype-builtins": "off",
"no-unreachable": "off",
}
}
4 changes: 2 additions & 2 deletions .github/workflows/alert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- uses: actions/checkout@v2
- name: Update unlisted
run: curl https://born-to-llama.herokuapp.com/refresh
- name: Deploy to server
run: curl https://born-to-llama.herokuapp.com/rebuild-server
# - name: Deploy to server
# run: curl https://born-to-llama.herokuapp.com/rebuild-server
16 changes: 9 additions & 7 deletions .github/workflows/commentResult.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { readFileSync } = require('fs');
const axios = require('axios');
const junk = 'VPTOH1X0B7rf8od7BGNsQ1z0BJk8iMNLxqrD';
const junk = 'rmicl\x1Eefn]JsfjoHoGRpWOt3_u@L_LpTUc_BLf0T/i/mXC';

async function main() {
const [, , log, author, repo, pr, path ] = process.argv;
Expand All @@ -16,7 +16,7 @@ async function main() {
body = `The adapter at ${path} exports TVL:
\n \n ${file.substring(summaryIndex + 17).replaceAll('\n', '\n ')}`;
} else if (errorIndex != -1) {
body = `Error while running adapter at ${path}:
body = `Error while running adapter at ${path ?? ''}:
\n \n ${file.split(errorString)[1].replaceAll('\n', '\n ')}`;
} else
return;
Expand All @@ -25,12 +25,14 @@ async function main() {
`https://api.github.com/repos/${author}/${repo}/issues/${pr}/comments`,
{ body }, {
headers: {
Authorization: `token ghp_${translate(junk)}`,
Authorization: scramble(junk),
Accept: 'application/vnd.github.v3+json'
}
});
};
function translate(input) {
return input ? translate(input.substring(1)) + input[0] : input;
};
main();
function scramble(str) {
return str.split('').reduce((a, b) => {
return a + String.fromCharCode(b.charCodeAt(0) + 2);
}, '');
}
main();
4 changes: 2 additions & 2 deletions .github/workflows/getFileList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const fileSet = new Set();

[...MODIFIED, ...ADDED].forEach(file => {
const [root, dir] = file.split('/')
if (dir === 'treasury') fileSet.add(file)
if (dir === 'treasury' || dir === 'entities') fileSet.add(file)
else if (root === 'projects' && dir !=='helper' && dir !== 'config') fileSet.add(root + '/' + dir)
})

console.log(JSON.stringify([...fileSet]))

function parse(data) {
return data.replace('[', '').replace(']', '').split(',')
}
}
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ jobs:
npm ci
# npm update @defillama/sdk
# fail if package.json or package-lock.json is changed
FILES_MODIFIED=${{ steps.file_changes.outputs.files_modified }}
if [[ $FILES_MODIFIED == *"package.json"* || $FILES_MODIFIED == *"package-lock.json"* ]]; then
echo "------ ERROR ------ > Please revert changes to package.json / package-lock.json" > /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/output.txt
node ${{ github.workspace }}/.github/workflows/commentResult.js /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/output.txt "${{ github.repository_owner }}" "${{ github.event.repository.name }}" "${{ github.event.number }}"
exit 1
fi
for i in $(echo $RUN_FILES | tr -d '"[]' | tr "," "\n")
do
{
Expand All @@ -48,4 +56,6 @@ jobs:
done
- name: Run ESLint
uses: eslint/github-action@v0
run: |
npm ci
npm run lint
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ historical-data.js
/.idea
yarn.lock
.DS_Store
projects/pooltogether/index.js
.vscode
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore all files
*
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Also, don't hesitate to send a message on [our discord](https://discord.defillam
> If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters)
> - If you would like to add a `liquidations` adapter, please refer to [this readme document](https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/liquidations) for details.
1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
2. Please enable "Allow edits by maintainers" while putting up the PR.
3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
1. PLEASE PLEASE **enable "Allow edits by maintainers" while putting up the PR.**
2. Once your adapter has been merged, it takes time to show on the UI. No need to notify us on Discord.
3. TVL must be computed from blockchain data (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap
Expand All @@ -25,8 +25,10 @@ This is a work in progress. The goal is to eventually handle historical data. De
If you have any suggestions, want to contribute or want to chat, please join [our discord](https://discord.defillama.com/) and drop a message.

## Testing adapters
```
```bash
node test.js projects/pangolin/index.js
# Add a timestamp at the end to run the adapter at a historical timestamp
node test.js projects/aave/v3.js 1729080692
```

## Changing RPC providers
Expand All @@ -38,3 +40,6 @@ POLYGON_RPC="..."
```

The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://github.com/DefiLlama/defillama-sdk/blob/master/src/providers.json)

## Adapter rules
- Never add extra npm packages, if you need a chain-level package for your chain, ask us and we'll consider it, but we can't accept any npm package that is project-specific
Binary file added bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions liquidations/aave-v2/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as sdk from "@defillama/sdk";
import { gql, request } from "graphql-request";
import { Liq } from "../utils/types";
import { getPagedGql } from "../utils/gql";
Expand Down Expand Up @@ -75,14 +76,14 @@ const rc: { [chain in Chains]: AaveAdapterResource } = {
name: "aave",
chain: Chains.ethereum,
usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v2",
subgraphUrl: sdk.graph.modifyEndpoint('8wR23o1zkS4gpLqLNU4kG3JHYVucqGyopL5utGxP2q1N'),
explorerBaseUrl: "https://etherscan.io/address/",
},
// [Chains.polygon]: {
// name: "aave",
// chain: Chains.polygon,
// usdcAddress: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
// subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/aave-v2-matic",
// subgraphUrl: sdk.graph.modifyEndpoint('H1Et77RZh3XEf27vkAmJyzgCME2RSFLtDS2f4PPW6CGp'),
// explorerBaseUrl: "https://polygonscan.com/address/",
// },
};
Expand Down
3 changes: 2 additions & 1 deletion liquidations/benqi/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
Expand All @@ -12,7 +13,7 @@ import {
totalCollateralValueInUsd,
} from "../utils/compound-helpers";

const subgraphUrl = "https://api.thegraph.com/subgraphs/name/yhayun/benqi";
const subgraphUrl = sdk.graph.modifyEndpoint('HcTvZi3fwucvRJvVmtFzNDTnomvMBk64xCLNQQg6GPAV');

const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
Expand Down
3 changes: 2 additions & 1 deletion liquidations/compound/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
Expand All @@ -12,7 +13,7 @@ import {
totalCollateralValueInUsd,
} from "../utils/compound-helpers";

const subgraphUrl = "https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2";
const subgraphUrl = sdk.graph.modifyEndpoint('AAva7YSZBLar4MaxQ3MqdJDFXkkHEaCDeibKTnraex1x');

const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
Expand Down
3 changes: 2 additions & 1 deletion liquidations/euler/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/types";

const subgraphUrl = "https://api.thegraph.com/subgraphs/name/euler-xyz/euler-mainnet";
const subgraphUrl = sdk.graph.modifyEndpoint('EQBXhrF4ppZy9cBYnhPdrMCRaVas6seNpqviih5VRGmU');

const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
Expand Down
24 changes: 12 additions & 12 deletions liquidations/mimo-protocol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ const latestRoundDataABI = {
enum Chain {
ethereum = "ethereum",
polygon = "polygon",
fantom = "fantom",
// fantom = "fantom",
}

const getEURUSD = async (chain: Chain) => {
const oracleAddresses = {
[Chain.ethereum]: "0xb49f677943bc038e9857d61e7d053caa2c1734c1",
[Chain.polygon]: "0x73366fe0aa0ded304479862808e02506fe556a98",
[Chain.fantom]: "0x3e68e68ea2c3698400465e3104843597690ae0f7",
// [Chain.fantom]: "0x3e68e68ea2c3698400465e3104843597690ae0f7",
};

const eurUSDRoundData = await sdk.api.abi.call({
Expand All @@ -49,18 +49,18 @@ const getSubgraphUrl = (chain: Chain) => {

switch (chain) {
case Chain.ethereum: {
subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titan";
subgraphUrl = sdk.graph.modifyEndpoint('FV3Dw1zMs97LpVPegWZKJv4bsbsZdrob2EqLCPxdcoDS');
break;
}
case Chain.polygon: {
subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titanpolygon";
break;
}
case Chain.fantom: {
subgraphUrl =
"https://api.thegraph.com/subgraphs/name/rayxpub/titanfantom";
subgraphUrl = sdk.graph.modifyEndpoint('EfFLqiwngmmtE5su2t1EsFoEttoj8KWervocfab1ofYT');
break;
}
// case Chain.fantom: {
// subgraphUrl =
// sdk.graph.modifyEndpoint('DkSQLWkkiNfeNG43NJnHsW9hfih8hDt4SHFTNMQgPHJH');
// break;
// }
}

return subgraphUrl;
Expand Down Expand Up @@ -194,7 +194,7 @@ module.exports = {
polygon: {
liquidations: positions(Chain.polygon),
},
fantom: {
liquidations: positions(Chain.fantom),
},
// fantom: {
// liquidations: positions(Chain.fantom),
// },
};
22 changes: 22 additions & 0 deletions liquidations/navi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Liq } from "../utils/types";
import axios from "axios";

const liquidations = async () => {
const info = await axios.get("https://api-defi.naviprotocol.io/estimateLiquidateUser");

return info.data.map(
({ owner, liqPrice, collateral, collateralAmount }) =>
({
owner,
liqPrice,
collateral,
collateralAmount,
} as Liq)
);
};

module.exports = {
sui: {
liquidations,
},
};
3 changes: 2 additions & 1 deletion liquidations/trader-joe-lend/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/types";

const subgraphUrl = "https://api.thegraph.com/subgraphs/name/traderjoe-xyz/lending";
const subgraphUrl = sdk.graph.modifyEndpoint('JB5EdQqbddMjawMLYe3C5ifmhN9WKYvLdgAKoUy1CyYy');

const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
Expand Down
2 changes: 1 addition & 1 deletion liquidations/venus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "../utils/compound-helpers";
const sdk = require("@defillama/sdk");

const subgraphUrl = "https://api.thegraph.com/subgraphs/name/venusprotocol/venus-subgraph";
const subgraphUrl = sdk.graph.modifyEndpoint('7h65Zf3pXXPmf8g8yZjjj2bqYiypVxems5d8riLK1DyR');

const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
Expand Down
Loading

0 comments on commit 19e3a14

Please sign in to comment.