Skip to content

Commit

Permalink
fix: rm proxy_codehash storage var + edit register caller validation
Browse files Browse the repository at this point in the history
  • Loading branch information
skellet0r committed Aug 19, 2021
1 parent b9b4028 commit 54de8c5
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions contracts/GaugeRegistry.vy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ PROXY_POST_BYTECODE: constant(Bytes[15]) = 0x5af43d82803e903d91602b57fd5bf3


factory: public(address)
proxy_codehash: public(bytes32)
chain_id: public(uint256)

gauge_count: public(uint256)
Expand All @@ -37,17 +36,17 @@ def __init__():

@external
def register(_gauge: address, _pool: address, _version: uint256):
if msg.sender.is_contract:
proxy_codehash: bytes32 = keccak256(
concat(
PROXY_PRE_BYTECODE,
slice(convert(Factory(self.factory).gauge_implementation(), bytes32), 12, 20),
PROXY_POST_BYTECODE,
)
proxy_codehash: bytes32 = keccak256(
concat(
PROXY_PRE_BYTECODE,
slice(convert(Factory(self.factory).gauge_implementation(), bytes32), 12, 20),
PROXY_POST_BYTECODE,
)
assert msg.sender.codehash == proxy_codehash
else:
assert msg.sender == AddressProvider(ADDR_PROVIDER).admin()
)
assert (
msg.sender.codehash == proxy_codehash
or msg.sender == AddressProvider(ADDR_PROVIDER).admin()
)

index: uint256 = self.gauge_count
self.gauge_list[index] = _gauge
Expand Down

0 comments on commit 54de8c5

Please sign in to comment.