Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 1x 1x 1x 1x 1x 1116x 1116x 1116x 1116x 1116x 1116x 1116x 1116x 1116x 1116x 1116x 1x 1x 1x 1x 1x 1x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1496x 1x 370x 370x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 27x 27x 27x 27x 27x 27x 27x 27x 27x 27x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 646x 646x 646x 646x 646x 1502x 1502x 1502x 118x 118x 1502x 1502x 1502x 1502x 1502x 1502x 118x 118x 118x 118x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 54x 54x 54x 54x 54x 54x 6x 6x 6x 6x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 114x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 16x 16x 16x 16x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 64x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 48x 48x 48x 48x 48x 48x 48x 1502x 1502x 1502x 1502x 1502x 1502x 56x 56x 56x 56x 56x 56x 56x 1502x 1502x 1502x 1502x 1502x 1502x 56x 56x 56x 56x 56x 56x 56x 1502x 27x 27x 27x | /** * The `NFTAdvancedAdminContract` is an implementation of an admin contract that uses a whitelist to control access to certain actions within the NFT ecosystem. * This contract ensures that only whitelisted addresses can perform specific actions such as minting, updating, transferring, buying, or selling NFTs. * It also introduces functionality for pausing and resuming the contract, upgrading the contract's verification key, and transferring ownership. */ import { Bool, DeployArgs, method, Permissions, PublicKey, SmartContract, State, state, VerificationKey, UInt64, Provable, Field, AccountUpdate, Mina, UInt32, Struct, } from "o1js"; import { Whitelist } from "@silvana-one/storage"; import { MintRequest, NFTState, NFTAdminBase, MintParamsOption, PauseEvent, PausableContract, OwnershipChangeEvent, OwnableContract, TransferEvent, } from "../interfaces/index.js"; import { UpgradeAuthorityBase, VerificationKeyUpgradeData, UpgradableContract, UpgradeAuthorityContractConstructor, } from "@silvana-one/upgradable"; export { NFTAdvancedAdminContract, AdminData, NFTAdvancedAdminDeployProps }; /** * Deployment properties for the `NFTAdvancedAdminContract`. */ interface NFTAdvancedAdminDeployProps extends Exclude<DeployArgs, undefined> { /** The public key of the admin or owner of the contract. */ admin: PublicKey; /** The public key of the Upgrade Authority Contract. */ upgradeAuthority: PublicKey; /** The whitelist. */ whitelist: Whitelist; /** The URI of the zkApp. */ uri: string; /** The admin data. */ adminData: AdminData; } /** * Represents pause-related data, containing flags for pause functionality. */ class AdminData extends Struct({ /** Indicates whether the contract can be paused. */ canPause: Bool, /** Indicates whether the contract is currently paused. */ isPaused: Bool, /** Indicates whether the contract can change the royalty fee. */ allowChangeRoyalty: Bool, /** Indicates whether the contract can change the transfer fee. */ allowChangeTransferFee: Bool, /** Indicates whether the contract can change the base URI. */ allowChangeBaseUri: Bool, /** Indicates whether the contract can change the creator. */ allowChangeCreator: Bool, /** Indicates whether the contract can change the admin. */ allowChangeAdmin: Bool, /** Indicates whether the contract can change the name. */ allowChangeName: Bool, }) { static new( params: { canPause?: boolean; isPaused?: boolean; allowChangeRoyalty?: boolean; allowChangeTransferFee?: boolean; allowChangeBaseUri?: boolean; allowChangeCreator?: boolean; allowChangeAdmin?: boolean; allowChangeName?: boolean; } = {} ) { const { canPause, isPaused, allowChangeRoyalty, allowChangeTransferFee, allowChangeBaseUri, allowChangeCreator, allowChangeAdmin, allowChangeName, } = params; return new AdminData({ canPause: Bool(canPause ?? true), isPaused: Bool(isPaused ?? false), allowChangeRoyalty: Bool(allowChangeRoyalty ?? false), allowChangeTransferFee: Bool(allowChangeTransferFee ?? false), allowChangeBaseUri: Bool(allowChangeBaseUri ?? false), allowChangeCreator: Bool(allowChangeCreator ?? false), allowChangeAdmin: Bool(allowChangeAdmin ?? false), allowChangeName: Bool(allowChangeName ?? false), }); } /** * Packs the pause data into a `Field`. * @returns A `Field` representing the packed pause data. */ pack(): Field { return Field.fromBits([ this.isPaused, this.canPause, this.allowChangeRoyalty, this.allowChangeTransferFee, this.allowChangeBaseUri, this.allowChangeCreator, this.allowChangeAdmin, this.allowChangeName, ]); } /** * Unpacks a `Field` into `PauseData`. * @param field The `Field` to unpack. * @returns An instance of `PauseData`. */ static unpack(field: Field): AdminData { const [ isPaused, canPause, allowChangeRoyalty, allowChangeTransferFee, allowChangeBaseUri, allowChangeCreator, allowChangeAdmin, allowChangeName, ] = field.toBits(8); return new AdminData({ canPause, isPaused, allowChangeRoyalty, allowChangeTransferFee, allowChangeBaseUri, allowChangeCreator, allowChangeAdmin, allowChangeName, }); } static isPaused(field: Field): Bool { return field.toBits(8)[0]; } } const NFTAdvancedAdminContractErrors = { contractIsPaused: "Contract is paused", notWhitelisted: "Address not whitelisted", senderNotWhitelisted: "Sender address not whitelisted", cannotMint: "Cannot mint", verificationKeyHashNotFound: "Verification key hash not found", cannotUpgradeVerificationKey: "Cannot upgrade verification key", }; /** * Constructs the `NFTAdvancedAdmin` class, an admin contract that uses a whitelist to control access. * @param params Object containing the upgrade contract constructor. * @returns The `NFTAdvancedAdmin` class. */ function NFTAdvancedAdminContract(params: { upgradeContract: UpgradeAuthorityContractConstructor; }) { const { upgradeContract } = params; /** * The `NFTWhitelistedAdmin` class ensures that only whitelisted addresses can perform specific actions such as minting, updating, transferring, buying, or selling NFTs. * It also provides functionality for pausing and resuming the contract, upgrading the contract's verification key, and transferring ownership. */ class NFTAdvancedAdmin extends SmartContract implements NFTAdminBase, UpgradableContract, PausableContract, OwnableContract { /** The public key of the admin or owner of the contract. */ @state(PublicKey) admin = State<PublicKey>(); /** The public key of the Upgrade Authority Contract. */ @state(PublicKey) upgradeAuthority = State<PublicKey>(); /** The root hash of the Merkle tree representing the whitelist. */ @state(Whitelist) whitelist = State<Whitelist>(); /** Packed field containing pause-related flags. */ @state(Field) data = State<Field>(); /** * Deploys the `NFTWhitelistedAdmin` contract with the provided initial settings. * @param props Deployment properties. */ async deploy(props: NFTAdvancedAdminDeployProps) { await super.deploy(props); this.admin.set(props.admin); this.upgradeAuthority.set(props.upgradeAuthority); this.whitelist.set(props.whitelist); this.data.set(props.adminData.pack()); this.account.zkappUri.set(props.uri); this.account.permissions.set({ ...Permissions.default(), // Allow the upgrade authority to set the verification key // even when there is no protocol upgrade setVerificationKey: Permissions.VerificationKey.proofDuringCurrentVersion(), setPermissions: Permissions.impossible(), access: Permissions.proof(), send: Permissions.proof(), setZkappUri: Permissions.impossible(), setTokenSymbol: Permissions.impossible(), }); } events = { /** Emitted when the contract's verification key is upgraded. */ upgradeVerificationKey: Field, /** Emitted when the contract is paused. */ pause: PauseEvent, /** Emitted when the contract is resumed. */ resume: PauseEvent, /** Emitted when ownership of the contract changes. */ ownershipChange: OwnershipChangeEvent, /** Emitted when the whitelist is updated. */ updateWhitelist: Whitelist, }; /** * Ensures that the transaction is authorized by the contract owner. * @returns An `AccountUpdate` representing the admin's signed transaction. */ async ensureOwnerSignature(): Promise<AccountUpdate> { const admin = this.admin.getAndRequireEquals(); const adminUpdate = AccountUpdate.createSigned(admin); adminUpdate.body.useFullCommitment = Bool(true); // prevent memo and fee change return adminUpdate; } /** Gets the upgrade contract constructor. */ get getUpgradeContractConstructor() { return upgradeContract; } /** * Retrieves the `UpgradeAuthorityBase` contract instance. * @returns An instance of the upgrade authority contract. */ async getUpgradeContract(): Promise<UpgradeAuthorityBase> { return new this.getUpgradeContractConstructor( this.upgradeAuthority.getAndRequireEquals() ); } /** * Upgrades the contract's verification key using the Upgrade Authority Contract. * @param vk The new verification key. */ @method async upgradeVerificationKey(vk: VerificationKey) { await this.ensureOwnerSignature(); const upgradeContract = await this.getUpgradeContract(); // fetchAccount() should be called before calling this method // this code should be changed after verification key precondition // will be added to the Mina protocol const previousVerificationKeyHash = Provable.witness(Field, () => { const account = Mina.getAccount(this.address); const vkHash = account.zkapp?.verificationKey?.hash; if (!vkHash) { throw Error( NFTAdvancedAdminContractErrors.verificationKeyHashNotFound ); } return vkHash; }); const data = new VerificationKeyUpgradeData({ address: this.address, tokenId: this.tokenId, previousVerificationKeyHash, newVerificationKeyHash: vk.hash, }); const upgradeAuthorityAnswer = await upgradeContract.verifyUpgradeData( data ); upgradeAuthorityAnswer.isVerified.assertTrue( NFTAdvancedAdminContractErrors.cannotUpgradeVerificationKey ); this.account.verificationKey.set(vk); this.upgradeAuthority.set( upgradeAuthorityAnswer.nextUpgradeAuthority.orElse( this.upgradeAuthority.getAndRequireEquals() ) ); this.emitEvent("upgradeVerificationKey", vk.hash); } /** * Determines if the minting request can proceed by checking if the owner and sender are whitelisted. * @param mintRequest The minting request parameters. * @returns A `MintParamsOption` indicating if minting is allowed. */ @method.returns(MintParamsOption) async canMint(mintRequest: MintRequest): Promise<MintParamsOption> { AdminData.isPaused(this.data.getAndRequireEquals()).assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); const whitelist = this.whitelist.getAndRequireEquals(); const ownerAmount = await whitelist.getWhitelistedAmount( mintRequest.owner ); ownerAmount.isSome.assertTrue( NFTAdvancedAdminContractErrors.notWhitelisted ); const sender = this.sender.getUnconstrained(); const senderUpdate = AccountUpdate.createSigned(sender); senderUpdate.body.useFullCommitment = Bool(true); // prevent memo and fee change const senderAmount = await whitelist.getWhitelistedAmount(sender); senderAmount.isSome.assertTrue( NFTAdvancedAdminContractErrors.senderNotWhitelisted ); const mintParams = await Provable.witnessAsync( MintParamsOption, async () => { // only creator can mint // can be changed in the future to support CMS return MintParamsOption.none(); } ); return mintParams; } /** * Checks whether the NFT's state can be updated, ensuring the new owner is whitelisted. * @param input The current state of the NFT. * @param output The desired new state of the NFT. * @returns A `Bool` indicating whether the update is permitted. */ @method.returns(Bool) async canUpdate(input: NFTState, output: NFTState) { AdminData.isPaused(this.data.getAndRequireEquals()).assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); const whitelist = this.whitelist.getAndRequireEquals(); return (await whitelist.getWhitelistedAmount(output.owner)).isSome.and( (await whitelist.getWhitelistedAmount(input.owner)).isSome ); } /** * Verifies if the transfer between `from` and `to` addresses is allowed based on whitelist status. * @param address The address of the NFT. * @param from The sender's public key. * @param to The receiver's public key. * @returns A `Bool` indicating whether the transfer is permitted. */ @method.returns(Bool) async canTransfer(transferEvent: TransferEvent) { AdminData.isPaused(this.data.getAndRequireEquals()).assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); const { to, from, price } = transferEvent; const whitelist = this.whitelist.getAndRequireEquals(); const toAmount = await whitelist.getWhitelistedAmount(to); const fromAmount = await whitelist.getWhitelistedAmount(from); const toAmountAllowed = toAmount .orElse(UInt64.from(0)) .greaterThanOrEqual(price.orElse(UInt64.zero)); const fromAmountAllowed = fromAmount .orElse(UInt64.from(0)) .greaterThanOrEqual(price.orElse(UInt64.zero)); return toAmountAllowed .and(fromAmountAllowed) .and(toAmount.isSome) .and(fromAmount.isSome); } /** * Updates the whitelist's Merkle root and the associated off-chain storage reference. * @param whitelistRoot The new whitelist root. * @param storage The storage reference for the whitelist data. */ @method async updateWhitelist(whitelist: Whitelist) { AdminData.isPaused(this.data.getAndRequireEquals()).assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); await this.ensureOwnerSignature(); this.whitelist.set(whitelist); this.emitEvent("updateWhitelist", whitelist); } /** * Pauses the contract, preventing certain administrative actions from being performed. */ @method async pause(): Promise<void> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.canPause.assertTrue(); adminData.isPaused = Bool(true); this.data.set(adminData.pack()); this.emitEvent("pause", new PauseEvent({ isPaused: Bool(true) })); } /** * Resumes the contract, allowing administrative actions to be performed again. */ @method async resume(): Promise<void> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.canPause.assertTrue(); adminData.isPaused = Bool(false); this.data.set(adminData.pack()); this.emitEvent("resume", new PauseEvent({ isPaused: Bool(false) })); } /** * Transfers ownership of the contract to a new admin. * @param newOwner The public key of the new admin. * @returns The public key of the old owner. */ @method.returns(PublicKey) async transferOwnership(to: PublicKey): Promise<PublicKey> { AdminData.isPaused(this.data.getAndRequireEquals()).assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); await this.ensureOwnerSignature(); const from = this.admin.getAndRequireEquals(); this.admin.set(to); this.emitEvent( "ownershipChange", new OwnershipChangeEvent({ from, to, }) ); return from; } @method.returns(Bool) async canChangeVerificationKey( vk: VerificationKey, address: PublicKey, tokenId: Field ): Promise<Bool> { AdminData.isPaused(this.data.getAndRequireEquals()).assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); const upgradeContract = await this.getUpgradeContract(); // fetchAccount() should be called before calling this method // TODO: this code should be changed after verification key precondition // will be added to the Mina protocol const previousVerificationKeyHash = Provable.witness(Field, () => { const account = Mina.getAccount(address, tokenId); const vkHash = account.zkapp?.verificationKey?.hash; if (!vkHash) { throw Error("Verification key hash not found"); } return vkHash; }); const data = new VerificationKeyUpgradeData({ address: address, tokenId: tokenId, previousVerificationKeyHash, newVerificationKeyHash: vk.hash, }); const upgradeAuthorityAnswer = await upgradeContract.verifyUpgradeData( data ); return upgradeAuthorityAnswer.isVerified; } /** * Determines if the name can be changed for a Collection. */ @method.returns(Bool) async canChangeName(name: Field): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.allowChangeName; } /** * Determines if the creator can be changed for a Collection. */ @method.returns(Bool) async canChangeCreator(creator: PublicKey): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.allowChangeCreator; } /** * Determines if the base URI can be changed for a Collection. */ @method.returns(Bool) async canChangeBaseUri(baseUri: Field): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.allowChangeBaseUri; } /** * Determines if the royalty fee can be changed for a Collection. */ @method.returns(Bool) async canChangeRoyalty(royaltyFee: UInt32): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.allowChangeRoyalty; } /** * Determines if the transfer fee can be changed for a Collection. */ @method.returns(Bool) async canChangeTransferFee(transferFee: UInt64): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.allowChangeTransferFee; } /** * Determines if the admin contract can be changed for a Collection. */ @method.returns(Bool) async canSetAdmin(admin: PublicKey): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.allowChangeAdmin; } /** * Determines if the collection can be paused. */ @method.returns(Bool) async canPause(): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.canPause; } /** * Determines if the collection can be resumed. */ @method.returns(Bool) async canResume(): Promise<Bool> { await this.ensureOwnerSignature(); const adminData = AdminData.unpack(this.data.getAndRequireEquals()); adminData.isPaused.assertFalse( NFTAdvancedAdminContractErrors.contractIsPaused ); return adminData.canPause; } } return NFTAdvancedAdmin; } |