Skip to content

Commit e789f42

Browse files
committed
Add balancer adapter example
1 parent 997cc11 commit e789f42

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

v2/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,47 @@ module.exports = {
9797
```
9898

9999
In case you need more flexibility pass in a function instead to return tokens or holders addresses.
100+
101+
#### ```Balancer``` adapter `tokenHolderMap` configuration
102+
```js
103+
module.exports = {
104+
...
105+
...
106+
/* required for indexing token balances */
107+
tokenHolderMap: [
108+
{
109+
holders: {
110+
pullFromLogs: true,
111+
logConfig: {
112+
target: '0x9424B1412450D0f8Fc2255FAf6046b98213B76Bd',
113+
topic: 'LOG_NEW_POOL(address,address)',
114+
keys: ['topics'],
115+
fromBlock: 9562480
116+
},
117+
transform: null,
118+
},
119+
tokens: {
120+
pullFromPools: true,
121+
abi: {
122+
constant: true,
123+
inputs: [],
124+
name: 'getCurrentTokens',
125+
outputs: [
126+
{
127+
internalType: 'address[]',
128+
name: 'tokens',
129+
type: 'address[]'
130+
}
131+
],
132+
payable: false,
133+
stateMutability: 'view',
134+
type: 'function'
135+
}
136+
}
137+
}
138+
]
139+
}
140+
```
141+
142+
In case your protocol follows factory pattern or is based on AMM model pass in log configs to pull holder addresses from smart contract events.
143+
By default we use ```(poolLog) => `0x${poolLog[2].slice(26)}`; ``` this code snippet as log ```transform``` function. Pass a different custom function if you need.

0 commit comments

Comments
 (0)