Security
Locking Aavegotchi state before trading
function lockAavegotchi(uint256 _tokenId, uint256 _lockDuration) external
onlyUnlocked(_tokenId)
{
require(
s.aavegotchis[_tokenId].status == LibAppStorage.STATUS_AAVEGOTCHI,
"AavegotchiFacet: Must be claimed"
);
require(
msg.sender == s.aavegotchis[_tokenId].owner,
"AavegotchiFacet: Only owner can lock aavegotchi"
);
s.aavegotchis[_tokenId].unlockTime = block.timestamp + _lockDuration;
emit LockAavegotchi(_tokenId, _lockDuration);
}modifier onlyUnlocked(uint256 _tokenId) {
require(
s.aavegotchis[_tokenId].unlockTime < block.timestamp,
"Only callable on unlocked Aavegotchis"
);
_;
}Last updated
Was this helpful?