Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit a193aab

Browse files
authored
[orderly-staked-order] feat: orderly staked order strategy (#1775)
* feat: orderly staked order strategy * feat: orderly staked order use multicall
1 parent 6666adf commit a193aab

4 files changed

Lines changed: 89 additions & 1 deletion

File tree

src/strategies/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ import * as prlInSpRL2Balance from './prl-in-sprl2-balance';
489489
import * as edenOnlineOverride from './eden-online-override';
490490
import * as forteStaking from './forte-staking';
491491
import * as overtime from './overtime';
492+
import * as orderlyStakedOrder from './orderly-staked-order';
492493

493494
import { DEFAULT_SUPPORTED_PROTOCOLS } from '../constants';
494495

@@ -991,7 +992,8 @@ const strategies = {
991992
'prl-in-sprl2-balance': prlInSpRL2Balance,
992993
'eden-online-override': edenOnlineOverride,
993994
'forte-staking': forteStaking,
994-
overtime
995+
overtime,
996+
'orderly-staked-order': orderlyStakedOrder
995997
};
996998

997999
Object.keys(strategies).forEach(function (strategyName) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# orderly-staked-order
2+
3+
This strategy calculates voting power based on staked ORDER and esORDER tokens on the Orderly Network.
4+
5+
The strategy queries the OmniVault contract to get staking information for each address, including both ORDER and esORDER balances. Both token types contribute equally to the voting power (1 point each).
6+
7+
## How it works
8+
9+
1. Uses the provided network and RPC provider
10+
2. Calls `getStakingInfo(address)` on the OmniVault contract via Multicaller
11+
3. Returns `orderBalance + esOrderBalance` as the total voting power
12+
13+
## Parameters
14+
15+
This strategy doesn't require any parameters as it uses a hardcoded contract address.
16+
17+
```json
18+
{}
19+
```
20+
21+
## Contract
22+
23+
- **OmniVault**: 0x7819704B69a38fD63Cc768134b8410dc08B987D0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"name": "Example query",
4+
"strategy": {
5+
"name": "orderly-staked-order"
6+
},
7+
"network": "291",
8+
"addresses": [
9+
"0xd51C5283b8727206bf9Be2b2DB4e5673EfAF519C",
10+
"0xb5fa15414334db658648163d16b36288c246d938",
11+
"0xb620d75b59bbf0adb20a630c8ecaee8e9cede0c0",
12+
"0x4a6CA5F866AccF53f582990611eee174FaBd8110",
13+
"0x5b19847a2f61048a2efaa41cc6270f4534538571"
14+
],
15+
"snapshot": 22845985
16+
}
17+
]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { BigNumberish } from '@ethersproject/bignumber';
2+
import { formatUnits } from '@ethersproject/units';
3+
import { Multicaller } from '../../utils';
4+
5+
export const author = 'Tarnadas';
6+
export const version = '0.1.0';
7+
8+
const ORDERLY_OMNIVAULT_ADDRESS = '0x7819704B69a38fD63Cc768134b8410dc08B987D0';
9+
const ORDERLY_DECIMALS = 18;
10+
11+
const abi = [
12+
'function getStakingInfo(address _user) external view returns (uint256 orderBalance, uint256 esOrderBalance)'
13+
];
14+
15+
export async function strategy(
16+
space,
17+
network,
18+
provider,
19+
addresses: string[],
20+
options,
21+
snapshot: number | 'latest'
22+
): Promise<Record<string, number>> {
23+
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
24+
25+
const multi = new Multicaller(network, provider, abi, {
26+
blockTag
27+
});
28+
29+
addresses.forEach((address) =>
30+
multi.call(address, ORDERLY_OMNIVAULT_ADDRESS, 'getStakingInfo', [address])
31+
);
32+
33+
const result: Record<string, [BigNumberish, BigNumberish]> =
34+
await multi.execute();
35+
36+
return Object.fromEntries(
37+
Object.entries(result).map(([address, stakingInfo]) => {
38+
const orderBalance = stakingInfo[0];
39+
const esOrderBalance = stakingInfo[1];
40+
const totalScore =
41+
parseFloat(formatUnits(orderBalance, ORDERLY_DECIMALS)) +
42+
parseFloat(formatUnits(esOrderBalance, ORDERLY_DECIMALS));
43+
return [address, totalScore];
44+
})
45+
);
46+
}

0 commit comments

Comments
 (0)