Compare commits
No commits in common. "5e3454b502694786d67af5e13e192e3a852c51f2" and "1359f920ca69d0ff401155662b05d292070c7e61" have entirely different histories.
5e3454b502
...
1359f920ca
@ -161,11 +161,6 @@ contract GhostBondDepository is IBondDepository, NoteKeeper {
|
||||
msg.sender != IGhostAuthority(AUTHORITY).policy()
|
||||
) revert NotGuardianOrPolicy();
|
||||
|
||||
if (
|
||||
!ITreasury(TREASURY).registered(ITreasury.STATUS.RESERVETOKEN, _quoteToken) &&
|
||||
!ITreasury(TREASURY).registered(ITreasury.STATUS.LIQUIDITYTOKEN, _quoteToken)
|
||||
) revert NonPermissionedToken();
|
||||
|
||||
uint256 secondsToConclusion = _terms[1] - block.timestamp;
|
||||
uint256 decimals = IERC20Metadata(_quoteToken).decimals();
|
||||
uint64 targetDebt = uint64(_booleans[0]
|
||||
|
||||
@ -25,7 +25,9 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
||||
using EnumerableSet for EnumerableSet.AddressSet;
|
||||
|
||||
address public immutable FTSO;
|
||||
|
||||
uint256 public totalReserves;
|
||||
uint256 public totalDebt;
|
||||
|
||||
mapping(STATUS => EnumerableSet.AddressSet) private _registry;
|
||||
mapping(STATUS => mapping(address => bool)) private _permissions;
|
||||
@ -60,11 +62,10 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
||||
|
||||
function mint(address recipient, uint256 amount) external override {
|
||||
if (!_permissions[STATUS.REWARDMANAGER][msg.sender]) revert NotApproved();
|
||||
if (amount <= excessReserves()) {
|
||||
if (amount > excessReserves()) revert InsufficientReserves();
|
||||
IFTSO(FTSO).mint(recipient, amount);
|
||||
emit Minted(msg.sender, recipient, amount);
|
||||
}
|
||||
}
|
||||
|
||||
function withdraw(address token, uint256 amount) external onlyGovernor override {
|
||||
if (!_permissions[STATUS.RESERVETOKEN][token]) revert NotAccepted();
|
||||
@ -89,10 +90,9 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
||||
gasValue = tokenValue(reserveToken, gasSpent);
|
||||
gasValue = FullMath.mulDiv(gasValue, totalSupply, totalReserves);
|
||||
|
||||
if (gasValue <= excessReserves()) {
|
||||
if (gasValue > excessReserves()) revert InsufficientReserves();
|
||||
IFTSO(FTSO).mint(msg.sender, gasValue);
|
||||
}
|
||||
}
|
||||
|
||||
function buyBack(
|
||||
address receiver,
|
||||
@ -247,7 +247,7 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
||||
return _permissions[status][someAddress];
|
||||
}
|
||||
|
||||
function registered(STATUS status, address someAddress) external override view returns (bool) {
|
||||
function registered(STATUS status, address someAddress) external view returns (bool) {
|
||||
return _registry[status].contains(someAddress);
|
||||
}
|
||||
|
||||
@ -257,12 +257,7 @@ contract GhostTreasury is GhostAccessControlled, ITreasury {
|
||||
}
|
||||
|
||||
function excessReserves() public view override returns (uint256) {
|
||||
uint256 ftsoSupply = IFTSO(FTSO).totalSupply();
|
||||
uint256 currentTotalReserves = totalReserves;
|
||||
|
||||
return currentTotalReserves > ftsoSupply
|
||||
? currentTotalReserves - ftsoSupply
|
||||
: 0;
|
||||
return totalReserves - (IFTSO(FTSO).totalSupply() - totalDebt);
|
||||
}
|
||||
|
||||
function tokenValue(
|
||||
|
||||
@ -6,7 +6,6 @@ interface IBondDepository {
|
||||
error DepositoryMaxPrice(uint256 price, uint256 maxPrice);
|
||||
error DepositoryMaxSize(uint256 payout, uint256 maxPayout);
|
||||
error NotGuardianOrPolicy();
|
||||
error NonPermissionedToken();
|
||||
|
||||
event MarketClosed(uint256 indexed id);
|
||||
event Bond(uint256 indexed id, uint256 amount, uint256 price);
|
||||
|
||||
@ -6,6 +6,7 @@ interface ITreasury {
|
||||
error NotAccepted();
|
||||
error InvalidToken();
|
||||
error GasExceedsBounty();
|
||||
error InsufficientReserves();
|
||||
|
||||
enum STATUS {
|
||||
RESERVEDEPOSITOR,
|
||||
@ -28,7 +29,6 @@ interface ITreasury {
|
||||
uint256 _profit
|
||||
) external returns (uint256);
|
||||
|
||||
function registered(STATUS status, address token) external view returns(bool);
|
||||
function phantomRefund(uint256 gasSpent, uint256 amount) external returns (uint256);
|
||||
function buyBack(address receiver, uint256 amount, uint256 index) external returns (address, uint256);
|
||||
function withdraw(address token, uint256 amount) external;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user