From 7535345882008732c8d0c31d4d52ad365e06e549 Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Fri, 22 Jan 2021 19:43:01 +0530 Subject: [PATCH] fetching DSA account code update --- contracts/powerResolver/compound.sol | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contracts/powerResolver/compound.sol b/contracts/powerResolver/compound.sol index 700b621..b93177a 100644 --- a/contracts/powerResolver/compound.sol +++ b/contracts/powerResolver/compound.sol @@ -33,11 +33,14 @@ contract Helpers { contract Resolver is Helpers { - function getDSAWallets(uint len) public view returns(address[] memory) { - address[] memory wallets = new address[](len); + function getDSAWallets(uint start, uint end) public view returns(address[] memory) { + assert(start < end); ListInterface list = ListInterface(0x4c8a1BEb8a87765788946D6B19C6C6355194AbEb); - uint _len = len == 0 ? uint(list.accounts()) : len; - for (uint i = 0; i < _len; i++) { + uint totalAccounts = uint(list.accounts()); + end = totalAccounts < end ? totalAccounts : end; + uint len = end - start; + address[] memory wallets = new address[](len); + for (uint i = start; i < end; i++) { wallets[i] = list.accountAddr(uint64(i+1)); } return wallets;