v9.1 Update
Summary
New features: GNS staking fees are all used to buy GNS, sends an adjustable % to treasury, burn, and GNS staking rewards and uses an adjustable price premium; new compound function in GNS staking
Other changes: There is a 100 seconds cooldown to wait before one can unstake after staking GNS to prevent flashloans (vests must be 100 seconds long at least too now)
Full Changelog
core/GNSStaking.sol (update)
New
UNSTAKING_COOLDOWN_SECONDSconstant (= 100 seconds)New
stakerInfosmapping to store each user's lastDepositTsNew
notInCooldownmodifier, used byunstakeGns, reverts if user deposited less thanUNSTAKING_COOLDOWN_SECONDSago_harvestToken,_harvestFromUnlock,_harvestTokenFromUnlock,harvestToken,harvestTokenFromUnlock,harvestTokenAllnow all return the pending token rewards (needed for compound function)New
compoundGnsRewardsfunction: harvests pending regular rewards and vest rewards (accepts vests_idsas input) and stakes them in the same transactionstakeGns: now public (called bycompoundGnsRewards) and stores current timestamp instakerInfosmapping for callerunstakeGns: now usesnotInCooldownmodifiercreateUnlockSchedule: now checks vest duration >=UNSTAKING_COOLDOWN_SECONDSinstead of accepting any non-zero value
core/abstract/GNSDiamondStorage.sol (update)
Added
otcStorageprivate state var for newGNSOtcfacet
core/facets/GNSOtc.sol (new)
New facet which handles the collateral -> GNS OTC buying process and transfer to treasury, burn, and GNS staking rewards (adjustable percentages)
initializeOtc: infinite approval of GNS staking contract for GNS token and config initializationupdateOtcConfig: update treasury address and percentagesaddOtcCollateralBalance: increases available collateral balance for OTC buying (used byGNSTradingCallbackswhen distributing GNS staking fee)sellGnsForCollateral: executes OTC transaction; diamond receives GNS and sender receives collateral tokens, available collateral balance for OTC decreases accordinglygetOtcConfig,getOtcBalance,getOtcRategetters
interfaces/IGNSMultiCollatDiamond.sol (update)
Now inherits
IOtcUtils
interfaces/IGNSStaking.sol (update)
New
StakerInfostruct (lastDepositTsand placeholder)
interfaces/IGeneralErrors.sol (update)
New
InsufficientBalance()error
interfaces/libraries/IOtcUtils.sol (new)
Interface for new
GNSOtcfacet: contains all types, functions, events, and custom errors
interfaces/types/IOtc.sol (new)
Interface for new
GNSOtcfacet: contains all typesOtcStoragestruct:collateralBalancesmapping,otcConfigstructOtcConfigstruct: treasury address, percentages (treasury, GNS staking, burn), price premium
interfaces/types/IPriceAggregator.sol (update)
Fixed
__gaparray length, reduced from 41 to 39
interfaces/types/ITypes.sol (update)
Now inherits new facet types
IOtc
libraries/OtcUtils.sol (new)
Internal library for new
GNSOtcfacet
libraries/StorageUtils.sol (update)
Added
GLOBAL_OTC_SLOTconstant for newGNSOtcfacet
libraries/TradingCommonUtils.sol (update)
convertCollateralToGns,transferCollateralTo, and_getMultiCollatDiamondare now internal: allows not linking TradingCommonUtils toGNSOtcas internal functions are imported directly into the bytecode, should only make functions external when it becomes an issue for sizeNew
transferGnsToandtransferGnsFromhelpers to handle simple GNS transfers between users and the diamonddistributeGnsStakingFeeCollateralnow calls_getMultiCollatDiamond().addOtcCollateralBalanceinstead ofgnsStaking.distributeReward
Last updated
Was this helpful?