Skip to content

Commit

Permalink
refactor: use block.timestamp for timepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ethzoomer committed Oct 28, 2023
1 parent 3aab396 commit 064e13d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions contracts/VeSugar.vy
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ interface IVotingEscrow:
def delegates(_venft_id: uint256) -> uint256: view

interface IGovernor:
def clock() -> uint48: view
def getVotes(_venft_id: uint256, _timepoint: uint256) -> uint256: view

# Vars
Expand Down Expand Up @@ -155,8 +154,7 @@ def _byId(_id: uint256) -> VeNFT:
amount, expires_at, perma = self.ve.locked(_id)
last_voted: uint256 = 0

timepoint: uint256 = convert(self.gov.clock(), uint256)
governance_amount: uint256 = self.gov.getVotes(_id, timepoint - 1)
governance_amount: uint256 = self.gov.getVotes(_id, block.timestamp)

delegate_id: uint256 = self.ve.delegates(_id)

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ To fetch a list of rewards for a specific veNFT, this method is available:

### Vote-Escrow Locked NFT (veNFT) Data

`VeSugar.vy` is deployed at `0x3B3dce7385e19F3582c8C0f9431b7d0998856626`
`VeSugar.vy` is deployed at `0x86651B1E97428689EAc93bDE47B294CfB887408c`

It allows fetching on-chain veNFT data (including the rewards accrued).
The returned data/struct of type `VeNFT` values represent:
Expand Down

0 comments on commit 064e13d

Please sign in to comment.