Skip to content

Commit 41143f3

Browse files
simon-somethinggitbook-bot
authored andcommitted
GitBook: [snapshot-labs#11] syntax
1 parent 125ddc2 commit 41143f3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

strategies/how-to-write-a-basic-strategy.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ Finally, all strategies will contain some similar steps, illustrated in [erc20-b
3434

3535
* Getting the block height ('latest' or a specific one via the `snapshot` argument).
3636

37-
```typescript
37+
```
3838
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
3939
```
4040

4141
* Initializing Multicaller: looping over the addresses\[] array is **not allowed** as the strategy complexity would increase with the array size. Instead, Snapshot provides the Multicaller utility to group blockchain queries for a series of addresses. The abi can be in ethers human-readable form ( `['function balanceOf(address account) external view returns (uint256)']` for instance)
4242

43-
```typescript
43+
```
4444
const multi = new Multicaller(network, provider, abi, { blockTag });
4545
```
4646

4747
* Feeding data into the multicaller and executing the multicall: every query is queued in the multicaller via `Multicaller.call(...)`. Once they are all stored, an unique call is executed via `Multicall.execute()`. 
4848

4949
`option.address` is the token contract address (`strategy.params.address` in `examples.json`).
5050

51-
```typescript
51+
```
5252
addresses.forEach((address) =>
5353
multi.call(address, options.address, 'balanceOf', [address])
5454
);
@@ -58,7 +58,7 @@ Finally, all strategies will contain some similar steps, illustrated in [erc20-b
5858

5959
* Creating an object where every address from addresses\[] is paired with its corresponding value (returned from the multicall) and returning it
6060

61-
```typescript
61+
```
6262
return Object.fromEntries(
6363
Object.entries(result).map(([address, balance]) => [
6464
address,

0 commit comments

Comments
 (0)