Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
pragma solidity >=0.8.0 <0.9.0;
//Copyright of DataX Protocol contributors
// SPDX-License-Identifier: BSU-1.1
contract Admin {
address public admin;
address public pendingAdmin;
constructor() {
admin = msg.sender;
}
modifier adminOnly() {
require(msg.sender == admin, "admin only");
_;
}
/*********************/
/**** Admin *****/
/*********************/
/**
* Request a new admin to be set for the contract.
*
* @param newAdmin New admin address
*/
function setPendingAdmin(address newAdmin) public adminOnly {
pendingAdmin = newAdmin;
}
/**
* Accept admin transfer from the current admin to the new.
*/
function acceptPendingAdmin() public {
require(
msg.sender == pendingAdmin && pendingAdmin != address(0),
"Caller must be the pending admin"
);
admin = pendingAdmin;
pendingAdmin = address(0);
}
}