BaseApp
contract BaseApp
is Ownable
Abstract base contract for upgradeable applications. It handles the creation and upgrading of proxies.
Index
Reference
Functions
changeProxyAdmin
function changeProxyAdmin(AdminUpgradeabilityProxy proxy, address newAdmin) public
Changes the admin of a proxy.
- Modifiers:
- onlyOwner
- Parameters:
proxy
- Proxy to change admin.newAdmin
- Address to transfer proxy administration to.
create
function create(string contractName) public returns (AdminUpgradeabilityProxy)
Creates a new proxy for the given contract.
- Parameters:
contractName
- Name of the contract.- Returns:
- Address of the new proxy.
createAndCall
function createAndCall(string contractName, 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:
contractName
- Name of the contract.data
- Data to send as msg.data in the low level call. It should include the signature and the parameters of the function to be called, as described in https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector-and-argument-encoding.- Returns:
- Address of the new proxy.
fallback
function (UpgradeabilityProxyFactory _factory) public
Constructor function.
- Parameters:
_factory
- Proxy factory
getImplementation
function getImplementation(string contractName) public view returns (address)
Returns the implementation address for a given contract name, provided by the `ImplementationProvider`.
- Parameters:
contractName
- Name of the contract.- Returns:
- Address where the contract is implemented.
getProvider
abstract function getProvider() internal view returns (ImplementationProvider)
Abstract function to return the implementation provider.
- Returns:
- The implementation provider.
getProxyAdmin
function getProxyAdmin(AdminUpgradeabilityProxy proxy) public view returns (address)
Returns the admin of a proxy. Only the admin can query it.
- Parameters:
proxy
- AdminUpgradeabilityProxy- Returns:
- The address of the current admin of the proxy.
getProxyImplementation
function getProxyImplementation(AdminUpgradeabilityProxy proxy) public view returns (address)
Returns the current implementation of a proxy. This is needed because only the proxy admin can query it.
- Parameters:
proxy
- AdminUpgradeabilityProxy- Returns:
- The address of the current implementation of the proxy.
upgrade
function upgrade(AdminUpgradeabilityProxy proxy, string contractName) public
Upgrades a proxy to the newest implementation of a contract.
- Modifiers:
- onlyOwner
- Parameters:
proxy
- Proxy to be upgraded.contractName
- Name of the contract.
upgradeAndCall
function upgradeAndCall(AdminUpgradeabilityProxy proxy, string contractName, bytes data) public payable
Upgrades a proxy to the newest implementation of a contract and forwards a function call to it. This is useful to initialize the proxied contract.
- Modifiers:
- onlyOwner
- Parameters:
proxy
- Proxy to be upgraded.contractName
- Name of the contract.data
- Data to send as msg.data in the low level call. It should include the signature and the parameters of the function to be called, as described in https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector-and-argument-encoding.