NftStakingV2.sol
:- added
batchUnstakeNfts()
function - internal hook functions
_onStake
and_onUnstake
. - added
withdrawLostCycleRewards
for an admin to withdraw the rewards for a past cycle where there was no stake. - new events
NftsBatchStaked
andNftsBatchUnstaked
emitted during batch operations instead of the single versions. - Batch functions throw on an empty tokens list.
- Optimised implementation of batch staking.
- GSN compatibility.
- added
- Dependencies updated to
@animoca/[email protected]
and@animoca/[email protected]
.
- Optimised the assignment of
tokenInfos
in_stakeNFT
.
- Calibrated the re-stake exploit fix to only apply during the same cycle after unstaking.
- Improved the comments.
- Fixed an exploit that allowed the re-staking of a token during the same cycle.
- Gas optimisations, minor comments improvements.
- Linting configuration.
- Migrated to
yarn
.
- Added
addRewardsForPeriods()
function, which initializes or adds reward amounts for the specified period range. This will perform a transfer operation to fund the contract with the added rewards amount when called. - Added contract interface
IWhitelistedNftContract
to define the API for the whitelisted contract used for NFT transfer operations when unstaking.
- Removed
setRewardsForPeriods()
function. - Funding the contract rewards no longer occurs when calling the
start()
function. Instead, this happens wheneveraddRewardsForPeriods()
is called. - Removed
disabled
state variable, for representing the contract enabled state, and replaced withenabled
. - Renamed
RewardsScheduled
event toRewardsAdded
. - Renamed
totalPrizePool
state variable tototalRewardsPool
.
- The module now exports a
constants
and autils
object. - Added a function to calculate a total rewards based on a rewards schedule.
- Fixed a wrong import in the migration and restructured the script
- Updated
@animoca/ethereum-contracts-core_library
to version 3 and downgraded it to be a dev dependency. - Updated
@animoca/ethereum-contracts-erc20_base
to version 3 and downgraded it to be a dev dependency. - Updated
@animoca/ethereum-contracts-assets_inventory
to version 3 and downgraded it to be a dev dependency. - Migrated compiler to
solc:0.6.8
. - Design change to record staker histories with modification to public interfaces.
- Removed testable version of the contract.
- Removed dependency on
@animoca/f1dt-core_metadata
.
- Updated dependency on
@animoca/ethereum-contracts-assets_inventory
to2.0.1
. - Change variables names in multiple files to be more generic.
- Added 1_NftStaking.js migration script.
- Migration to
@animoca/ethereum-contracts-core_library:1.0.0
withsolc:0.6.x
and@openzeppelin/contracts:3.x
.
- Added
NftStakingMock.sol
andNftStakingTestableMock.sol
.
- Better abstraction of core staking features.
- Initial commit.