* Change import path from zos-lib to upgrades in all contracts * Update readme with new naming * Update package and deps names * Change path to initializable in AST of networks.jsons * Migrate manifest version * Use new oz file locations * Rename in ERC20Migrator comments * Update SDK install instructions in README * Update gitignore to use new session file name * trigger CI * Fixes to readme and package version * Use 2.5.0 release of OpenZeppelin SDK
51 lines
1.2 KiB
Solidity
51 lines
1.2 KiB
Solidity
pragma solidity ^0.5.2;
|
|
|
|
import "@openzeppelin/upgrades/contracts/Initializable.sol";
|
|
|
|
/**
|
|
* @title Secondary
|
|
* @dev A Secondary contract can only be used by its primary account (the one that created it)
|
|
*/
|
|
contract Secondary is Initializable {
|
|
address private _primary;
|
|
|
|
event PrimaryTransferred(
|
|
address recipient
|
|
);
|
|
|
|
/**
|
|
* @dev Sets the primary account to the one that is creating the Secondary contract.
|
|
*/
|
|
function initialize(address sender) public initializer {
|
|
_primary = sender;
|
|
emit PrimaryTransferred(_primary);
|
|
}
|
|
|
|
/**
|
|
* @dev Reverts if called from any account other than the primary.
|
|
*/
|
|
modifier onlyPrimary() {
|
|
require(msg.sender == _primary);
|
|
_;
|
|
}
|
|
|
|
/**
|
|
* @return the address of the primary.
|
|
*/
|
|
function primary() public view returns (address) {
|
|
return _primary;
|
|
}
|
|
|
|
/**
|
|
* @dev Transfers contract to a new primary.
|
|
* @param recipient The address of new primary.
|
|
*/
|
|
function transferPrimary(address recipient) public onlyPrimary {
|
|
require(recipient != address(0));
|
|
_primary = recipient;
|
|
emit PrimaryTransferred(_primary);
|
|
}
|
|
|
|
uint256[50] private ______gap;
|
|
}
|