Skip to content

Commit

Permalink
chore: bump to 0.3.10 and add hardhat config
Browse files Browse the repository at this point in the history
  • Loading branch information
romanagureev committed Sep 16, 2024
1 parent 3876cf0 commit ae2dc17
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 16 deletions.
11 changes: 6 additions & 5 deletions contracts/ChildGaugeFactory.vy
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# @version 0.3.7
# pragma version 0.3.10
"""
@title Child Liquidity Gauge Factory
@license MIT
@author Curve Finance
@custom:version 2.0.0
"""

version: public(constant(String[8])) = "2.0.0"
Expand Down Expand Up @@ -108,15 +109,15 @@ def _psuedo_mint(_gauge: address, _user: address):
assert gauge_data != 0 # dev: invalid gauge

# if is_mirrored and last_request != this week
if bitwise_and(gauge_data, 2) != 0 and shift(gauge_data, -2) / WEEK != block.timestamp / WEEK:
if gauge_data & 2 != 0 and (gauge_data >> 2) / WEEK != block.timestamp / WEEK:
CallProxy(self.call_proxy).anyCall(
self,
_abi_encode(_gauge, method_id=method_id("transmit_emissions(address)")),
empty(address),
1,
)
# update last request time
self.gauge_data[_gauge] = shift(block.timestamp, 2) + 3
self.gauge_data[_gauge] = block.timestamp << 2 + 3

assert ChildGauge(_gauge).user_checkpoint(_user)
total_mint: uint256 = ChildGauge(_gauge).integrate_fraction(_user)
Expand Down Expand Up @@ -257,7 +258,7 @@ def set_mirrored(_gauge: address, _mirrored: bool):
assert gauge_data != 0 # dev: invalid gauge
assert msg.sender == self.owner # dev: only owner

gauge_data = shift(shift(gauge_data, -2), 2) + 1 # set is_valid_gauge = True
gauge_data = gauge_data | 1 # set is_valid_gauge = True
if _mirrored:
gauge_data += 2 # set is_mirrored = True

Expand Down Expand Up @@ -328,4 +329,4 @@ def last_request(_gauge: address) -> uint256:
@notice Query the timestamp of the last cross chain request for emissions
@param _gauge The address of the gauge of interest
"""
return shift(self.gauge_data[_gauge], -2)
return self.gauge_data[_gauge] >> 2
5 changes: 4 additions & 1 deletion contracts/ProxyAdmin.vy
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# @version 0.3.1
# pragma version 0.3.10
"""
@title ProxyAdmin
@notice Thin proxy allowing shared ownership of contracts
@author Ben Hauser
@license MIT
@custom:version 0.0.1
"""

version: public(constant(String[8])) = "0.0.1"


event TransactionExecuted:
admin: indexed(address)
Expand Down
2 changes: 1 addition & 1 deletion contracts/Recover.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @version 0.3.1
# pragma version 0.3.10


@pure
Expand Down
7 changes: 6 additions & 1 deletion contracts/RewardForwarder.vy
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# @version 0.3.1
# pragma version 0.3.10
"""
@title Reward Forwarder
@custom:version 0.0.1
"""

version: public(constant(String[8])) = "0.0.1"


from vyper.interfaces import ERC20


Expand Down
3 changes: 2 additions & 1 deletion contracts/RootGaugeFactory.vy
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# pragma version 0.3.7
# pragma version 0.3.10
"""
@title Root Liquidity Gauge Factory
@license MIT
@author Curve Finance
@custom:version 1.0.1
"""

version: public(constant(String[8])) = "1.0.1"
Expand Down
3 changes: 2 additions & 1 deletion contracts/RootGaugeFactoryProxy.vy
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# pragma version 0.3.7
# pragma version 0.3.10
"""
@title Root Gauge Factory Proxy Owner
@license MIT
@author CurveFi
@custom:version 1.0.1
"""

version: public(constant(String[8])) = "1.0.1"
Expand Down
12 changes: 10 additions & 2 deletions contracts/Script.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @version 0.3.1
# pragma version 0.3.10


interface AnyCall:
Expand Down Expand Up @@ -43,4 +43,12 @@ def __init__(_params: GaugeParams[N_GAUGES]):

# increase execution budget for future callbacks used in deployment process
AnyCall(ANYCALL).deposit(FACTORY, value=as_wei_value(2, "ether"))
selfdestruct(msg.sender)
send(msg.sender, self.balance)


@external
def dummy() -> uint256:
"""
@dev Dummy method for brownie not to fail
"""
return max_value(uint256)
3 changes: 2 additions & 1 deletion contracts/implementations/ChildGauge.vy
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# pragma version 0.3.7
# pragma version 0.3.10
# pragma optimize gas
"""
@title CurveXChainLiquidityGauge
@license Copyright (c) Curve.Fi, 2020-2024 - all rights reserved
@author Curve.Fi
@notice Layer2/Cross-Chain Gauge
@custom:version 1.0.0
"""


Expand Down
3 changes: 2 additions & 1 deletion contracts/implementations/RootGauge.vy
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# pragma version 0.3.7
# pragma version 0.3.10
"""
@title Root Liquidity Gauge Implementation
@license MIT
@author Curve Finance
@custom:version 1.0.1
"""

version: public(constant(String[8])) = "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/MockBridger.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @version 0.3.1
# pragma version 0.3.10


@view
Expand Down
12 changes: 12 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
networks: {
hardhat: {
hardfork: "shanghai",
// base fee of 0 allows use of 0 gas price when testing
initialBaseFeePerGas: 0,
// brownie expects calls and transactions to throw on revert
throwOnTransactionFailures: true,
throwOnCallFailures: true
}
}
}
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black
eth-brownie==1.20.3
eth-brownie==1.20.6
brownie-token-tester
flake8==3.9.2
isort
Expand Down

0 comments on commit ae2dc17

Please sign in to comment.