diff --git a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftError.java b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftError.java index eec60bc..4cb27e0 100644 --- a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftError.java +++ b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftError.java @@ -2645,7 +2645,7 @@ record MismatchedSwiftOrderParamsMarketIndex(int code, String msg) implements Dr record InvalidSwiftOrderParam(int code, String msg) implements DriftError { public static final InvalidSwiftOrderParam INSTANCE = new InvalidSwiftOrderParam( - 6288, "Swift only available for market/oracle perp orders" + 6288, "Invalid swift order param" ); } diff --git a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftProgram.java b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftProgram.java index 88bdb40..103d168 100644 --- a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftProgram.java +++ b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/DriftProgram.java @@ -1133,7 +1133,6 @@ public static Instruction placeSwiftTakerOrder(final AccountMeta invokedDriftPro // The Instruction Sysvar has not been implemented // in the Anchor framework yet, so this is the safe approach. final PublicKey ixSysvarKey, - final byte[] swiftMessageBytes, final byte[] swiftOrderParamsMessageBytes) { final var keys = List.of( createRead(stateKey), @@ -1144,15 +1143,14 @@ public static Instruction placeSwiftTakerOrder(final AccountMeta invokedDriftPro createRead(ixSysvarKey) ); - final byte[] _data = new byte[16 + Borsh.lenVector(swiftMessageBytes) + Borsh.lenVector(swiftOrderParamsMessageBytes)]; + final byte[] _data = new byte[12 + Borsh.lenVector(swiftOrderParamsMessageBytes)]; int i = writeDiscriminator(PLACE_SWIFT_TAKER_ORDER_DISCRIMINATOR, _data, 0); - i += Borsh.writeVector(swiftMessageBytes, _data, i); Borsh.writeVector(swiftOrderParamsMessageBytes, _data, i); return Instruction.createInstruction(invokedDriftProgramMeta, keys, _data); } - public record PlaceSwiftTakerOrderIxData(Discriminator discriminator, byte[] swiftMessageBytes, byte[] swiftOrderParamsMessageBytes) implements Borsh { + public record PlaceSwiftTakerOrderIxData(Discriminator discriminator, byte[] swiftOrderParamsMessageBytes) implements Borsh { public static PlaceSwiftTakerOrderIxData read(final Instruction instruction) { return read(instruction.data(), instruction.offset()); @@ -1164,23 +1162,20 @@ public static PlaceSwiftTakerOrderIxData read(final byte[] _data, final int offs } final var discriminator = parseDiscriminator(_data, offset); int i = offset + discriminator.length(); - final byte[] swiftMessageBytes = Borsh.readbyteVector(_data, i); - i += Borsh.lenVector(swiftMessageBytes); final byte[] swiftOrderParamsMessageBytes = Borsh.readbyteVector(_data, i); - return new PlaceSwiftTakerOrderIxData(discriminator, swiftMessageBytes, swiftOrderParamsMessageBytes); + return new PlaceSwiftTakerOrderIxData(discriminator, swiftOrderParamsMessageBytes); } @Override public int write(final byte[] _data, final int offset) { int i = offset + discriminator.write(_data, offset); - i += Borsh.writeVector(swiftMessageBytes, _data, i); i += Borsh.writeVector(swiftOrderParamsMessageBytes, _data, i); return i - offset; } @Override public int l() { - return 8 + Borsh.lenVector(swiftMessageBytes) + Borsh.lenVector(swiftOrderParamsMessageBytes); + return 8 + Borsh.lenVector(swiftOrderParamsMessageBytes); } } @@ -2312,7 +2307,7 @@ public static Instruction deleteUser(final AccountMeta invokedDriftProgramMeta, createWrite(userKey), createWrite(userStatsKey), createWrite(stateKey), - createReadOnlySigner(authorityKey) + createWritableSigner(authorityKey) ); return Instruction.createInstruction(invokedDriftProgramMeta, keys, DELETE_USER_DISCRIMINATOR); diff --git a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftOrderParamsMessage.java b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftOrderParamsMessage.java index 9d1e8bc..7f90d8f 100644 --- a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftOrderParamsMessage.java +++ b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftOrderParamsMessage.java @@ -3,10 +3,14 @@ import software.sava.core.borsh.Borsh; import static software.sava.core.encoding.ByteUtil.getInt16LE; +import static software.sava.core.encoding.ByteUtil.getInt64LE; import static software.sava.core.encoding.ByteUtil.putInt16LE; +import static software.sava.core.encoding.ByteUtil.putInt64LE; public record SwiftOrderParamsMessage(OrderParams swiftOrderParams, int subAccountId, + long slot, + byte[] uuid, SwiftTriggerOrderParams takeProfitOrderParams, SwiftTriggerOrderParams stopLossOrderParams) implements Borsh { @@ -19,6 +23,10 @@ public static SwiftOrderParamsMessage read(final byte[] _data, final int offset) i += Borsh.len(swiftOrderParams); final var subAccountId = getInt16LE(_data, i); i += 2; + final var slot = getInt64LE(_data, i); + i += 8; + final var uuid = new byte[8]; + i += Borsh.readArray(uuid, _data, i); final var takeProfitOrderParams = _data[i++] == 0 ? null : SwiftTriggerOrderParams.read(_data, i); if (takeProfitOrderParams != null) { i += Borsh.len(takeProfitOrderParams); @@ -26,6 +34,8 @@ public static SwiftOrderParamsMessage read(final byte[] _data, final int offset) final var stopLossOrderParams = _data[i++] == 0 ? null : SwiftTriggerOrderParams.read(_data, i); return new SwiftOrderParamsMessage(swiftOrderParams, subAccountId, + slot, + uuid, takeProfitOrderParams, stopLossOrderParams); } @@ -36,6 +46,9 @@ public int write(final byte[] _data, final int offset) { i += Borsh.write(swiftOrderParams, _data, i); putInt16LE(_data, i, subAccountId); i += 2; + putInt64LE(_data, i, slot); + i += 8; + i += Borsh.writeArray(uuid, _data, i); i += Borsh.writeOptional(takeProfitOrderParams, _data, i); i += Borsh.writeOptional(stopLossOrderParams, _data, i); return i - offset; @@ -43,6 +56,11 @@ public int write(final byte[] _data, final int offset) { @Override public int l() { - return Borsh.len(swiftOrderParams) + 2 + (takeProfitOrderParams == null ? 1 : (1 + Borsh.len(takeProfitOrderParams))) + (stopLossOrderParams == null ? 1 : (1 + Borsh.len(stopLossOrderParams))); + return Borsh.len(swiftOrderParams) + + 2 + + 8 + + Borsh.lenArray(uuid) + + (takeProfitOrderParams == null ? 1 : (1 + Borsh.len(takeProfitOrderParams))) + + (stopLossOrderParams == null ? 1 : (1 + Borsh.len(stopLossOrderParams))); } } diff --git a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftServerMessage.java b/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftServerMessage.java deleted file mode 100644 index f30cdc7..0000000 --- a/programs/src/main/java/software/sava/anchor/programs/drift/anchor/types/SwiftServerMessage.java +++ /dev/null @@ -1,41 +0,0 @@ -package software.sava.anchor.programs.drift.anchor.types; - -import software.sava.core.borsh.Borsh; - -import static software.sava.core.encoding.ByteUtil.getInt64LE; -import static software.sava.core.encoding.ByteUtil.putInt64LE; - -public record SwiftServerMessage(byte[] uuid, - byte[] swiftOrderSignature, - long slot) implements Borsh { - - public static final int BYTES = 80; - - public static SwiftServerMessage read(final byte[] _data, final int offset) { - if (_data == null || _data.length == 0) { - return null; - } - int i = offset; - final var uuid = new byte[8]; - i += Borsh.readArray(uuid, _data, i); - final var swiftOrderSignature = new byte[64]; - i += Borsh.readArray(swiftOrderSignature, _data, i); - final var slot = getInt64LE(_data, i); - return new SwiftServerMessage(uuid, swiftOrderSignature, slot); - } - - @Override - public int write(final byte[] _data, final int offset) { - int i = offset; - i += Borsh.writeArray(uuid, _data, i); - i += Borsh.writeArray(swiftOrderSignature, _data, i); - putInt64LE(_data, i, slot); - i += 8; - return i - offset; - } - - @Override - public int l() { - return BYTES; - } -} diff --git a/programs/src/main/java/software/sava/anchor/programs/glam/GlamProgramAccountClientImpl.java b/programs/src/main/java/software/sava/anchor/programs/glam/GlamProgramAccountClientImpl.java index 0f98fbe..c7858c0 100644 --- a/programs/src/main/java/software/sava/anchor/programs/glam/GlamProgramAccountClientImpl.java +++ b/programs/src/main/java/software/sava/anchor/programs/glam/GlamProgramAccountClientImpl.java @@ -630,6 +630,7 @@ public Instruction subscribe(final PublicKey assetKey, assetATAKey, policyPDA.publicKey(), manager.publicKey(), + shareClassId, amount, true ); diff --git a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamError.java b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamError.java index 6e6e91c..df9e793 100644 --- a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamError.java +++ b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamError.java @@ -3,109 +3,28 @@ import software.sava.anchor.ProgramError; public sealed interface GlamError extends ProgramError permits - GlamError.InvalidShareClass, - GlamError.InvalidAssetSubscribe, - GlamError.InvalidPricingOracle, - GlamError.InvalidRemainingAccounts, - GlamError.InvalidTreasuryAccount, - GlamError.InvalidSignerAccount, - GlamError.InvalidAssetPrice, - GlamError.InvalidStableCoinPriceForSubscribe, - GlamError.SubscribeRedeemDisable, - GlamError.InvalidPolicyAccount, - GlamError.PriceTooOld { + GlamError.ShareClassNotEmpty, + GlamError.InvalidTokenAccount { static GlamError getInstance(final int errorCode) { return switch (errorCode) { - case 6000 -> InvalidShareClass.INSTANCE; - case 6001 -> InvalidAssetSubscribe.INSTANCE; - case 6002 -> InvalidPricingOracle.INSTANCE; - case 6003 -> InvalidRemainingAccounts.INSTANCE; - case 6004 -> InvalidTreasuryAccount.INSTANCE; - case 6005 -> InvalidSignerAccount.INSTANCE; - case 6006 -> InvalidAssetPrice.INSTANCE; - case 6007 -> InvalidStableCoinPriceForSubscribe.INSTANCE; - case 6008 -> SubscribeRedeemDisable.INSTANCE; - case 6009 -> InvalidPolicyAccount.INSTANCE; - case 6010 -> PriceTooOld.INSTANCE; + case 6000 -> ShareClassNotEmpty.INSTANCE; + case 6001 -> InvalidTokenAccount.INSTANCE; default -> throw new IllegalStateException("Unexpected Glam error code: " + errorCode); }; } - record InvalidShareClass(int code, String msg) implements GlamError { + record ShareClassNotEmpty(int code, String msg) implements GlamError { - public static final InvalidShareClass INSTANCE = new InvalidShareClass( - 6000, "Share class not allowed to subscribe" + public static final ShareClassNotEmpty INSTANCE = new ShareClassNotEmpty( + 6000, "Share class mint supply not zero" ); } - record InvalidAssetSubscribe(int code, String msg) implements GlamError { + record InvalidTokenAccount(int code, String msg) implements GlamError { - public static final InvalidAssetSubscribe INSTANCE = new InvalidAssetSubscribe( - 6001, "Asset not allowed to subscribe" - ); - } - - record InvalidPricingOracle(int code, String msg) implements GlamError { - - public static final InvalidPricingOracle INSTANCE = new InvalidPricingOracle( - 6002, "Invalid oracle for asset price" - ); - } - - record InvalidRemainingAccounts(int code, String msg) implements GlamError { - - public static final InvalidRemainingAccounts INSTANCE = new InvalidRemainingAccounts( - 6003, "Invalid accounts: the transaction is malformed" - ); - } - - record InvalidTreasuryAccount(int code, String msg) implements GlamError { - - public static final InvalidTreasuryAccount INSTANCE = new InvalidTreasuryAccount( - 6004, "Invalid treasury ata" - ); - } - - record InvalidSignerAccount(int code, String msg) implements GlamError { - - public static final InvalidSignerAccount INSTANCE = new InvalidSignerAccount( - 6005, "Invalid signer ata" - ); - } - - record InvalidAssetPrice(int code, String msg) implements GlamError { - - public static final InvalidAssetPrice INSTANCE = new InvalidAssetPrice( - 6006, "Invalid asset price" - ); - } - - record InvalidStableCoinPriceForSubscribe(int code, String msg) implements GlamError { - - public static final InvalidStableCoinPriceForSubscribe INSTANCE = new InvalidStableCoinPriceForSubscribe( - 6007, "Subscription not allowed: invalid stable coin price" - ); - } - - record SubscribeRedeemDisable(int code, String msg) implements GlamError { - - public static final SubscribeRedeemDisable INSTANCE = new SubscribeRedeemDisable( - 6008, "Fund is disabled for subscription and redemption" - ); - } - - record InvalidPolicyAccount(int code, String msg) implements GlamError { - - public static final InvalidPolicyAccount INSTANCE = new InvalidPolicyAccount( - 6009, "Policy account is mandatory" - ); - } - - record PriceTooOld(int code, String msg) implements GlamError { - - public static final PriceTooOld INSTANCE = new PriceTooOld( - 6010, "Price is too old" + public static final InvalidTokenAccount INSTANCE = new InvalidTokenAccount( + 6001, "Invalid token account" ); } } diff --git a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamPDAs.java b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamPDAs.java index 8a6e15d..821dd90 100644 --- a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamPDAs.java +++ b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamPDAs.java @@ -46,11 +46,11 @@ public static ProgramDerivedAddress fromAtaPDA(final PublicKey program, } public static ProgramDerivedAddress fundPDA(final PublicKey program, - final PublicKey managerAccount, + final PublicKey signerAccount, final byte[] fundModelCreated) { return PublicKey.findProgramAddress(List.of( "fund".getBytes(US_ASCII), - managerAccount.toByteArray(), + signerAccount.toByteArray(), fundModelCreated ), program); } @@ -67,11 +67,11 @@ public static ProgramDerivedAddress inputSignerAtaPDA(final PublicKey program, } public static ProgramDerivedAddress managerAtaPDA(final PublicKey program, - final PublicKey managerAccount, + final PublicKey signerAccount, final PublicKey tokenProgramAccount, final PublicKey assetAccount) { return PublicKey.findProgramAddress(List.of( - managerAccount.toByteArray(), + signerAccount.toByteArray(), tokenProgramAccount.toByteArray(), assetAccount.toByteArray() ), program); diff --git a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamProgram.java b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamProgram.java index 1ab42bb..549fbb5 100644 --- a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamProgram.java +++ b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/GlamProgram.java @@ -44,14 +44,14 @@ public static Instruction addShareClass(final AccountMeta invokedGlamProgramMeta final PublicKey extraAccountMetaListKey, final PublicKey fundKey, final PublicKey openfundsKey, - final PublicKey managerKey, + final PublicKey signerKey, final ShareClassModel shareClassMetadata) { final var keys = List.of( createWrite(shareClassMintKey), createWrite(extraAccountMetaListKey), createWrite(fundKey), createWrite(openfundsKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.systemProgram()), createRead(solanaAccounts.token2022Program()) ); @@ -100,7 +100,7 @@ public static Instruction burnShare(final AccountMeta invokedGlamProgramMeta, final PublicKey fromKey, final PublicKey shareClassMintKey, final PublicKey fundKey, - final PublicKey managerKey, + final PublicKey signerKey, final int shareClassId, final long amount) { final var keys = List.of( @@ -108,7 +108,7 @@ public static Instruction burnShare(final AccountMeta invokedGlamProgramMeta, createRead(fromKey), createWrite(shareClassMintKey), createWrite(fundKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.token2022Program()) ); @@ -230,12 +230,12 @@ public static Instruction closeFund(final AccountMeta invokedGlamProgramMeta, final PublicKey fundKey, final PublicKey openfundsKey, final PublicKey treasuryKey, - final PublicKey managerKey) { + final PublicKey signerKey) { final var keys = List.of( createWrite(fundKey), createWrite(openfundsKey), createWrite(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.systemProgram()) ); @@ -251,7 +251,7 @@ public static Instruction closeShareClass(final AccountMeta invokedGlamProgramMe final PublicKey shareClassMintKey, final PublicKey extraAccountMetaListKey, final PublicKey openfundsKey, - final PublicKey managerKey, + final PublicKey signerKey, final int shareClassId) { final var keys = List.of( createWrite(fundKey), @@ -259,7 +259,7 @@ public static Instruction closeShareClass(final AccountMeta invokedGlamProgramMe createWrite(shareClassMintKey), createWrite(extraAccountMetaListKey), createWrite(openfundsKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.token2022Program()) ); @@ -308,11 +308,11 @@ public static Instruction closeTokenAccounts(final AccountMeta invokedGlamProgra final SolanaAccounts solanaAccounts, final PublicKey fundKey, final PublicKey treasuryKey, - final PublicKey managerKey) { + final PublicKey signerKey) { final var keys = List.of( createWrite(fundKey), createWrite(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.tokenProgram()), createRead(solanaAccounts.token2022Program()) ); @@ -324,11 +324,11 @@ public static Instruction closeTokenAccounts(final AccountMeta invokedGlamProgra public static Instruction deactivateStakeAccounts(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(fundKey), createWrite(treasuryKey), createRead(solanaAccounts.clockSysVar()), @@ -346,7 +346,7 @@ public static Instruction driftCancelOrders(final AccountMeta invokedGlamProgram final PublicKey userKey, final PublicKey stateKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final MarketType marketType, final OptionalInt marketIndex, @@ -356,7 +356,7 @@ public static Instruction driftCancelOrders(final AccountMeta invokedGlamProgram createWrite(userKey), createWrite(stateKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey), createRead(solanaAccounts.tokenProgram()) ); @@ -426,57 +426,20 @@ public static Instruction driftDeleteUser(final AccountMeta invokedGlamProgramMe final PublicKey userStatsKey, final PublicKey stateKey, final PublicKey treasuryKey, - final PublicKey managerKey, - final PublicKey driftProgramKey, - final int subAccountId) { + final PublicKey signerKey, + final PublicKey driftProgramKey) { final var keys = List.of( createRead(fundKey), createWrite(userKey), createWrite(userStatsKey), createWrite(stateKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey), createRead(solanaAccounts.systemProgram()) ); - final byte[] _data = new byte[10]; - int i = writeDiscriminator(DRIFT_DELETE_USER_DISCRIMINATOR, _data, 0); - putInt16LE(_data, i, subAccountId); - - return Instruction.createInstruction(invokedGlamProgramMeta, keys, _data); - } - - public record DriftDeleteUserIxData(Discriminator discriminator, int subAccountId) implements Borsh { - - public static DriftDeleteUserIxData read(final Instruction instruction) { - return read(instruction.data(), instruction.offset()); - } - - public static final int BYTES = 10; - - public static DriftDeleteUserIxData read(final byte[] _data, final int offset) { - if (_data == null || _data.length == 0) { - return null; - } - final var discriminator = parseDiscriminator(_data, offset); - int i = offset + discriminator.length(); - final var subAccountId = getInt16LE(_data, i); - return new DriftDeleteUserIxData(discriminator, subAccountId); - } - - @Override - public int write(final byte[] _data, final int offset) { - int i = offset + discriminator.write(_data, offset); - putInt16LE(_data, i, subAccountId); - i += 2; - return i - offset; - } - - @Override - public int l() { - return BYTES; - } + return Instruction.createInstruction(invokedGlamProgramMeta, keys, DRIFT_DELETE_USER_DISCRIMINATOR); } public static final Discriminator DRIFT_DEPOSIT_DISCRIMINATOR = toDiscriminator(252, 63, 250, 201, 98, 55, 130, 12); @@ -490,7 +453,7 @@ public static Instruction driftDeposit(final AccountMeta invokedGlamProgramMeta, final PublicKey treasuryKey, final PublicKey driftAtaKey, final PublicKey treasuryAtaKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final int marketIndex, final long amount) { @@ -502,7 +465,7 @@ public static Instruction driftDeposit(final AccountMeta invokedGlamProgramMeta, createRead(treasuryKey), createWrite(driftAtaKey), createWrite(treasuryAtaKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey), createRead(solanaAccounts.tokenProgram()) ); @@ -561,7 +524,7 @@ public static Instruction driftInitialize(final AccountMeta invokedGlamProgramMe final PublicKey userStatsKey, final PublicKey stateKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey) { final var keys = List.of( createRead(fundKey), @@ -569,7 +532,7 @@ public static Instruction driftInitialize(final AccountMeta invokedGlamProgramMe createWrite(userStatsKey), createWrite(stateKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey), createRead(solanaAccounts.rentSysVar()), createRead(solanaAccounts.systemProgram()) @@ -586,7 +549,7 @@ public static Instruction driftPlaceOrders(final AccountMeta invokedGlamProgramM final PublicKey userKey, final PublicKey stateKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final OrderParams[] orderParams) { final var keys = List.of( @@ -594,7 +557,7 @@ public static Instruction driftPlaceOrders(final AccountMeta invokedGlamProgramM createWrite(userKey), createWrite(stateKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey), createRead(solanaAccounts.tokenProgram()) ); @@ -641,7 +604,7 @@ public static Instruction driftUpdateUserCustomMarginRatio(final AccountMeta inv final PublicKey fundKey, final PublicKey userKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final int subAccountId, final int marginRatio) { @@ -649,7 +612,7 @@ public static Instruction driftUpdateUserCustomMarginRatio(final AccountMeta inv createRead(fundKey), createWrite(userKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey) ); @@ -704,7 +667,7 @@ public static Instruction driftUpdateUserDelegate(final AccountMeta invokedGlamP final PublicKey fundKey, final PublicKey userKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final int subAccountId, final PublicKey delegate) { @@ -712,7 +675,7 @@ public static Instruction driftUpdateUserDelegate(final AccountMeta invokedGlamP createRead(fundKey), createWrite(userKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey) ); @@ -767,7 +730,7 @@ public static Instruction driftUpdateUserMarginTradingEnabled(final AccountMeta final PublicKey fundKey, final PublicKey userKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final int subAccountId, final boolean marginTradingEnabled) { @@ -775,7 +738,7 @@ public static Instruction driftUpdateUserMarginTradingEnabled(final AccountMeta createRead(fundKey), createWrite(userKey), createRead(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey) ); @@ -836,7 +799,7 @@ public static Instruction driftWithdraw(final AccountMeta invokedGlamProgramMeta final PublicKey treasuryKey, final PublicKey treasuryAtaKey, final PublicKey driftAtaKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey driftProgramKey, final int marketIndex, final long amount) { @@ -849,7 +812,7 @@ public static Instruction driftWithdraw(final AccountMeta invokedGlamProgramMeta createRead(treasuryKey), createWrite(treasuryAtaKey), createWrite(driftAtaKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(driftProgramKey), createRead(solanaAccounts.tokenProgram()) ); @@ -909,7 +872,7 @@ public static Instruction forceTransferShare(final AccountMeta invokedGlamProgra final PublicKey toKey, final PublicKey shareClassMintKey, final PublicKey fundKey, - final PublicKey managerKey, + final PublicKey signerKey, final int shareClassId, final long amount) { final var keys = List.of( @@ -919,7 +882,7 @@ public static Instruction forceTransferShare(final AccountMeta invokedGlamProgra createRead(toKey), createWrite(shareClassMintKey), createWrite(fundKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.token2022Program()) ); @@ -1059,7 +1022,7 @@ public static Instruction initLockedVoterEscrow(final AccountMeta invokedGlamPro public static Instruction initializeAndDelegateStake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey treasuryStakeAccountKey, @@ -1069,7 +1032,7 @@ public static Instruction initializeAndDelegateStake(final AccountMeta invokedGl final String stakeAccountId, final int stakeAccountBump) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(treasuryStakeAccountKey), @@ -1147,13 +1110,13 @@ public static Instruction initializeFund(final AccountMeta invokedGlamProgramMet final PublicKey fundKey, final PublicKey openfundsKey, final PublicKey treasuryKey, - final PublicKey managerKey, + final PublicKey signerKey, final FundModel fund) { final var keys = List.of( createWrite(fundKey), createWrite(openfundsKey), createWrite(treasuryKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.systemProgram()) ); @@ -1275,14 +1238,14 @@ public int l() { public static Instruction marinadeClaimTickets(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey marinadeStateKey, final PublicKey reservePdaKey, final PublicKey marinadeProgramKey) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(marinadeStateKey), @@ -1301,7 +1264,7 @@ public static Instruction marinadeClaimTickets(final AccountMeta invokedGlamProg public static Instruction marinadeDelayedUnstake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey ticketKey, @@ -1314,7 +1277,7 @@ public static Instruction marinadeDelayedUnstake(final AccountMeta invokedGlamPr final String ticketId, final int bump) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(ticketKey), @@ -1391,7 +1354,7 @@ public int l() { public static Instruction marinadeDepositSol(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey marinadeStateKey, @@ -1405,7 +1368,7 @@ public static Instruction marinadeDepositSol(final AccountMeta invokedGlamProgra final PublicKey marinadeProgramKey, final long lamports) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(fundKey), createWrite(treasuryKey), createWrite(marinadeStateKey), @@ -1465,7 +1428,7 @@ public int l() { public static Instruction marinadeDepositStake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey marinadeStateKey, @@ -1479,7 +1442,7 @@ public static Instruction marinadeDepositStake(final AccountMeta invokedGlamProg final PublicKey marinadeProgramKey, final int validatorIdx) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(fundKey), createWrite(treasuryKey), createWrite(marinadeStateKey), @@ -1542,7 +1505,7 @@ public int l() { public static Instruction marinadeLiquidUnstake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey marinadeStateKey, @@ -1555,7 +1518,7 @@ public static Instruction marinadeLiquidUnstake(final AccountMeta invokedGlamPro final PublicKey marinadeProgramKey, final long msolAmount) { final var keys = List.of( - createReadOnlySigner(managerKey), + createReadOnlySigner(signerKey), createRead(fundKey), createWrite(treasuryKey), createWrite(marinadeStateKey), @@ -1638,13 +1601,13 @@ public static Instruction mergePartialUnstaking(final AccountMeta invokedGlamPro public static Instruction mergeStakeAccounts(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey toStakeKey, final PublicKey fromStakeKey) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(toStakeKey), @@ -1666,7 +1629,7 @@ public static Instruction mintShare(final AccountMeta invokedGlamProgramMeta, final PublicKey recipientKey, final PublicKey shareClassMintKey, final PublicKey fundKey, - final PublicKey managerKey, + final PublicKey signerKey, final int shareClassId, final long amount) { final var keys = List.of( @@ -1674,7 +1637,7 @@ public static Instruction mintShare(final AccountMeta invokedGlamProgramMeta, createRead(recipientKey), createWrite(shareClassMintKey), createWrite(fundKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.token2022Program()) ); @@ -1900,7 +1863,7 @@ public int l() { public static Instruction redelegateStake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey existingStakeKey, @@ -1910,7 +1873,7 @@ public static Instruction redelegateStake(final AccountMeta invokedGlamProgramMe final String newStakeAccountId, final int newStakeAccountBump) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(existingStakeKey), @@ -1972,11 +1935,11 @@ public int l() { public static Instruction setSubscribeRedeemEnabled(final AccountMeta invokedGlamProgramMeta, final PublicKey fundKey, - final PublicKey managerKey, + final PublicKey signerKey, final boolean enabled) { final var keys = List.of( createWrite(fundKey), - createWritableSigner(managerKey) + createWritableSigner(signerKey) ); final byte[] _data = new byte[9]; @@ -2024,13 +1987,13 @@ public static Instruction setTokenAccountsStates(final AccountMeta invokedGlamPr final SolanaAccounts solanaAccounts, final PublicKey shareClassMintKey, final PublicKey fundKey, - final PublicKey managerKey, + final PublicKey signerKey, final int shareClassId, final boolean frozen) { final var keys = List.of( createWrite(shareClassMintKey), createWrite(fundKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.token2022Program()) ); @@ -2083,7 +2046,7 @@ public int l() { public static Instruction splitStakeAccount(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey existingStakeKey, @@ -2092,7 +2055,7 @@ public static Instruction splitStakeAccount(final AccountMeta invokedGlamProgram final String newStakeAccountId, final int newStakeAccountBump) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(existingStakeKey), @@ -2164,29 +2127,29 @@ public int l() { public static Instruction stakePoolDepositSol(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, - final PublicKey stakePoolProgramKey, final PublicKey stakePoolKey, final PublicKey withdrawAuthorityKey, final PublicKey reserveStakeKey, final PublicKey poolMintKey, final PublicKey feeAccountKey, final PublicKey mintToKey, + final PublicKey stakePoolProgramKey, final PublicKey tokenProgramKey, final long lamports) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(fundKey), createWrite(treasuryKey), - createRead(stakePoolProgramKey), createWrite(stakePoolKey), createRead(withdrawAuthorityKey), createWrite(reserveStakeKey), createWrite(poolMintKey), createWrite(feeAccountKey), createWrite(mintToKey), + createRead(stakePoolProgramKey), createRead(solanaAccounts.associatedTokenAccountProgram()), createRead(solanaAccounts.systemProgram()), createRead(tokenProgramKey) @@ -2235,7 +2198,7 @@ public int l() { public static Instruction stakePoolDepositStake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey treasuryStakeAccountKey, @@ -2251,7 +2214,7 @@ public static Instruction stakePoolDepositStake(final AccountMeta invokedGlamPro final PublicKey stakePoolProgramKey, final PublicKey tokenProgramKey) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(treasuryStakeAccountKey), @@ -2264,9 +2227,9 @@ public static Instruction stakePoolDepositStake(final AccountMeta invokedGlamPro createWrite(validatorListKey), createWrite(validatorStakeAccountKey), createWrite(reserveStakeAccountKey), - createRead(stakePoolProgramKey), createRead(solanaAccounts.clockSysVar()), createRead(solanaAccounts.stakeHistorySysVar()), + createRead(stakePoolProgramKey), createRead(solanaAccounts.associatedTokenAccountProgram()), createRead(solanaAccounts.systemProgram()), createRead(tokenProgramKey), @@ -2280,23 +2243,22 @@ public static Instruction stakePoolDepositStake(final AccountMeta invokedGlamPro public static Instruction stakePoolWithdrawSol(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, - final PublicKey stakePoolProgramKey, final PublicKey stakePoolKey, final PublicKey withdrawAuthorityKey, final PublicKey reserveStakeKey, final PublicKey poolMintKey, final PublicKey feeAccountKey, final PublicKey poolTokenAtaKey, + final PublicKey stakePoolProgramKey, final PublicKey tokenProgramKey, final long poolTokenAmount) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(fundKey), createWrite(treasuryKey), - createRead(stakePoolProgramKey), createWrite(stakePoolKey), createRead(withdrawAuthorityKey), createWrite(reserveStakeKey), @@ -2305,6 +2267,7 @@ public static Instruction stakePoolWithdrawSol(final AccountMeta invokedGlamProg createWrite(poolTokenAtaKey), createRead(solanaAccounts.clockSysVar()), createRead(solanaAccounts.stakeHistorySysVar()), + createRead(stakePoolProgramKey), createRead(solanaAccounts.systemProgram()), createRead(tokenProgramKey), createRead(solanaAccounts.stakeProgram()) @@ -2353,7 +2316,7 @@ public int l() { public static Instruction stakePoolWithdrawStake(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey, final PublicKey treasuryStakeAccountKey, @@ -2370,7 +2333,7 @@ public static Instruction stakePoolWithdrawStake(final AccountMeta invokedGlamPr final String stakeAccountId, final int stakeAccountBump) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createWrite(treasuryStakeAccountKey), @@ -2381,8 +2344,8 @@ public static Instruction stakePoolWithdrawStake(final AccountMeta invokedGlamPr createWrite(validatorListKey), createWrite(validatorStakeAccountKey), createWrite(poolTokenAtaKey), - createRead(stakePoolProgramKey), createRead(solanaAccounts.clockSysVar()), + createRead(stakePoolProgramKey), createRead(solanaAccounts.systemProgram()), createRead(tokenProgramKey), createRead(solanaAccounts.stakeProgram()) @@ -2459,6 +2422,7 @@ public static Instruction subscribe(final AccountMeta invokedGlamProgramMeta, final PublicKey signerAssetAtaKey, final PublicKey signerPolicyKey, final PublicKey signerKey, + final int shareClassId, final long amount, final boolean skipState) { final var keys = List.of( @@ -2477,8 +2441,10 @@ public static Instruction subscribe(final AccountMeta invokedGlamProgramMeta, createRead(solanaAccounts.token2022Program()) ); - final byte[] _data = new byte[17]; + final byte[] _data = new byte[18]; int i = writeDiscriminator(SUBSCRIBE_DISCRIMINATOR, _data, 0); + _data[i] = (byte) shareClassId; + ++i; putInt64LE(_data, i, amount); i += 8; _data[i] = (byte) (skipState ? 1 : 0); @@ -2486,13 +2452,16 @@ public static Instruction subscribe(final AccountMeta invokedGlamProgramMeta, return Instruction.createInstruction(invokedGlamProgramMeta, keys, _data); } - public record SubscribeIxData(Discriminator discriminator, long amount, boolean skipState) implements Borsh { + public record SubscribeIxData(Discriminator discriminator, + int shareClassId, + long amount, + boolean skipState) implements Borsh { public static SubscribeIxData read(final Instruction instruction) { return read(instruction.data(), instruction.offset()); } - public static final int BYTES = 17; + public static final int BYTES = 18; public static SubscribeIxData read(final byte[] _data, final int offset) { if (_data == null || _data.length == 0) { @@ -2500,15 +2469,19 @@ public static SubscribeIxData read(final byte[] _data, final int offset) { } final var discriminator = parseDiscriminator(_data, offset); int i = offset + discriminator.length(); + final var shareClassId = _data[i] & 0xFF; + ++i; final var amount = getInt64LE(_data, i); i += 8; final var skipState = _data[i] == 1; - return new SubscribeIxData(discriminator, amount, skipState); + return new SubscribeIxData(discriminator, shareClassId, amount, skipState); } @Override public int write(final byte[] _data, final int offset) { int i = offset + discriminator.write(_data, offset); + _data[i] = (byte) shareClassId; + ++i; putInt64LE(_data, i, amount); i += 8; _data[i] = (byte) (skipState ? 1 : 0); @@ -2697,13 +2670,13 @@ public static Instruction updateShareClass(final AccountMeta invokedGlamProgramM final SolanaAccounts solanaAccounts, final PublicKey shareClassMintKey, final PublicKey fundKey, - final PublicKey managerKey, + final PublicKey signerKey, final int shareClassId, final ShareClassModel shareClassMetadata) { final var keys = List.of( createWrite(shareClassMintKey), createWrite(fundKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(solanaAccounts.token2022Program()) ); @@ -2757,7 +2730,7 @@ public static Instruction withdraw(final AccountMeta invokedGlamProgramMeta, final PublicKey assetKey, final PublicKey treasuryAtaKey, final PublicKey managerAtaKey, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey tokenProgramKey, final long amount) { final var keys = List.of( @@ -2766,7 +2739,7 @@ public static Instruction withdraw(final AccountMeta invokedGlamProgramMeta, createRead(assetKey), createWrite(treasuryAtaKey), createWrite(managerAtaKey), - createWritableSigner(managerKey), + createWritableSigner(signerKey), createRead(tokenProgramKey) ); @@ -2840,11 +2813,11 @@ public static Instruction withdrawAllStakedJup(final AccountMeta invokedGlamProg public static Instruction withdrawFromStakeAccounts(final AccountMeta invokedGlamProgramMeta, final SolanaAccounts solanaAccounts, - final PublicKey managerKey, + final PublicKey signerKey, final PublicKey fundKey, final PublicKey treasuryKey) { final var keys = List.of( - createWritableSigner(managerKey), + createWritableSigner(signerKey), createWrite(fundKey), createWrite(treasuryKey), createRead(solanaAccounts.clockSysVar()), diff --git a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/types/IntegrationName.java b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/types/IntegrationName.java index 29bea79..59ec50d 100644 --- a/programs/src/main/java/software/sava/anchor/programs/glam/anchor/types/IntegrationName.java +++ b/programs/src/main/java/software/sava/anchor/programs/glam/anchor/types/IntegrationName.java @@ -10,7 +10,7 @@ public enum IntegrationName implements Borsh.Enum { SanctumStakePool, NativeStaking, Marinade, - Jupiter, + JupiterSwap, Mint, JupiterVote; diff --git a/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/JupiterProgram.java b/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/JupiterProgram.java index dc39b17..215348a 100644 --- a/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/JupiterProgram.java +++ b/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/JupiterProgram.java @@ -159,62 +159,6 @@ public static Instruction createOpenOrders(final AccountMeta invokedJupiterProgr return Instruction.createInstruction(invokedJupiterProgramMeta, keys, CREATE_OPEN_ORDERS_DISCRIMINATOR); } - public static final Discriminator CREATE_TOKEN_ACCOUNT_DISCRIMINATOR = toDiscriminator(147, 241, 123, 100, 244, 132, 174, 118); - - public static Instruction createTokenAccount(final AccountMeta invokedJupiterProgramMeta, - final PublicKey tokenAccountKey, - final PublicKey userKey, - final PublicKey mintKey, - final PublicKey tokenProgramKey, - final PublicKey systemProgramKey, - final int bump) { - final var keys = List.of( - createWrite(tokenAccountKey), - createWritableSigner(userKey), - createRead(mintKey), - createRead(tokenProgramKey), - createRead(systemProgramKey) - ); - - final byte[] _data = new byte[9]; - int i = writeDiscriminator(CREATE_TOKEN_ACCOUNT_DISCRIMINATOR, _data, 0); - _data[i] = (byte) bump; - - return Instruction.createInstruction(invokedJupiterProgramMeta, keys, _data); - } - - public record CreateTokenAccountIxData(Discriminator discriminator, int bump) implements Borsh { - - public static CreateTokenAccountIxData read(final Instruction instruction) { - return read(instruction.data(), instruction.offset()); - } - - public static final int BYTES = 9; - - public static CreateTokenAccountIxData read(final byte[] _data, final int offset) { - if (_data == null || _data.length == 0) { - return null; - } - final var discriminator = parseDiscriminator(_data, offset); - int i = offset + discriminator.length(); - final var bump = _data[i] & 0xFF; - return new CreateTokenAccountIxData(discriminator, bump); - } - - @Override - public int write(final byte[] _data, final int offset) { - int i = offset + discriminator.write(_data, offset); - _data[i] = (byte) bump; - ++i; - return i - offset; - } - - @Override - public int l() { - return BYTES; - } - } - public static final Discriminator CREATE_PROGRAM_OPEN_ORDERS_DISCRIMINATOR = toDiscriminator(28, 226, 32, 148, 188, 136, 113, 171); public static Instruction createProgramOpenOrders(final AccountMeta invokedJupiterProgramMeta, diff --git a/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/types/Swap.java b/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/types/Swap.java index c974da4..0662358 100644 --- a/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/types/Swap.java +++ b/programs/src/main/java/software/sava/anchor/programs/jupiter/swap/anchor/types/Swap.java @@ -73,7 +73,11 @@ public sealed interface Swap extends RustEnum permits Swap.SolFi, Swap.SolayerDelegateNoInit, Swap.SolayerUndelegateNoInit, - Swap.TokenMill { + Swap.TokenMill, + Swap.DaoFunBuy, + Swap.DaoFunSell, + Swap.ZeroFi, + Swap.WooFi { static Swap read(final byte[] _data, final int offset) { final int ordinal = _data[offset] & 0xFF; @@ -144,6 +148,10 @@ static Swap read(final byte[] _data, final int offset) { case 62 -> SolayerDelegateNoInit.INSTANCE; case 63 -> SolayerUndelegateNoInit.INSTANCE; case 64 -> TokenMill.read(_data, i); + case 65 -> DaoFunBuy.INSTANCE; + case 66 -> DaoFunSell.INSTANCE; + case 67 -> ZeroFi.INSTANCE; + case 68 -> WooFi.INSTANCE; default -> throw new IllegalStateException(java.lang.String.format( "Unexpected ordinal [%d] for enum [Swap]", ordinal )); @@ -1032,4 +1040,44 @@ public int ordinal() { return 64; } } + + record DaoFunBuy() implements EnumNone, Swap { + + public static final DaoFunBuy INSTANCE = new DaoFunBuy(); + + @Override + public int ordinal() { + return 65; + } + } + + record DaoFunSell() implements EnumNone, Swap { + + public static final DaoFunSell INSTANCE = new DaoFunSell(); + + @Override + public int ordinal() { + return 66; + } + } + + record ZeroFi() implements EnumNone, Swap { + + public static final ZeroFi INSTANCE = new ZeroFi(); + + @Override + public int ordinal() { + return 67; + } + } + + record WooFi() implements EnumNone, Swap { + + public static final WooFi INSTANCE = new WooFi(); + + @Override + public int ordinal() { + return 68; + } + } }