Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Referee for TBR and TK #455

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ contract RefereeUpgradeTest is AccessControlEnumerableUpgradeable {

// Mapping for amount of assigned keys of a user
mapping(address => uint256) public assignedKeysOfUserCount;

// Referee Calculations contract address
address public refereeCalculationsAddress;

// Mapping to store all of the pool submissions
mapping(uint256 => mapping(address => BulkSubmission)) public bulkSubmissions;

// Referee Calculations contract address
address public refereeCalculationsAddress;
uint256 private _count;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/Base64Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "../../upgrades/referee/Referee9.sol";
import "../../upgrades/referee/Referee10.sol";

interface IAggregatorV3Interface {
function latestAnswer() external view returns (int256);
Expand Down Expand Up @@ -292,13 +292,13 @@ contract NodeLicense8 is ERC721EnumerableUpgradeable, AccessControlUpgradeable

function startAirdrop(address refereeAddress) external onlyRole(AIRDROP_ADMIN_ROLE) {
mintingPaused = true;
Referee9(refereeAddress).setStakingEnabled(false);
Referee10(refereeAddress).setStakingEnabled(false);
}

function finishAirdrop(address refereeAddress, uint256 keyMultiplier) external onlyRole(AIRDROP_ADMIN_ROLE) {
updatePricingAndQuantity(keyMultiplier);
mintingPaused = false;
Referee9(refereeAddress).setStakingEnabled(true);
Referee10(refereeAddress).setStakingEnabled(true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgrad
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import "../../upgrades/referee/Referee9.sol";
import "../../upgrades/referee/Referee10.sol";
import "../../Xai.sol";
import "../../upgrades/esXai/esXai2.sol";
import "../../upgrades/node-license/NodeLicense8.sol";
Expand Down Expand Up @@ -249,7 +249,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
require(validateShareValues(_shareConfig), "3"); // Validate share configuration
require(msg.sender != _delegateOwner, "4"); // Delegate cannot be pool creator

Referee9 referee = Referee9(refereeAddress);
Referee10 referee = Referee10(refereeAddress);
require(referee.isKycApproved(msg.sender), "37"); // Owner must be kyc approved

// This is redundant, but being added in case the approved kyc requirement is ever removed
Expand Down Expand Up @@ -423,7 +423,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
address staker,
bool _asAdmin
) internal {
Referee9 referee = Referee9(refereeAddress);
Referee10 referee = Referee10(refereeAddress);
require(_asAdmin || referee.stakingEnabled(), "52");

referee.stakeKeys(pool, staker, keyIds, _asAdmin);
Expand Down Expand Up @@ -563,7 +563,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
) external {
require(poolsCreatedViaFactory[pool], "23"); // Pool must be created via factory

Referee9(refereeAddress).unstakeKeys(pool, msg.sender, keyIds);
Referee10(refereeAddress).unstakeKeys(pool, msg.sender, keyIds);

StakingPool stakingPool = StakingPool(pool);
stakingPool.unstakeKeys(msg.sender, unstakeRequestIndex, keyIds);
Expand All @@ -590,7 +590,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
require(poolsCreatedViaFactory[pool], "27"); // Pool must be created via factory
require(failedKyc[msg.sender] == false, "38"); // Owner must not have failed kyc

Referee9(refereeAddress).stakeEsXai(pool, amount);
Referee10(refereeAddress).stakeEsXai(pool, amount);
esXai(esXaiAddress).transferFrom(msg.sender, address(this), amount);
StakingPool stakingPool = StakingPool(pool);
stakingPool.stakeEsXai(msg.sender, amount);
Expand All @@ -610,7 +610,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
pool,
amount,
stakingPool.getStakedAmounts(msg.sender),
Referee9(refereeAddress).stakedAmounts(pool)
Referee10(refereeAddress).stakedAmounts(pool)
);
}

Expand All @@ -635,7 +635,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
}

// Reordered to avoid reentrancy
Referee9(refereeAddress).unstakeEsXai(pool, amount);
Referee10(refereeAddress).unstakeEsXai(pool, amount);
esXai(esXaiAddress).transfer(msg.sender, amount);

// Update total stake
Expand All @@ -657,7 +657,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
pool,
amount,
stakingPool.getStakedAmounts(msg.sender),
Referee9(refereeAddress).stakedAmounts(pool)
Referee10(refereeAddress).stakedAmounts(pool)
);
}

Expand Down Expand Up @@ -811,7 +811,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
i
);
if (
Referee9(refereeAddress).assignedKeyToPool(keyId) == address(0)
Referee10(refereeAddress).assignedKeyToPool(keyId) == address(0)
) {
unstakedKeyIds[currentIndexUnstaked] = keyId;
currentIndexUnstaked++;
Expand All @@ -830,7 +830,7 @@ contract PoolFactory2 is Initializable, AccessControlEnumerableUpgradeable {
isStaked = new bool[](keyIds.length);
for (uint256 i; i < keyIds.length; i++) {
isStaked[i] =
Referee9(refereeAddress).assignedKeyToPool(keyIds[i]) !=
Referee10(refereeAddress).assignedKeyToPool(keyIds[i]) !=
address(0);
}
}
Expand Down
Loading