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

Minor fixes to vyper registry #121

Merged
merged 1 commit into from
Oct 26, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,12 @@ def __init__():

@public
def transferOwner(newOwner: address):
"""
Change ownership of contract.
"""
assert self.owner == msg.sender
self.owner = newOwner


@public
def getReleaseId(packageName: bytes32, version: bytes32) -> bytes32:
"""
Return the `release_id` associated with a given package name and release version.
"""
releaseConcat: bytes[64] = concat(packageName, version)
releaseId: bytes32 = sha3(releaseConcat)
assert self.releases[releaseId].exists
Expand Down Expand Up @@ -96,8 +90,8 @@ def getPackageData(packageName: bytes32) -> (bytes32, bytes32, int128):
def getAllPackageIds(
offset: uint256, length: uint256
) -> (bytes32, bytes32, bytes32, bytes32, bytes32):
offset_int: int128 = convert(offset, "int128")
length_int: int128 = convert(length, "int128")
offset_int: int128 = convert(offset, int128)
length_int: int128 = convert(length, int128)
assert length_int == 5
assert offset_int <= self.packageCount
ids: bytes32[5]
Expand All @@ -112,10 +106,7 @@ def getAllPackageIds(

@private
def generatePackageReleaseId(packageId: bytes32, count: int128) -> bytes32:
"""
Create the package_release_id associated with a given package_id and a release count.
"""
countBytes: bytes32 = convert(count, "bytes32")
countBytes: bytes32 = convert(count, bytes32)
packageReleaseTag: bytes[64] = concat(packageId, countBytes)
packageReleaseId: bytes32 = sha3(packageReleaseTag)
return packageReleaseId
Expand All @@ -125,8 +116,8 @@ def generatePackageReleaseId(packageId: bytes32, count: int128) -> bytes32:
def getAllReleaseIds(
packageName: bytes32, offset: uint256, length: uint256
) -> (bytes32, bytes32, bytes32, bytes32, bytes32):
offset_int: int128 = convert(offset, "int128")
length_int: int128 = convert(length, "int128")
offset_int: int128 = convert(offset, int128)
length_int: int128 = convert(length, int128)
assert length_int == 5
packageId: bytes32 = sha3(packageName)
assert self.packages[packageId].exists
Expand Down Expand Up @@ -182,9 +173,6 @@ def cutRelease(

@public
def release(name: bytes32, version: bytes32, uri: bytes32) -> bytes32:
"""
Return a relase_id after publishing a release.
"""
assert uri != self.EMPTY_BYTES
assert name != self.EMPTY_BYTES
assert version != self.EMPTY_BYTES
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
'ipfsapi>=0.4.3,<1',
'jsonschema>=2.6.0,<3',
'protobuf>=3.0.0,<4',
'py-solc>=2.1.0,<3',
'pytest-ethereum>=0.1.3a.1,<1',
'py-solc>=3.2.0,<4',
'rlp>=1.0.1,<2',
'web3[tester]>=4.7,<5',
],
Expand Down