Skip to content

Commit

Permalink
generate constants src.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpe7s committed Nov 28, 2024
1 parent ff09293 commit c5164be
Show file tree
Hide file tree
Showing 10 changed files with 475 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package software.sava.anchor.programs.glam.anchor;

public final class GlamConstants {

private static final String SEED = """
anchor""";

private GlamConstants() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ public static ProgramDerivedAddress extraAccountMetaList1PDA(final PublicKey pro
), program);
}

public static ProgramDerivedAddress fromAtaPDA(final PublicKey program,
final PublicKey fromAccount,
final PublicKey token2022ProgramAccount,
final PublicKey shareClassMintAccount) {
return PublicKey.findProgramAddress(List.of(
fromAccount.toByteArray(),
token2022ProgramAccount.toByteArray(),
shareClassMintAccount.toByteArray()
), program);
}

public static ProgramDerivedAddress fundPDA(final PublicKey program,
final PublicKey managerAccount,
final byte[] fundModelCreated) {
Expand Down Expand Up @@ -67,6 +78,17 @@ public static ProgramDerivedAddress mintToPDA(final PublicKey program,
}

public static ProgramDerivedAddress mintTo1PDA(final PublicKey program,
final PublicKey recipientAccount,
final PublicKey token2022ProgramAccount,
final PublicKey shareClassMintAccount) {
return PublicKey.findProgramAddress(List.of(
recipientAccount.toByteArray(),
token2022ProgramAccount.toByteArray(),
shareClassMintAccount.toByteArray()
), program);
}

public static ProgramDerivedAddress mintTo2PDA(final PublicKey program,
final PublicKey treasuryAccount,
final SolanaAccounts solanaAccounts,
final PublicKey poolMintAccount) {
Expand Down Expand Up @@ -123,6 +145,17 @@ public static ProgramDerivedAddress srcAccountPolicyPDA(final PublicKey program,
), program);
}

public static ProgramDerivedAddress toAtaPDA(final PublicKey program,
final PublicKey toAccount,
final PublicKey token2022ProgramAccount,
final PublicKey shareClassMintAccount) {
return PublicKey.findProgramAddress(List.of(
toAccount.toByteArray(),
token2022ProgramAccount.toByteArray(),
shareClassMintAccount.toByteArray()
), program);
}

public static ProgramDerivedAddress treasuryPDA(final PublicKey program,
final PublicKey fundAccount) {
return PublicKey.findProgramAddress(List.of(
Expand Down
Loading

0 comments on commit c5164be

Please sign in to comment.