Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added current epoch fees to LP Sugar. #17

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions contracts/LpSugar.vy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ struct Lp:
account_staked: uint256

pool_fee: uint256
token0_fees: uint256
token1_fees: uint256

struct LpEpochReward:
token: address
Expand Down Expand Up @@ -113,6 +115,7 @@ interface IPool:
def decimals() -> uint8: view
def stable() -> bool: view
def balanceOf(_account: address) -> uint256: view
def poolFees() -> address: view

interface IVoter:
def gauges(_pool_addr: address) -> address: view
Expand Down Expand Up @@ -281,7 +284,9 @@ def toMigrate(_account: address) -> DynArray[Lp, MAX_POOLS]:
account_earned: earned,
account_staked: account_staked,

pool_fee: 0
pool_fee: 0,
token0_fees: 0,
token1_fees: 0
}))

return pools
Expand Down Expand Up @@ -447,6 +452,9 @@ def _byData(_data: address[3], _account: address) -> Lp:
emissions_token: address = empty(address)
is_stable: bool = pool.stable()
pool_fee: uint256 = 0
pool_fees: address = pool.poolFees()
token0: IERC20 = IERC20(pool.token0())
token1: IERC20 = IERC20(pool.token1())

if gauge.address != empty(address):
acc_staked = gauge.balanceOf(_account)
Expand All @@ -465,11 +473,11 @@ def _byData(_data: address[3], _account: address) -> Lp:
stable: is_stable,
total_supply: pool.totalSupply(),

token0: pool.token0(),
token0: token0.address,
reserve0: pool.reserve0(),
claimable0: pool.claimable0(_account),

token1: pool.token1(),
token1: token1.address,
reserve1: pool.reserve1(),
claimable1: pool.claimable1(_account),

Expand All @@ -488,7 +496,9 @@ def _byData(_data: address[3], _account: address) -> Lp:
account_earned: earned,
account_staked: acc_staked,

pool_fee: pool_fee
pool_fee: pool_fee,
token0_fees: token0.balanceOf(pool_fees),
token1_fees: token1.balanceOf(pool_fees)
})

@external
Expand Down
2 changes: 1 addition & 1 deletion env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ REGISTRY_ADDRESS=0xF4c67CdEAaB8360370F41514d06e32CcD8aA1d7B
V1_VOTER_ADDRESS=0x09236cfF45047DBee6B921e00704bed6D6B8Cf7e
DIST_ADDRESS=0x9D4736EC60715e71aFe72973f7885DCBC21EA99b
CONVERTOR_ADDRESS=0x585Af0b397AC42dbeF7f18395426BF878634f18D
LP_SUGAR_ADDRESS=0x3b21531Bd00289f10C7D8B64b9389095f521A4d3
LP_SUGAR_ADDRESS=0xD2B1D1B75a0f226722b3A174dAE54e6dD14af1a1
VE_SUGAR_ADDRESS=0xd17C022Cc2eCAd8ed94a5656F74B3BCBeC38859A
11 changes: 7 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Below is the list of datasets we support.

### Liquidity Pools Data

`LpSugar.vy` is deployed at `0x8b70c5e53235abbd1415957f7110fbfe5d0529d4`
`LpSugar.vy` is deployed at `0xD2B1D1B75a0f226722b3A174dAE54e6dD14af1a1`

It allows fetching on-chain pools data.
The returned data/struct of type `Lp` values represent:
Expand All @@ -54,14 +54,17 @@ The returned data/struct of type `Lp` values represent:
* `gauge` - pool gauge address
* `gauge_total_supply` - pool staked tokens (less/eq than/to pool total supply)
* `gauge_alive` - indicates if the gauge is still active
* `fee` - pool fees contract address
* `bribe` - pool bribes contract address
* `fee` - pool gauge fees contract address
* `bribe` - pool gauge bribes contract address
* `factory` - pool factory address
* `emissions` - pool emissions (per second)
* `emissions_token` - pool emissions token address
* `account_balance` - account Lp tokens balance
* `account_earned` - account earned emissions for this pool
* `account_staked` - account pool staked in gauge balance
* `pool_fee` - pool swap fee (percentage)
* `token0_fees` - current epoch token0 accrued fees (next week gauge fees)
* `token1_fees` - current epoch token1 accrued fees (next week gauge fees)

---

Expand Down Expand Up @@ -131,7 +134,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 `0x925A0d9d2000c4919e7BF0a0d5F2995a2bfE8542`
`VeSugar.vy` is deployed at `0x9591B50366d82291e4e2BF88ffE52C3B39c8999a`

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