Skip to content

Commit

Permalink
[botto-dao-base] version 1 botto dao base (#1651)
Browse files Browse the repository at this point in the history
* version 0.1 botto dao base

* removed try catch not needed

* Update src/strategies/botto-dao-base/index.ts

* updated examples

* fix in tests.

---------

Co-authored-by: Chaitanya <[email protected]>
  • Loading branch information
agustinjch and ChaituVR authored Dec 9, 2024
1 parent c95e9d3 commit b173a93
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/strategies/botto-dao-base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Botto Dao Governance strategy

It returns the BOTTO balance of the voters participating in the governance and in the liquidity mining program

Here is an example of parameters:
```json
[
{
"name": "Botto Dao Governance strategy",
"strategy": {
"name": "botto-dao",
"params": {
"token": "0x9dfad1b7102d46b1b197b90095b5c4e9f5845bba",
"stakingAddress": "0x19CD3998f106eCC40eE7668c19C47e18b491e8a6",
"miningAddress": "0xf8515Cae6915838543bCD7756F39268CE8F853Fd",
"liquidityAddress": "0x9ff68f61ca5eb0c6606dc517a9d44001e564bb66",
"symbol": "BOTTO",
"decimals": 18
}
},
"network": "1",
"addresses": [
"0xf2b10b41961f6bc3801e7946dabe5572158a78a5",
"0xea32cf979bdaf8d3bb4121d58515d4623a27f3e0",
"0x7173d417cfa1cdec794fa21f4ca8a71d181b2ca0",
"0x58787f1659b2fd8853918dab6d4a1565569e6044",
"0x7dbc5f88986db946f1d5987edfbf9c6917230fa2"
],
"snapshot": 13808330
}
]

```
24 changes: 24 additions & 0 deletions src/strategies/botto-dao-base/examples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"name": "Botto Dao Base Governance strategy",
"strategy": {
"name": "botto-dao-base",
"params": {
"token": "0x24914cb6bd01e6a0cf2a9c0478e33c25926e6a0c",
"stakingAddress": "0x8a7a5991aAf142B43E58253Bd6791e240084F0A9",
"symbol": "BOTTO",
"decimals": 18
}
},
"network": "8453",
"addresses": [
"0x85D906C217Bb4c7b7f7CDE0D4318fAfa02f6F01d",
"0x276Dfeec6F5772156B19116d76D1E3DEB3B6F0b4",
"0x56768B032Fc12D2e911eF654B0054e26a58cef74",
"0x7173d417cfa1cdec794fa21f4ca8a71d181b2ca0",
"0x58787f1659b2fd8853918dab6d4a1565569e6044",
"0x7dbc5f88986db946f1d5987edfbf9c6917230fa2"
],
"snapshot": 23250193
}
]
47 changes: 47 additions & 0 deletions src/strategies/botto-dao-base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { BigNumberish } from '@ethersproject/bignumber';
import { formatUnits } from '@ethersproject/units';
import { Multicaller } from '../../utils';

export const author = 'agustinjch';
export const version = '1.0.0';

const abi = [

Check failure on line 8 in src/strategies/botto-dao-base/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `⏎··'function·userStakes(address)·external·view·returns(uint256)'⏎` with `'function·userStakes(address)·external·view·returns(uint256)'`
'function userStakes(address) external view returns(uint256)'
];

export async function strategy(
space,
network,
provider,
addresses,
options,
snapshot
): Promise<Record<string, number>> {
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
const _formatUnits = (value) =>
parseFloat(formatUnits(value, options.decimals));

const multiBalances = new Multicaller(network, provider, abi, {
blockTag
});

addresses.forEach((address) => {
multiBalances.call(
address + '-stakedBotto',
options.stakingAddress,
'userStakes',
[address]
);
});

const balances: Record<string, BigNumberish> = await multiBalances.execute();

const result = Object.fromEntries(
addresses.map((adr) => {
const stakedBotto = _formatUnits(balances[adr + '-stakedBotto'] || 0);
return [adr, stakedBotto];
})
);

return result;
}
2 changes: 2 additions & 0 deletions src/strategies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ import * as orangeReputationNftBasedVoting from './orange-reputation-nft-based-v
import * as squidDao from './squid-dao';
import * as pathBalanceStakedAndLocked from './path-balance-staked-and-locked';
import * as bottoDao from './botto-dao';
import * as bottoDaoBase from './botto-dao-base';
import * as genart from './genart';
import * as erc721MultiRegistryWeighted from './erc721-multi-registry-weighted';
import * as balancerPoolid from './balancer-poolid';
Expand Down Expand Up @@ -718,6 +719,7 @@ const strategies = {
'orange-reputation-nft-based-voting': orangeReputationNftBasedVoting,
'squid-dao': squidDao,
'botto-dao': bottoDao,
'botto-dao-base': bottoDaoBase,
genart,
'path-balance-staked-and-locked': pathBalanceStakedAndLocked,
'balancer-poolid': balancerPoolid,
Expand Down

0 comments on commit b173a93

Please sign in to comment.