Package
contract Package
is Ownable
Collection of contracts grouped into versions. Contracts with the same name can have different implementation addresses in different versions.
Reference
Events
VersionAdded
event VersionAdded(string version, ImplementationProvider provider)
Emitted when a version is added to the package. XXX The version is not indexed due to truffle testing constraints.
- Parameters:
version
- Name of the added version.provider
- ImplementationProvider associated with the version.
Functions
addVersion
function addVersion(string version, ImplementationProvider provider) public
Adds the implementation provider of a new version to the package.
- Modifiers:
- onlyOwner
- Parameters:
version
- Name of the version.provider
- ImplementationProvider associated with the version.
getImplementation
function getImplementation(string version, string contractName) public view returns (address)
Returns the implementation address for a given version and contract name.
- Parameters:
version
- Name of the version.contractName
- Name of the contract.- Returns:
- Address where the contract is implemented.
getVersion
function getVersion(string version) public view returns (ImplementationProvider)
Returns the implementation provider of a version.
- Parameters:
version
- Name of the version.- Returns:
- The implementation provider of the version.
hasVersion
function hasVersion(string version) public view returns (bool)
Checks whether a version is present in the package.
- Parameters:
version
- Name of the version.- Returns:
- true if the version is already in the package, false otherwise.