diff --git a/src/strategies/overtime/examples.json b/src/strategies/overtime/examples.json index 474db78c7..f3c0696d3 100644 --- a/src/strategies/overtime/examples.json +++ b/src/strategies/overtime/examples.json @@ -13,7 +13,6 @@ "network": "10", "addresses": [ "0x9f8e4ee788D9b00A3409584E18034aA7B736C396", - "0x3e09230ed70b667256BBaf1FDf949050D312D066", "0x7d2824F1825da25072011B3e326025172E404b15", "0x3320EE0189aAD77b3aB570a00464Ce7a45B6E465", "0x28b2Be30b0AE526aF0cB94984B750d4C35e913c0", diff --git a/src/strategies/overtime/index.ts b/src/strategies/overtime/index.ts index b67377f7d..5741fcf14 100644 --- a/src/strategies/overtime/index.ts +++ b/src/strategies/overtime/index.ts @@ -2,7 +2,7 @@ import { customFetch } from '../../utils'; import { strategy as erc20BalanceOfStrategy } from '../erc20-balance-of'; export const author = 'thales-markets'; -export const version = '1.0.0'; +export const version = '1.0.1'; export async function strategy( space, @@ -12,15 +12,6 @@ export async function strategy( options, snapshot ): Promise> { - const scores = await erc20BalanceOfStrategy( - space, - network, - provider, - addresses, - options, - snapshot - ); - const response = await customFetch(options.eoaToSmartAccountMapApi, { method: 'GET', headers: { @@ -30,6 +21,25 @@ export async function strategy( }); const eoaToSmartAccountMapping = await response.json(); + // Build a list of smart account addresses, and pass it to the base strategy along with the initial addresses. + const smartAccountAddresses: string[] = []; + for (let i = 0; i < addresses.length; i++) { + const address = addresses[i]; + const smartAccount = eoaToSmartAccountMapping[address]; + if (smartAccount !== undefined) { + smartAccountAddresses.push(smartAccount); + } + } + + const scores = await erc20BalanceOfStrategy( + space, + network, + provider, + [...addresses, ...smartAccountAddresses], + options, + snapshot + ); + for (let i = 0; i < Object.keys(scores).length; i++) { const address = Object.keys(scores)[i]; const smartAccount = eoaToSmartAccountMapping[address];