emit events when treasury mint is skipped
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
4d42442ad9
commit
f7e28ad2fb
@ -62,9 +62,12 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
|||||||
|
|
||||||
function mint(address recipient, uint256 amount) external override {
|
function mint(address recipient, uint256 amount) external override {
|
||||||
if (!_permissions[STATUS.REWARDMANAGER][msg.sender]) revert NotApproved();
|
if (!_permissions[STATUS.REWARDMANAGER][msg.sender]) revert NotApproved();
|
||||||
if (amount <= excessReserves()) {
|
uint256 currentExcessReserves = excessReserves();
|
||||||
|
if (amount <= currentExcessReserves) {
|
||||||
IFTSO(FTSO).mint(recipient, amount);
|
IFTSO(FTSO).mint(recipient, amount);
|
||||||
emit Minted(msg.sender, recipient, amount);
|
emit Minted(msg.sender, recipient, amount);
|
||||||
|
} else {
|
||||||
|
emit NothingMinted(msg.sender, recipient, amount, currentExcessReserves);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +96,11 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
|||||||
uint256 gasValue = tokenValue(reserveToken, gasSpent);
|
uint256 gasValue = tokenValue(reserveToken, gasSpent);
|
||||||
gasValue = FullMath.mulDiv(gasValue, totalSupply, totalReserves);
|
gasValue = FullMath.mulDiv(gasValue, totalSupply, totalReserves);
|
||||||
|
|
||||||
if (gasValue > 0 && gasValue <= excessReserves()) {
|
uint256 currentExcessReserves = excessReserves();
|
||||||
|
if (gasValue > 0 && gasValue <= currentExcessReserves) {
|
||||||
IBondDepository(bondDepository).addNote(receiver, gasValue, phantomRelease);
|
IBondDepository(bondDepository).addNote(receiver, gasValue, phantomRelease);
|
||||||
|
} else {
|
||||||
|
emit NothingMinted(bondDepository, receiver, gasValue, currentExcessReserves);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,12 @@ interface ITreasury {
|
|||||||
event Permissioned(address addr, STATUS indexed status, bool result);
|
event Permissioned(address addr, STATUS indexed status, bool result);
|
||||||
event Withdrawal(address indexed token, uint256 indexed amount, uint256 value);
|
event Withdrawal(address indexed token, uint256 indexed amount, uint256 value);
|
||||||
event BondDepositoryUpdated(address bondDepository);
|
event BondDepositoryUpdated(address bondDepository);
|
||||||
|
event NothingMinted(
|
||||||
|
address indexed caller,
|
||||||
|
address indexed recipient,
|
||||||
|
uint256 amountRequested,
|
||||||
|
uint256 amountPossible
|
||||||
|
);
|
||||||
|
|
||||||
function deposit(
|
function deposit(
|
||||||
address _token,
|
address _token,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user