Skip to content

Commit

Permalink
update feeEstimate & release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Oct 22, 2022
1 parent b1727de commit 201f5a6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = v1.1.7
current_version = v1.1.8
commit = True
tag = True

Expand Down
4 changes: 2 additions & 2 deletions addresses/address.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"veDelegation": "0xc768eDF2d21fe00ef5804A7Caa775E877e65A70E",
"veFeeDistributor": "0x256c54219816603BB8327F9019533B020a76e936",
"veDelegationProxy": "0x45E3BEc7D139Cd8Ed7FeB161F3B094688ddB0c20",
"veFeeEstimate": "0xe97a787420eD263583689Bd35B7Db1952A94710d",
"veFeeEstimate": "0x4aA261bC595abC6fDEf0255C83e2a9305261753f",
"SmartWalletChecker": "0xd7ddf62257A41cc6cdAd7A3d36e4f1d925fD142a"
},
"goerli": {
Expand Down Expand Up @@ -219,4 +219,4 @@
"Dispenser": "0x8c98ea273bA22327F896Aa1a1a46E1BFf56e9b1D",
"ERC721Factory": "0x49E35cd2bAE043Abd9074B6e5a649a5AdEB05C33"
}
}
}
33 changes: 21 additions & 12 deletions contracts/ve/veFeeEstimate.vy
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,15 @@ def _find_timestamp_user_epoch(ve: address, user: address, _timestamp: uint256,
_max = _mid - 1
return _min



@external
@internal
@view
def estimateClaim(addr: address) -> uint256:
def _estimateClaim(addr: address) -> uint256:
# Minimal user_epoch is 0 (if user had no point)
user_epoch: uint256 = 0
to_distribute: uint256 = 0
_last_token_time: uint256 = FeeDistributor(self.fee_distributor).last_token_time()
max_user_epoch: uint256 = VotingEscrow(self.voting_escrow).user_point_epoch(addr)
_start_time: uint256 = FeeDistributor(self.fee_distributor).start_time()

# if checkpoints are missing, them we cannot have an accurate estimate
# veFeeDistributor can do the checks, but requires tx and not just some call functions
if block.timestamp >= FeeDistributor(self.fee_distributor).time_cursor():
raise("Call checkpoint function")
if block.timestamp > _last_token_time + TOKEN_CHECKPOINT_DEADLINE:
raise("Call checkpoint function")

# Round down to weeks
_last_token_time = _last_token_time / WEEK * WEEK
Expand Down Expand Up @@ -161,4 +152,22 @@ def estimateClaim(addr: address) -> uint256:
week_cursor += WEEK


return to_distribute
return to_distribute

@external
@view
def estimateClaimAcc(addr: address) -> uint256:
_last_token_time: uint256 = FeeDistributor(self.fee_distributor).last_token_time()
# if checkpoints are missing, them we cannot have an accurate estimate
# veFeeDistributor can do the checks, but requires tx and not just some call functions
if block.timestamp >= FeeDistributor(self.fee_distributor).time_cursor():
raise("Call checkpoint function")
if block.timestamp > _last_token_time + TOKEN_CHECKPOINT_DEADLINE:
raise("Call checkpoint function")

return self._estimateClaim(addr)

@external
@view
def estimateClaim(addr: address) -> uint256:
return self._estimateClaim(addr)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanprotocol/contracts",
"version": "v1.1.7",
"version": "v1.1.8",
"description": "Ocean Protocol Smartcontracts",
"bugs": {
"url": "https://github.com/oceanprotocol/contracts/issues"
Expand Down
8 changes: 6 additions & 2 deletions scripts/deploy-contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ async function main() {
routerOwner = OPFOwner;
OceanTokenAddress = "0x967da4048cD07aB37855c090aAF366e4ce1b9F48";
additionalApprovedTokens = ["0x0642026E7f0B6cCaC5925b4E7Fa61384250e1701"];
gasPrice = ethers.utils.parseUnits('40', 'gwei')
sleepAmount = 30
gasPrice = ethers.utils.parseUnits('12', 'gwei')
sleepAmount = 10
shouldDeployV4 = false;
shouldDeployDF = true;
shouldDeployVE = true;
shouldDeployOPFCommunityFeeCollector = false;
break;
case 0x3:
networkName = "ropsten";
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy_ve_feeEstimate.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async function main() {
OPFOwner = "0x7DF5273aD9A6fCce64D45c64c1E43cfb6F861725";
routerOwner = OPFOwner;
OceanTokenAddress = "0x967da4048cD07aB37855c090aAF366e4ce1b9F48";
gasPrice = ethers.utils.parseUnits('25', 'gwei')
break;
case 0x3:
networkName = "ropsten";
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ocean-contracts
version = v1.1.7
version = v1.1.8
author = leucothia
author_email = [email protected]
description = 🐳 Ocean Protocol L1 - v4
Expand Down

0 comments on commit 201f5a6

Please sign in to comment.