Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Arbitrum chain to existing Lockon protocol adapter #12697

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions projects/lockon/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
const START_TIMESTAMP = 1690340140; // 2023-07-26T02:55:40Z
const CONTROLLER_ADDRESS = "0x153e739B8823B277844Ad885A30AC5bD9DfB6E83"

async function tvl(api) {
const sets = await api.call({ abi: "address[]:getSets", target: CONTROLLER_ADDRESS, })
const tokens = await api.multiCall({ abi: 'address[]:getComponents', calls: sets})
const ownerTokens = sets.map((set, i) => [tokens[i], set])
return api.sumTokens({ ownerTokens })
const config = {
polygon: {
controllerAddress: "0x153e739B8823B277844Ad885A30AC5bD9DfB6E83",
},
arbitrum: {
controllerAddress: "0xA36c2B06aFc96Ffd52d148Ed6acbB9fe2Ab864Be",
}
}

module.exports = {
start: START_TIMESTAMP,
polygon: { tvl }
function tvlExport({controllerAddress}) {
return async function tvl(api) {
const sets = await api.call({ abi: "address[]:getSets", target: controllerAddress, })
const tokens = await api.multiCall({ abi: 'address[]:getComponents', calls: sets})
const ownerTokens = sets.map((set, i) => [tokens[i], set])
return api.sumTokens({ ownerTokens })
}

}

module.exports.start = START_TIMESTAMP
Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: tvlExport(config[chain])
}
})
Loading