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

Commit 3cb1625

Browse files
vladanthalesVladan ThalesChaituVR
authored
[overtime] Overtime strategy (#1762)
* Change Base subgraph URL for Thales strategy * Update src/strategies/thales/index.ts Co-authored-by: Chaitanya <yourchaitu@gmail.com> * Overtime strategy * Remove resetting smartAccount voting power --------- Co-authored-by: Vladan Thales <vladan@thalesmarket.io> Co-authored-by: Chaitanya <yourchaitu@gmail.com>
1 parent d2b1e74 commit 3cb1625

File tree

4 files changed

+88
-1
lines changed

4 files changed

+88
-1
lines changed

src/strategies/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ import * as pufferGetPastVotes from './puffer-getpastvotes';
486486
import * as prlInSpRL2Balance from './prl-in-sprl2-balance';
487487
import * as edenOnlineOverride from './eden-online-override';
488488
import * as forteStaking from './forte-staking';
489+
import * as overtime from './overtime';
489490

490491
import { DEFAULT_SUPPORTED_PROTOCOLS } from '../constants';
491492

@@ -985,7 +986,8 @@ const strategies = {
985986
'puffer-getpastvotes': pufferGetPastVotes,
986987
'prl-in-sprl2-balance': prlInSpRL2Balance,
987988
'eden-online-override': edenOnlineOverride,
988-
'forte-staking': forteStaking
989+
'forte-staking': forteStaking,
990+
overtime
989991
};
990992

991993
Object.keys(strategies).forEach(function (strategyName) {

src/strategies/overtime/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Overtime Strategy
2+
3+
A governance strategy designed for Overtime.
4+
Voting power is determined by the $OVER token balance. If the address is a smart contract account, the voting power is assigned to their externally owned account (EOA) owner.
5+
6+
## Examples
7+
8+
Here is an example of parameters:
9+
10+
```JSON
11+
{
12+
"address": "0xedf38688b27036816a50185caa430d5479e1c63e",
13+
"symbol": "OVER",
14+
"decimals": 18,
15+
"eoaToSmartAccountMapApi": "https://overdrop.overtime.io/eoa-smart-account-map"
16+
}
17+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"name": "Example query OP",
4+
"strategy": {
5+
"name": "overtime",
6+
"params": {
7+
"address": "0xedf38688b27036816a50185caa430d5479e1c63e",
8+
"symbol": "OVER",
9+
"decimals": 18,
10+
"eoaToSmartAccountMapApi": "https://overdrop.overtime.io/eoa-smart-account-map"
11+
}
12+
},
13+
"network": "10",
14+
"addresses": [
15+
"0x9f8e4ee788D9b00A3409584E18034aA7B736C396",
16+
"0x3e09230ed70b667256BBaf1FDf949050D312D066",
17+
"0x7d2824F1825da25072011B3e326025172E404b15",
18+
"0x3320EE0189aAD77b3aB570a00464Ce7a45B6E465",
19+
"0x28b2Be30b0AE526aF0cB94984B750d4C35e913c0",
20+
"0xc8038Fb922764405aF919A02BDd2792A36566074",
21+
"0x0D858351A5FB419C9A3760647900d2F7aD526c83"
22+
],
23+
"snapshot": 137587693
24+
}
25+
]

src/strategies/overtime/index.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { customFetch } from '../../utils';
2+
import { strategy as erc20BalanceOfStrategy } from '../erc20-balance-of';
3+
4+
export const author = 'thales-markets';
5+
export const version = '1.0.0';
6+
7+
export async function strategy(
8+
space,
9+
network,
10+
provider,
11+
addresses,
12+
options,
13+
snapshot
14+
): Promise<Record<string, number>> {
15+
const scores = await erc20BalanceOfStrategy(
16+
space,
17+
network,
18+
provider,
19+
addresses,
20+
options,
21+
snapshot
22+
);
23+
24+
const response = await customFetch(options.eoaToSmartAccountMapApi, {
25+
method: 'GET',
26+
headers: {
27+
Accept: 'application/json',
28+
'Content-Type': 'application/json'
29+
}
30+
});
31+
const eoaToSmartAccountMapping = await response.json();
32+
33+
for (let i = 0; i < Object.keys(scores).length; i++) {
34+
const address = Object.keys(scores)[i];
35+
const smartAccount = eoaToSmartAccountMapping[address];
36+
// If the current address has a mapped smart account, add the smart account's score to the owner's score
37+
if (smartAccount !== undefined) {
38+
scores[address] = scores[address] + scores[smartAccount];
39+
}
40+
}
41+
42+
return scores;
43+
}

0 commit comments

Comments
 (0)