-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[botto-dao-base] version 1 botto dao base (#1651)
* 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
1 parent
c95e9d3
commit b173a93
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
] | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [ | ||
'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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters