Skip to content

Commit

Permalink
Enhance StakingAuRa.setErc20TokenContract function
Browse files Browse the repository at this point in the history
it shouldn't let set token contract in which the balance of StakingAuRa contract is already non-zero
  • Loading branch information
varasev committed Aug 16, 2019
1 parent 2c3c208 commit 2f3449b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions contracts/StakingAuRa.sol
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ contract StakingAuRa is UpgradeableOwned, IStakingAuRa {
/// @param _erc20TokenContract The address of the contract.
function setErc20TokenContract(IERC20Minting _erc20TokenContract) external onlyOwner onlyInitialized {
require(_erc20TokenContract != IERC20Minting(0));
require(_erc20TokenContract.balanceOf(address(this)) == 0);
require(!erc20Restricted);
erc20TokenContract = _erc20TokenContract;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"upgradeability_BaseAdminUpgradeabilityProxy",
"upgradeability_BaseUpgradeabilityProxy",
"upgradeability_Proxy",
"upgradeability_UpgradeabilityAdminSlot",
"upgradeability_UpgradeabilityAdmin",
"upgradeability_UpgradeabilityProxy",
"upgradeability_UpgradeableOwned"
],
Expand Down
1 change: 1 addition & 0 deletions test/mockContracts/ERC677BridgeTokenRewardableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ contract ERC677BridgeTokenRewardable is ERC677BridgeToken {

function setStakingContract(address _stakingContract) onlyOwner public {
require(_stakingContract != address(0) && isContract(_stakingContract));
require(balanceOf(_stakingContract) == 0);
stakingContract = _stakingContract;
}

Expand Down

0 comments on commit 2f3449b

Please sign in to comment.