Skip to content

Commit

Permalink
wrote a script to update NFT vests
Browse files Browse the repository at this point in the history
  • Loading branch information
deadshotryker committed Oct 1, 2024
1 parent ec5996f commit def8e5e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions contracts/vesting/UpdateZeroNFTScript.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz

import {IVestedZeroNFT} from "../interfaces/IVestedZeroNFT.sol";
import {AccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol";

interface IVestedZeroNFTWithLock is IVestedZeroNFT {
function tokenIdToLockDetails(uint256) external view returns (LockDetails memory);
}

contract UpdateZeroNFTScript is AccessControlEnumerable {
IVestedZeroNFTWithLock public vest;

constructor(address _vest) {
vest = IVestedZeroNFTWithLock(_vest);
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}

function update(uint256[] memory ids) external onlyRole(DEFAULT_ADMIN_ROLE) {
uint256[] memory linearDurations = new uint256[](ids.length);
uint256[] memory cliffDurations = new uint256[](ids.length);

for (uint256 i = 0; i < ids.length; i++) {
IVestedZeroNFT.LockDetails memory lock = vest.tokenIdToLockDetails(ids[i]);
require(lock.category == IVestedZeroNFT.VestCategory.AIRDROP, "!category");
linearDurations[i] = 86400 * 30 * 3; // 3 mo linear
cliffDurations[i] = 86400 * 30 * 3; // 3 mo cliff
}

vest.updateCliffDuration(ids, linearDurations, cliffDurations);
}
}

0 comments on commit def8e5e

Please sign in to comment.