Skip to content
1 change: 1 addition & 0 deletions coins/src/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,5 @@ export default {
rhea: require("./markets/rhea"),
bracket: require("./yield/bracket"),
goblin: require("./markets/goblin"),
axlp: require("./liquidStaking/axlp"),
};
15 changes: 15 additions & 0 deletions coins/src/adapters/liquidStaking/axlp/abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"getPrice":{
"inputs": [],
"name": "price",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
}
36 changes: 36 additions & 0 deletions coins/src/adapters/liquidStaking/axlp/axlp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import abi from "./abi.json"
import { call } from "@defillama/sdk/build/abi/index";
import { Write, } from "../../utils/dbInterfaces";
import { addToDBWritesList, } from "../../utils/database";
import tokens from "./tokens.json";

export default async function getTokenPrice(timestamp: number) {
const writes: Write[] = [];
return contractCalls(writes, timestamp);
}


async function contractCalls(
writes: Write[],
timestamp: number,
) {
await Promise.all(tokens.chains.map(async (item) => {
const amlpPrice = await call({
target: item.amlp.stakingContract,
chain: item.chain,
abi: abi.getPrice
})
const mPrice = amlpPrice.output / 10 ** 18

addToDBWritesList(writes, item.chain, item.amlp.token, mPrice, 18, item.amlp.symbol, timestamp, 'amlp', item.amlp.rate)

const ahlpPrice = await call({
target: item.ahlp.stakingContract,
chain: item.chain,
abi: abi.getPrice
})
const hPrice = ahlpPrice.output / 10 ** 18
addToDBWritesList(writes, item.chain, item.ahlp.token, hPrice, 18, item.ahlp.symbol, timestamp, 'ahlp', item.ahlp.rate)
}))
return writes
}
5 changes: 5 additions & 0 deletions coins/src/adapters/liquidStaking/axlp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import getTokenPrices from "./axlp";

export function axlp(timestamp: number = 0) {
return getTokenPrices(timestamp);
}
19 changes: 19 additions & 0 deletions coins/src/adapters/liquidStaking/axlp/tokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"chains": [
{
"chain": "arbitrum",
"amlp": {
"symbol": "sAMLP",
"token": "0xbC08F30c18a79a3a18dBbd40931C551F91EDB9dB",
"stakingContract": "0x3a66b81be26f2d799C5A96A011e1E3FB2BA50999",
"rate": 1.0
},
"ahlp": {
"symbol": "sAHLP",
"token": "0x50c30f24b957B1ac9e31558e55Bf7dc4ab685eA9",
"stakingContract": "0x1ba274EBbB07353657ed8C76A87ACf362E408D85",
"rate": 1.0
}
}
]
}