App
contract App
Contract for upgradeable applications. It handles the creation of proxies.
Index
Reference
Events
PackageChanged
event PackageChanged(string providerName, address package, uint64[] version)
Emitted when a package dependency is changed in the application.
- Parameters:
providerName
- Name of the package that changed.package
- Address of the package associated to the name.version
- Version of the package in use.
ProxyCreated
event ProxyCreated(address proxy)
Emitted when a new proxy is created.
- Parameters:
proxy
- Address of the created proxy.
Functions
create
function create(string packageName, string contractName, address admin, bytes data) public payable returns (AdminUpgradeabilityProxy)
Creates a new proxy for the given contract and forwards a function call to it. This is useful to initialize the proxied contract.
- Parameters:
packageName
- Name of the package where the contract is contained.contractName
- Name of the contract.admin
- Address of the proxy administrator.data
- Data to send as msg.data to the corresponding implementation to initialize the proxied contract. It should include the signature and the parameters of the function to be called, as described in https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.- Returns:
- Address of the new proxy.
fallback
function () public
Constructor function.
getImplementation
function getImplementation(string packageName, string contractName) public view returns (address)
Returns the implementation address for a given contract name, provided by the `ImplementationProvider`.
- Parameters:
packageName
- Name of the package where the contract is contained.contractName
- Name of the contract.- Returns:
- Address where the contract is implemented.
getPackage
function getPackage(string packageName) public view returns (Package, uint64[])
Returns information on a package given its name.
- Parameters:
packageName
- Name of the package to be queried.- Returns:
- A tuple with the package address and pinned version given a package name, or zero if not set
getProvider
function getProvider(string packageName) public view returns (ImplementationProvider)
Returns the provider for a given package name, or zero if not set.
- Parameters:
packageName
- Name of the package to be retrieved.- Returns:
- The provider.
setPackage
function setPackage(string packageName, Package package, uint64[] version) public
Sets a package in a specific version as a dependency for this application. Requires the version to be present in the package.
- Modifiers:
- onlyOwner
- Parameters:
packageName
- Name of the package to set or overwrite.package
- Address of the package to register.version
- Version of the package to use in this application.
unsetPackage
function unsetPackage(string packageName) public
Unsets a package given its name. Reverts if the package is not set in the application.
- Modifiers:
- onlyOwner
- Parameters:
packageName
- Name of the package to remove.