def __repr__(self): return "Schedule(sett={},token={},initalTokensLocked={},startTime={},duration={} days,endTime={}".format( self.sett, self.token, self.initialTokensLocked, to_utc_date(self.startTime), to_days(self.duration), to_utc_date(self.endTime), )
def printState(self, title): console.print( "\n[yellow]=== 🦡 Rewards Schedule: {} 🦡 ===[/yellow]".format( title)) table = [] rewardsEscrow = self.badger.rewardsEscrow for key, amount in self.amounts.items(): geyser = self.badger.getGeyser(key) assert rewardsEscrow.isApproved(geyser) """ function signalTokenLock( address geyser, address token, uint256 amount, uint256 durationSec, uint256 startTime ) """ encoded = rewardsEscrow.signalTokenLock.encode_input( geyser, self.badger.token, amount, self.duration, self.start) table.append([ key, geyser, self.badger.token, val(amount), to_utc_date(self.start), to_utc_date(self.end), to_days(self.duration), val(self.tokensPerDay(amount)), self.badger.rewardsEscrow, encoded, ]) print( tabulate( table, headers=[ "key", "geyser", "token", "total amount", "start time", "end time", "duration", "rate per day", "destination", "encoded call", ], tablefmt="rst", )) print("total distributed: ", val(self.total))
def print_logger_unlock_schedules(self, beneficiary, name=None): logger = self.rewardsLogger schedules = logger.getAllUnlockSchedulesFor(beneficiary) if not name: name = "" console.print(f"[cyan]=== Latest Unlock Schedules {name}===[/cyan]") table = [] if len(schedules) == 0: return for schedule in schedules: print(schedule) s = LoggerUnlockSchedule(schedule) digg_shares = s.token == self.digg.token if digg_shares: scaled = shares_to_fragments(s.amount) else: scaled = val(amount=s.amount, token=s.token) table.append([ name, s.beneficiary, s.token, scaled, to_days(s.duration), to_utc_date(s.start), to_utc_date(s.end), "{:.0f}".format(s.start), "{:.0f}".format(s.end), ]) print( tabulate( table, headers=[ "name", "beneficiary", "token", "amount", "duration", "start", "end", "start", "end", ], )) print("\n")
def print_latest_unlock_schedules(self, geyser, name=None): if not name: name = "" console.print(f"[cyan]=== Latest Unlock Schedules {name}===[/cyan]") table = [] tokens = geyser.getDistributionTokens() for token in tokens: schedules = geyser.getUnlockSchedulesFor(token) num_schedules = geyser.unlockScheduleCount(token) if num_schedules == 0: continue last_schedule = num_schedules - 1 s = UnlockSchedule(token, schedules[last_schedule]) digg_shares = token == self.digg.token if digg_shares: scaled = shares_to_fragments(s.amount) else: scaled = val(amount=s.amount, token=token) table.append([ name, token, scaled, to_days(s.duration), to_utc_date(s.start), to_utc_date(s.end), "{:.0f}".format(s.start), "{:.0f}".format(s.end), ]) print( tabulate( table, headers=[ "geyser", "token", "amount", "duration", "start", "end", "start", "end", ], )) print("\n")
def printState(self, title): console.print( "\n[yellow]=== 🦡 Rewards Schedule: {} 🦡 ===[/yellow]".format( title)) table = [] rewardsEscrow = self.badger.rewardsEscrow for key, dist in self.distributions.items(): if key == "native.digg": continue print(key, dist) geyser = self.badger.getGeyser(key) print(geyser) assert rewardsEscrow.isApproved(geyser) for asset, value in dist.toGeyser.items(): """ function signalTokenLock( address geyser, address token, uint256 amount, uint256 durationSec, uint256 startTime ) """ encoded = rewardsEscrow.signalTokenLock.encode_input( geyser, asset_to_address(asset), value, self.duration, self.start) asset_contract = interface.IERC20(asset_to_address(asset)) scaled = val(value, decimals=18) if asset == "digg": scaled = val(shares_to_fragments(value), decimals=9) table.append([ key, # geyser, asset, value, scaled, to_utc_date(self.start), to_utc_date(self.end), to_days(self.duration), # geyser.address, # encoded, ]) print( tabulate( table, headers=[ "key", # "geyser", "token", "total amount", "scaled amount", "start time", "end time", "duration", # "rate per day", # "destination", # "encoded call", ], tablefmt="rst", )) print("total distributed for {}: ".format(asset), val(self.totals[asset]))