Skip to content

Commit

Permalink
Candy Machine v0.3 - Candy Guards (#76)
Browse files Browse the repository at this point in the history
* new branch w/refactor

* use solanakt master branch snapshot

* update with solana kt sockets/remove moshi branch

* fix up issues from auction house merge, remove deprecations

* switch to solana 2.0 release

* create guards with groups working

* create guard 0.1.1 update

* wrap candy guard

* remove duplicate code, replace with builder
  • Loading branch information
Funkatronics authored Nov 4, 2022
1 parent ababae2 commit 4816e54
Show file tree
Hide file tree
Showing 15 changed files with 1,819 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@
// Accounts
// Metaplex
//
// This code was generated locally by Funkatronics on 2022-09-28
// This code was generated locally by Funkatronics on 2022-11-01
//
@file:UseSerializers(PublicKeyAs32ByteSerializer::class)

package com.metaplex.lib.experimental.jen.candyguard

import com.metaplex.lib.serialization.serializers.solana.PublicKeyAs32ByteSerializer
import com.solana.core.PublicKey
import kotlin.Long
import kotlin.UByte
import kotlin.UShort
import kotlin.ULong
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers

@Serializable
class MintCounter(val count: UShort)
class FreezeEscrow(
val candyGuard: PublicKey,
val candyMachine: PublicKey,
val frozenCount: ULong,
val firstMintTime: Long?,
val freezePeriod: Long,
val destination: PublicKey,
val authority: PublicKey
)

@Serializable
class CandyGuard(
Expand Down
168 changes: 132 additions & 36 deletions lib/src/main/java/com/metaplex/lib/experimental/jen/candyguard/Errors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Errors
// Metaplex
//
// This code was generated locally by Funkatronics on 2022-09-28
// This code was generated locally by Funkatronics on 2022-11-01
//
package com.metaplex.lib.experimental.jen.candyguard

Expand Down Expand Up @@ -36,7 +36,7 @@ class PublicKeyMismatch : CandyGuardError {
class DataIncrementLimitExceeded : CandyGuardError {
override val code: Int = 6003

override val message: String = "Missing expected remaining account"
override val message: String = "Exceeded account increase limit"
}

class IncorrectOwner : CandyGuardError {
Expand Down Expand Up @@ -75,94 +75,94 @@ class GroupNotFound : CandyGuardError {
override val message: String = "Group not found"
}

class LabelExceededLength : CandyGuardError {
class ExceededLength : CandyGuardError {
override val code: Int = 6010

override val message: String = "Group not found"
override val message: String = "Value exceeded maximum length"
}

class CollectionKeyMismatch : CandyGuardError {
class CandyMachineEmpty : CandyGuardError {
override val code: Int = 6011

override val message: String = "Collection public key mismatch"
override val message: String = "Candy machine is empty"
}

class MissingCollectionAccounts : CandyGuardError {
class InstructionNotFound : CandyGuardError {
override val code: Int = 6012

override val message: String = "Missing collection accounts"
override val message: String = "No instruction was found"
}

class CollectionUpdateAuthorityKeyMismatch : CandyGuardError {
class CollectionKeyMismatch : CandyGuardError {
override val code: Int = 6013

override val message: String = "Collection update authority public key mismatch"
override val message: String = "Collection public key mismatch"
}

class MintNotLastTransaction : CandyGuardError {
class MissingCollectionAccounts : CandyGuardError {
override val code: Int = 6014

override val message: String = "Mint must be the last instructions of the transaction"
override val message: String = "Missing collection accounts"
}

class MintNotLive : CandyGuardError {
class CollectionUpdateAuthorityKeyMismatch : CandyGuardError {
override val code: Int = 6015

override val message: String = "Mint is not live"
override val message: String = "Collection update authority public key mismatch"
}

class NotEnoughSOL : CandyGuardError {
class MintNotLastTransaction : CandyGuardError {
override val code: Int = 6016

override val message: String = "Not enough SOL to pay for the mint"
override val message: String = "Mint must be the last instructions of the transaction"
}

class TokenTransferFailed : CandyGuardError {
class MintNotLive : CandyGuardError {
override val code: Int = 6017

override val message: String = "Token transfer failed"
override val message: String = "Mint is not live"
}

class NotEnoughTokens : CandyGuardError {
class NotEnoughSOL : CandyGuardError {
override val code: Int = 6018

override val message: String = "Not enough tokens to pay for this minting"
override val message: String = "Not enough SOL to pay for the mint"
}

class MissingRequiredSignature : CandyGuardError {
class TokenBurnFailed : CandyGuardError {
override val code: Int = 6019

override val message: String = "A signature was required but not found"
override val message: String = "Token burn failed"
}

class TokenBurnFailed : CandyGuardError {
class NotEnoughTokens : CandyGuardError {
override val code: Int = 6020

override val message: String = "Token burn failed"
override val message: String = "Not enough tokens on the account"
}

class NoWhitelistToken : CandyGuardError {
class TokenTransferFailed : CandyGuardError {
override val code: Int = 6021

override val message: String = "No whitelist token present"
override val message: String = "Token transfer failed"
}

class GatewayTokenInvalid : CandyGuardError {
class MissingRequiredSignature : CandyGuardError {
override val code: Int = 6022

override val message: String = "Gateway token is not valid"
override val message: String = "A signature was required but not found"
}

class AfterEndSettingsDate : CandyGuardError {
class GatewayTokenInvalid : CandyGuardError {
override val code: Int = 6023

override val message: String = "Current time is after the set end settings date"
override val message: String = "Gateway token is not valid"
}

class AfterEndSettingsMintAmount : CandyGuardError {
class AfterEndDate : CandyGuardError {
override val code: Int = 6024

override val message: String = "Current items minted is at the set end settings amount"
override val message: String = "Current time is after the set end date"
}

class InvalidMintTime : CandyGuardError {
Expand All @@ -183,14 +183,110 @@ class MissingAllowedListProof : CandyGuardError {
override val message: String = "Missing allowed list proof"
}

class AllowedMintLimitReached : CandyGuardError {
class AllowedListNotEnabled : CandyGuardError {
override val code: Int = 6028

override val message: String = "The maximum number of allowed mints was reached"
override val message: String = "Allow list guard is not enabled"
}

class InvalidNFTCollectionPayment : CandyGuardError {
class AllowedMintLimitReached : CandyGuardError {
override val code: Int = 6029

override val message: String = "Invalid NFT Collection Payment"
override val message: String = "The maximum number of allowed mints was reached"
}

class InvalidNftCollection : CandyGuardError {
override val code: Int = 6030

override val message: String = "Invalid NFT collection"
}

class MissingNft : CandyGuardError {
override val code: Int = 6031

override val message: String = "Missing NFT on the account"
}

class MaximumRedeemedAmount : CandyGuardError {
override val code: Int = 6032

override val message: String = "Current redemeed items is at the set maximum amount"
}

class AddressNotAuthorized : CandyGuardError {
override val code: Int = 6033

override val message: String = "Address not authorized"
}

class MissingFreezeInstruction : CandyGuardError {
override val code: Int = 6034

override val message: String = "Missing freeze instruction data"
}

class FreezeGuardNotEnabled : CandyGuardError {
override val code: Int = 6035

override val message: String = "Freeze guard must be enabled"
}

class FreezeNotInitialized : CandyGuardError {
override val code: Int = 6036

override val message: String = "Freeze must be initialized"
}

class MissingFreezePeriod : CandyGuardError {
override val code: Int = 6037

override val message: String = "Missing freeze period"
}

class FreezeEscrowAlreadyExists : CandyGuardError {
override val code: Int = 6038

override val message: String = "The freeze escrow account already exists"
}

class ExceededMaximumFreezePeriod : CandyGuardError {
override val code: Int = 6039

override val message: String = "Maximum freeze period exceeded"
}

class ThawNotEnabled : CandyGuardError {
override val code: Int = 6040

override val message: String = "Thaw is not enabled"
}

class UnlockNotEnabled : CandyGuardError {
override val code: Int = 6041

override val message: String = "Unlock is not enabled (not all NFTs are thawed)"
}

class DuplicatedGroupLabel : CandyGuardError {
override val code: Int = 6042

override val message: String = "Duplicated group label"
}

class DuplicatedMintLimitId : CandyGuardError {
override val code: Int = 6043

override val message: String = "Duplicated mint limit id"
}

class UnauthorizedProgramFound : CandyGuardError {
override val code: Int = 6044

override val message: String = "An unauthorized program was found in the transaction"
}

class ExceededProgramListSize : CandyGuardError {
override val code: Int = 6045

override val message: String = "Exceeded the maximum number of programs in the additional list"
}
Loading

0 comments on commit 4816e54

Please sign in to comment.