def add_strategy_snap(self, calls): super().add_strategy_snap(calls) strategy = self.manager.strategy calls.append( Call( strategy.vaultFarm(), [func.rewardPool.earned, strategy.address], [["vaultFarm.earned.strategy", as_wei]], )) calls.append( Call( strategy.vaultFarm(), [func.rewardPool.balanceOf, strategy.address], [["vaultFarm.staked.strategy", as_wei]], )) calls.append( Call( strategy.metaFarm(), [func.rewardPool.earned, strategy.address], [["metaFarm.earned.strategy", as_wei]], )) calls.append( Call( strategy.metaFarm(), [func.rewardPool.balanceOf, strategy.address], [["metaFarm.staked.strategy", as_wei]], )) return calls
def add_sett_snap(self, calls): sett = self.manager.sett calls.append( Call(sett.address, [func.sett.balance], [["sett.balance", as_wei]])) calls.append( Call(sett.address, [func.sett.available], [["sett.available", as_wei]])) calls.append( Call(sett.address, [func.sett.getPricePerFullShare], [["sett.pricePerFullShare", as_wei]])) calls.append( Call(sett.address, [func.erc20.totalSupply], [["sett.totalSupply", as_wei]])) return calls
def add_strategy_snap(self, calls): strategy = self.manager.strategy staking_rewards_address = strategy.geyser() super().add_strategy_snap(calls) calls.append( Call( staking_rewards_address, [func.erc20.balanceOf, strategy.address], [["stakingRewards.staked", as_wei]], )) calls.append( Call( staking_rewards_address, [func.rewardPool.earned, strategy.address], [["stakingRewards.earned", as_wei]], )) return calls
def add_entity_balances_for_tokens(self, calls, tokenKey, token, entities): for entityKey, entity in entities.items(): calls.append( Call( token.address, [func.erc20.balanceOf, entity], [["balances." + tokenKey + "." + entityKey, as_wei]], )) return calls
def add_entity_shares_for_tokens(self, calls, tokenKey, token, entities): for entityKey, entity in entities.items(): calls.append( Call( token.address, [func.digg.sharesOf, entity], [["shares." + tokenKey + "." + entityKey, as_wei]], )) return calls
def add_strategy_snap(self, calls): super().add_strategy_snap(calls) sett = self.manager.sett strategy = self.manager.strategy calls.append( Call( strategy.diggFaucet(), [func.diggFaucet.earned], [["diggFaucet.earned", as_wei]], )) # Sett Shares calls.append( Call( sett.address, [func.sett.shares], [["sett.shares", as_wei]], )) # Strategy Shares calls.append( Call( strategy.address, [func.strategy.sharesOf], [["strategy.sharesOf", as_wei]], )) calls.append( Call( strategy.address, [func.strategy.sharesOfPool], [["strategy.sharesOfPool", as_wei]], )) calls.append( Call( strategy.address, [func.strategy.sharesOfWant], [["strategy.sharesOfWant", as_wei]], )) return calls
def __call__(self): aggregate = Call( MULTICALL_ADDRESSES[web3.eth.chainId], "aggregate((address,bytes)[])(uint256,bytes[])", ) args = [[[call.target, call.data] for call in self.calls]] block, outputs = aggregate(args) result = {} for call, output in zip(self.calls, outputs): result.update(call.decode_output(output)) return result
def add_strategy_snap(self, calls, entities=None): strategy = self.manager.strategy pancake_chef_address = strategy.chef() super().add_strategy_snap(calls) if entities: for entityKey, entity in entities.items(): calls.append( Call( pancake_chef_address, [func.pancakeChef.userInfo, self.wantPid, entity], [["pancakeChef.userInfo.want." + entityKey, as_wei]], )) calls.append( Call( pancake_chef_address, [func.pancakeChef.userInfo, self.cakePid, entity], [["pancakeChef.userInfo.cake." + entityKey, as_wei]], )) return calls
def add_strategy_snap(self, calls): strategy = self.manager.strategy calls.append( Call( strategy.address, [func.strategy.balanceOfPool], [["strategy.balanceOfPool", as_wei]], ) ) calls.append( Call( strategy.address, [func.strategy.balanceOfWant], [["strategy.balanceOfWant", as_wei]], ) ) calls.append( Call( strategy.address, [func.strategy.balanceOf], [["strategy.balanceOf", as_wei]], ) ) calls.append( Call( strategy.address, [func.strategy.withdrawalFee], [["strategy.withdrawalFee", as_wei]], ) ) calls.append( Call( strategy.address, [func.strategy.performanceFeeGovernance], [["strategy.performanceFeeGovernance", as_wei]], ) ) calls.append( Call( strategy.address, [func.strategy.performanceFeeStrategist], [["strategy.performanceFeeStrategist", as_wei]], ) ) return calls