Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-10-10 21:32:47 +03:00
parent d7977a5ddc
commit 1359f920ca
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 9 additions and 5 deletions

View File

@ -81,7 +81,7 @@ contract GhostStaking is IStaking, GhostAccessControlled {
) external override returns (uint256 returnAmount) {
if (!unlocks[to] && to != msg.sender) revert ExternalDepositsLocked();
returnAmount = amount + rebase();
returnAmount = amount + this.rebase();
IERC20(ftso).safeTransferFrom(msg.sender, address(this), amount);
if (isClaim && warmupPeriod == 0) {
@ -132,12 +132,14 @@ contract GhostStaking is IStaking, GhostAccessControlled {
bool isTrigger,
bool isRebase
) external override returns (uint256) {
amount += isTrigger ? rebase() : 0;
uint256 extraAmount = isTrigger ? this.rebase() : 0;
if (isRebase) {
amount += extraAmount;
ISTNK(stnk).safeTransferFrom(msg.sender, address(this), amount);
} else {
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();
@ -213,8 +215,10 @@ contract GhostStaking is IStaking, GhostAccessControlled {
if (distributor != address(0)) {
IDistributor(distributor).distribute();
if (msg.sender == address(this)) {
bounty = IDistributor(distributor).retrieveBounty();
}
}
uint256 balance = IERC20(ftso).balanceOf(address(this));
uint256 extra = ISTNK(stnk).circulatingSupply() + bounty;

View File

@ -576,7 +576,7 @@ contract StakingTest is Test {
(,,, uint256 distribute) = staking.epoch();
assertEq(distribute, 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 {