Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
d7977a5ddc
commit
1359f920ca
@ -81,7 +81,7 @@ contract GhostStaking is IStaking, GhostAccessControlled {
|
|||||||
) external override returns (uint256 returnAmount) {
|
) external override returns (uint256 returnAmount) {
|
||||||
if (!unlocks[to] && to != msg.sender) revert ExternalDepositsLocked();
|
if (!unlocks[to] && to != msg.sender) revert ExternalDepositsLocked();
|
||||||
|
|
||||||
returnAmount = amount + rebase();
|
returnAmount = amount + this.rebase();
|
||||||
IERC20(ftso).safeTransferFrom(msg.sender, address(this), amount);
|
IERC20(ftso).safeTransferFrom(msg.sender, address(this), amount);
|
||||||
|
|
||||||
if (isClaim && warmupPeriod == 0) {
|
if (isClaim && warmupPeriod == 0) {
|
||||||
@ -132,12 +132,14 @@ contract GhostStaking is IStaking, GhostAccessControlled {
|
|||||||
bool isTrigger,
|
bool isTrigger,
|
||||||
bool isRebase
|
bool isRebase
|
||||||
) external override returns (uint256) {
|
) external override returns (uint256) {
|
||||||
amount += isTrigger ? rebase() : 0;
|
uint256 extraAmount = isTrigger ? this.rebase() : 0;
|
||||||
|
|
||||||
if (isRebase) {
|
if (isRebase) {
|
||||||
|
amount += extraAmount;
|
||||||
ISTNK(stnk).safeTransferFrom(msg.sender, address(this), amount);
|
ISTNK(stnk).safeTransferFrom(msg.sender, address(this), amount);
|
||||||
} else {
|
} else {
|
||||||
IGHST(ghst).burn(msg.sender, amount);
|
IGHST(ghst).burn(msg.sender, amount);
|
||||||
amount = IGHST(ghst).balanceFrom(amount);
|
amount = IGHST(ghst).balanceFrom(amount) + extraAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount > IERC20(ftso).balanceOf(address(this))) revert InsufficientBalance();
|
if (amount > IERC20(ftso).balanceOf(address(this))) revert InsufficientBalance();
|
||||||
@ -213,7 +215,9 @@ contract GhostStaking is IStaking, GhostAccessControlled {
|
|||||||
|
|
||||||
if (distributor != address(0)) {
|
if (distributor != address(0)) {
|
||||||
IDistributor(distributor).distribute();
|
IDistributor(distributor).distribute();
|
||||||
bounty = IDistributor(distributor).retrieveBounty();
|
if (msg.sender == address(this)) {
|
||||||
|
bounty = IDistributor(distributor).retrieveBounty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 balance = IERC20(ftso).balanceOf(address(this));
|
uint256 balance = IERC20(ftso).balanceOf(address(this));
|
||||||
|
|||||||
@ -576,7 +576,7 @@ contract StakingTest is Test {
|
|||||||
(,,, uint256 distribute) = staking.epoch();
|
(,,, uint256 distribute) = staking.epoch();
|
||||||
assertEq(distribute, postBounty);
|
assertEq(distribute, postBounty);
|
||||||
assertEq(stnk.balanceOf(ALICE), postBounty);
|
assertEq(stnk.balanceOf(ALICE), postBounty);
|
||||||
assertEq(ftso.balanceOf(address(staking)), 2 * postBounty + bounty);
|
assertEq(ftso.balanceOf(address(staking)), 2 * postBounty);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_arbitraryAddressCouldNotAddGatekeeper(address someone, address maybeGatekeeper) public {
|
function test_arbitraryAddressCouldNotAddGatekeeper(address someone, address maybeGatekeeper) public {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user