Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/strategies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ import * as fountainhead from './fountainhead';
import * as naymsStaking from './nayms-staking';
import * as morphoDelegation from './morpho-delegation';
import * as lizcoinStrategy2024 from './lizcoin-strategy-2024';
import * as realt from './realt';

const strategies = {
'delegatexyz-erc721-balance-of': delegatexyzErc721BalanceOf,
Expand Down Expand Up @@ -946,7 +947,8 @@ const strategies = {
fountainhead,
'nayms-staking': naymsStaking,
'morpho-delegation': morphoDelegation,
'lizcoin-strategy-2024': lizcoinStrategy2024
'lizcoin-strategy-2024': lizcoinStrategy2024,
realt
};

Object.keys(strategies).forEach(function (strategyName) {
Expand Down
5 changes: 5 additions & 0 deletions src/strategies/realt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# reALT

## Description

The reALT strategy calculates the total balance of a user's holdings in the reALT token and their shares in the reALT Strategy on the Ethereum mainnet.
20 changes: 20 additions & 0 deletions src/strategies/realt/examples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"name": "Example query",
"strategy": {
"name": "realt",
"params": {
"address": "0xf96798f49936efb1a56f99ceae924b6b8359affb",
"symbol": "reALT",
"decimals": 18
}
},
"network": "1",
"addresses": [
"0x15de7B6a83ee7735EA00Dc4a0506059cDA4Bef49",
"0x16Ce1B15ed1278921d7Cae34Bf60a81227CFC295",
"0x16f665dA6D806760aFC317ee29Ef2feF2Ff4976E"
],
"snapshot": 21488157
}
]
52 changes: 52 additions & 0 deletions src/strategies/realt/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { BigNumberish, BigNumber } from '@ethersproject/bignumber';
import { formatUnits } from '@ethersproject/units';
import { Multicaller } from '../../utils';

export const author = 'altlayer';
export const version = '0.1.0';

export async function strategy(
space,
network,
provider,
addresses,
options,
snapshot
): Promise<Record<string, number>> {
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
const reAltStrategy = "0x6075546538c3eFbD607ea6aFC24149fCcFb2edF4"; // reALT Strategy Mainnet

const balanceOfMulticaller = new Multicaller(network, provider, [
'function balanceOf(address account) external view returns (uint256)',
], { blockTag });
addresses.forEach((address) => {
if (address !== reAltStrategy) {
balanceOfMulticaller.call(address, options.address, 'balanceOf', [address]);
}
});

const sharesMulticaller = new Multicaller(network, provider, [
'function shares(address user) external view returns (uint256)',
], { blockTag });

addresses.forEach((address) =>
sharesMulticaller.call(address, reAltStrategy, 'shares', [address])
);

const [balanceOfResults, sharesResults]: [Record<string, BigNumberish>, Record<string, BigNumberish>] = await Promise.all([
balanceOfMulticaller.execute(),
sharesMulticaller.execute()
]);

return Object.fromEntries(
addresses.map((address) => {
const balanceOf = balanceOfResults[address] || BigNumber.from(0);
const shares = sharesResults[address] || BigNumber.from(0);
const totalBalance = BigNumber.from(balanceOf).add(BigNumber.from(shares));
return [
address,
parseFloat(formatUnits(totalBalance, options.decimals))
];
})
);
}
34 changes: 34 additions & 0 deletions src/strategies/realt/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Strategy",
"definitions": {
"Strategy": {
"title": "Strategy",
"type": "object",
"properties": {
"symbol": {
"type": "string",
"title": "Symbol",
"examples": ["e.g. reALT"],
"maxLength": 16
},
"address": {
"type": "string",
"title": "Contract address",
"examples": ["e.g. 0xf96798f49936efb1a56f99ceae924b6b8359affb"],
"pattern": "^0x[a-fA-F0-9]{40}$",
"minLength": 42,
"maxLength": 42
},
"decimals": {
"type": "number",
"title": "Decimals",
"examples": ["e.g. 18"],
"minimum": 0
}
},
"required": ["address", "decimals"],
"additionalProperties": false
}
}
}
Loading