#
IGitConsensus
Matt Stam (@mattstam)
IGitConsensus
The interface for Git Consensus.
Errors IGitConsensusErrors
, Events IGitConsensusEvents
, and Types IGitConsensusTypes
are seperated in different interfaces for clarity and unit testing purposes.
#
Methods
#
addCommit
function addCommit(IGitConsensusTypes.CommitData commitData) external nonpayable returns (bytes20 commitHash)
Notarizes a commit on-chain, building the hash trustlessly from the commit data. Stores the commit such that tagExists()
returns true for this commit hash, and tagAddr()
returns the owner address. Emits a IGitConsensusEvents.CommitAdded
#
Parameters
#
Returns
#
addRelease
function addRelease(IGitConsensusTypes.TagData tagData, bytes20[] hashes, uint256[] values) external nonpayable returns (bytes20 tagHash)
#
Parameters
#
Returns
#
hashAddr
function hashAddr(bytes20 gitHash) external view returns (address addr)
#
Parameters
#
Returns
#
hashExists
function hashExists(bytes20 gitHash) external view returns (bool exists)
Check if a git hash exists, indicating that the corresponding commit or tag has been notarized in the contract via addCommit()
or addRelease()
previously.
#
Parameters
#
Returns
#
Events
#
CommitAdded
event CommitAdded(address indexed ownerAddr, bytes20 commitHash)
Emitted when a commit is added via addCommit()
.
#
Parameters
#
ReleaseAdded
event ReleaseAdded(address indexed tokenAddr, bytes20 tagHash)
Emitted when a release is added via addRelease()
.
#
Parameters
#
Errors
#
CommitMsgNeedsAddr
error CommitMsgNeedsAddr(string message)
When commit message does not contain a valid address.
Can occur with addCommit()
. Specifically occurs when the message does not contain 0x followed by enough length for an address (40 hex characters).
#
Parameters
#
DistributionLengthMismatch
error DistributionLengthMismatch(uint256 hashesLen, uint256 valuesLen)
When distribution hashes/owner array length and values array length do not match.
Can occur with addRelease()
.
#
Parameters
#
SubstringOutOfBounds
error SubstringOutOfBounds(uint256 offset, uint256 substringLen, uint256 stringLen)
When the sender attempts to extract a substring that is out of bounds in a string.
Can occur with addCommit()
or addRelease()
.
#
Parameters
#
TagMsgNeedsAddr
error TagMsgNeedsAddr(string message)
When tag message does not contain a valid address.
Can occur with addRelease()
. Specifically occurs when the message does not contain 0x followed by enough length for an address (40 hex characters).
#
Parameters
#
UnauthorizedRelease
error UnauthorizedRelease(address senderAddr, address expectedAddr)
When a release attempt occurs from a sender other than the project's governor.
Can occur with addRelease()
.