diff --git a/sol-anchor/convo.go b/sol-anchor/convo.go index 3c838dd..10804af 100644 --- a/sol-anchor/convo.go +++ b/sol-anchor/convo.go @@ -68,6 +68,13 @@ func (c *Convo) Update(msg loop.Msg) loop.Cmd { return loop.Quit(fmt.Errorf(`something went wrong, here's an error message to share with our devs (%s); we've notified them already`, err)) } + c.State.idl = &IDL{} + err := json.Unmarshal([]byte(c.State.IdlString), &c.State.idl) + if err != nil { + fmt.Println("Error unmarshaling JSON:", err) + return loop.Quit(fmt.Errorf("could not decode IDL")) + } + msgCmd = c.Msg().Message("Ok, I reloaded your state.").Cmd() } else { msgCmd = c.Msg().Message("Ok, let's start a new package.").Cmd() diff --git a/sol-anchor/idl.go b/sol-anchor/idl.go index 7fc714f..191c666 100644 --- a/sol-anchor/idl.go +++ b/sol-anchor/idl.go @@ -39,6 +39,16 @@ func (i *IDL) IsTypeUsed(typeName string) bool { return false } +func (i *IDL) IsTypeEnum(typeName string) bool { + for _, typeObj := range i.Types { + if typeObj.Name == typeName { + return typeObj.Type.IsEnum() + } + } + + return false +} + type Metadata struct { Address string `json:"address"` Name string `json:"name"` // seen in the 'secret' program diff --git a/sol-anchor/idl_test.go b/sol-anchor/idl_test.go index 33ceaae..a8e05d0 100644 --- a/sol-anchor/idl_test.go +++ b/sol-anchor/idl_test.go @@ -48,6 +48,17 @@ func TestOrcaIDL(t *testing.T) { assert.Equal(t, 12, len(result.Types)) } +func TestJupiterV4Swap(t *testing.T) { + idl := readFromFile("jupiter_v4_swap") + + result := &IDL{} + err := json.Unmarshal(idl, &result) + + assert.Nil(t, err) + assert.Equal(t, "JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB", result.Metadata.Address) + assert.True(t, result.IsTypeEnum("SwapLeg")) +} + func readFromFile(idlName string) []byte { data, err := os.ReadFile("tests/" + idlName + ".json") if err != nil { diff --git a/sol-anchor/idl_types.go b/sol-anchor/idl_types.go index dcfdf53..cc978fb 100644 --- a/sol-anchor/idl_types.go +++ b/sol-anchor/idl_types.go @@ -19,6 +19,10 @@ func (t *Type) SnakeCaseName() string { return toSnakeCase(t.Name, true) } +func (t *Type) SnakeCaseNameUpperCase() string { + return strings.ToUpper(t.SnakeCaseName()) +} + func (t *Type) PascalCaseName() string { return textcase.PascalCase(t.Name) } diff --git a/sol-anchor/templates/proto/program.proto.gotmpl b/sol-anchor/templates/proto/program.proto.gotmpl index aa4e8c1..9d51ccf 100644 --- a/sol-anchor/templates/proto/program.proto.gotmpl +++ b/sol-anchor/templates/proto/program.proto.gotmpl @@ -20,7 +20,7 @@ message {{$event.Name}} { {{- $counter := 1 }} {{- range $i, $field := $event.Fields }} {{- $counter = add $counter 1 }} - {{ if or $field.Type.IsArray $field.Type.IsVec }} repeated {{ end }} {{ if $field.Type.IsOption }} optional {{ end }} {{$field.Type.ResolveProtobufType}} {{$field.SnakeCaseName}} = {{ $counter }}; + {{ if or $field.Type.IsArray $field.Type.IsVec }} repeated {{ end }} {{ if $field.Type.IsOption }} optional {{ end }} {{$field.Type.ResolveProtobufType}}{{ if $.Idl.IsTypeEnum $field.Type.ResolveProtobufType }}Enum{{end}} {{$field.SnakeCaseName}} = {{ $counter }}; {{- end}} } {{- end}} @@ -30,7 +30,7 @@ message {{$instruction.PascalCaseName}} { {{- $counter := 1 }} {{- range $i, $arg := $instruction.Args }} {{- $counter = add $counter 1 }} - {{ if or $arg.Type.IsArray $arg.Type.IsVec }}repeated {{ end }}{{ if $arg.Type.IsOption }}optional {{ end }}{{$arg.Type.ResolveProtobufType}} {{$arg.SnakeCaseName}} = {{ $counter }}; + {{ if or $arg.Type.IsArray $arg.Type.IsVec }}repeated {{ end }}{{ if $arg.Type.IsOption }}optional {{ end }}{{$arg.Type.ResolveProtobufType}}{{ if $.Idl.IsTypeEnum $arg.Type.ResolveProtobufType }}Enum{{end}} {{$arg.SnakeCaseName}} = {{ $counter }}; {{- end}} {{- range $i, $acc := $instruction.Accounts }} {{- if not $acc.Address }} @@ -43,6 +43,13 @@ message {{$instruction.PascalCaseName}} { {{ range $i, $type := .Idl.Types }} {{- if $type.Type.IsStruct }} + message {{$type.Name}} { + {{- $counter := 0 }} + {{- range $i, $field := $type.Type.Struct.Fields }} + {{- $counter = add $counter 1 }} + {{ if or $field.Type.IsArray $field.Type.IsVec }} repeated {{ end }} {{ if $field.Type.IsOption }} optional {{ end }} {{$field.Type.ResolveProtobufType}}{{ if $.Idl.IsTypeEnum $field.Type.ResolveProtobufType }}Enum{{end}} {{$field.SnakeCaseName}} = {{ $counter }}; + {{- end}} + } message {{$type.Name}} { {{- $counter := 0 }} {{- range $i, $field := $type.Type.Struct.Fields }} @@ -51,9 +58,9 @@ message {{$type.Name}} { {{- end}} } {{- else }} -enum {{$type.Name}} { +enum {{$type.Name}}Enum { {{- range $i, $variant := $type.Type.Enum.Variants }} - {{ $variant.SnakeCaseName }} = {{ $i }}; + {{ $type.SnakeCaseNameUpperCase }}_{{ $variant.SnakeCaseName }} = {{ $i }}; {{- end}} } {{- end }} diff --git a/sol-anchor/templates/src/lib.rs.gotmpl b/sol-anchor/templates/src/lib.rs.gotmpl index e6b7305..f905826 100644 --- a/sol-anchor/templates/src/lib.rs.gotmpl +++ b/sol-anchor/templates/src/lib.rs.gotmpl @@ -15,7 +15,11 @@ use pb::substreams::v1::program::{{$instruction.PascalCaseName}}; {{- end}} {{- range $i, $type := .Idl.Types }} +{{ if $type.Type.IsEnum }} +use pb::substreams::v1::program::{{$type.Name}}Enum; +{{ else }} use pb::substreams::v1::program::{{$type.Name}}; +{{ end }} {{- end}} use sologger_log_context::programs_selector::ProgramsSelector; diff --git a/sol-anchor/tests/integration/generators/meteora.json b/sol-anchor/tests/integration/generators/meteora.json new file mode 100644 index 0000000..4b3ad84 --- /dev/null +++ b/sol-anchor/tests/integration/generators/meteora.json @@ -0,0 +1,9 @@ +{ + "generator": "sol-anchor-beta", + "state": { + "name": "my_project", + "chainName": "solana-mainnet", + "initialBlockSet": true, + "idlString": "{ \"version\": \"0.7.2\", \"name\": \"vault\", \"docs\": [ \"Program for vault\" ], \"metadata\": { \"address\": \"24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi\" }, \"instructions\": [ { \"name\": \"initialize\", \"docs\": [ \"initialize new vault\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"This is base account for all vault\", \"No need base key now because we only allow 1 vault per token now\", \"Vault account\" ] }, { \"name\": \"payer\", \"isMut\": true, \"isSigner\": true, \"docs\": [ \"Payer can be anyone\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Token vault account\" ] }, { \"name\": \"tokenMint\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"Token mint account\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"rent\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"system_program\" ] } ], \"args\": [] }, { \"name\": \"enableVault\", \"docs\": [ \"enable vault\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Vault account\" ] }, { \"name\": \"admin\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"Admin account\" ] } ], \"args\": [ { \"name\": \"enabled\", \"type\": \"u8\" } ] }, { \"name\": \"setOperator\", \"docs\": [ \"set new operator\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Vault account\" ] }, { \"name\": \"operator\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"admin\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"admin\" ] } ], \"args\": [] }, { \"name\": \"initializeStrategy\", \"docs\": [ \"Initialize a strategy and add strategy to vault.strategies index\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Vault account\" ] }, { \"name\": \"strategyProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"strategy\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Strategy account\" ] }, { \"name\": \"reserve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"collateralVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Collateral vault account\" ] }, { \"name\": \"collateralMint\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"Collateral mint account\" ] }, { \"name\": \"admin\", \"isMut\": true, \"isSigner\": true, \"docs\": [ \"Admin account\" ] }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"System program account\" ] }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"Rent account\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"Token program account\" ] } ], \"args\": [ { \"name\": \"bumps\", \"type\": { \"defined\": \"StrategyBumps\" } }, { \"name\": \"strategyType\", \"type\": { \"defined\": \"StrategyType\" } } ] }, { \"name\": \"removeStrategy\", \"docs\": [ \"remove a strategy\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Vault account\" ] }, { \"name\": \"strategy\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Strategy account\" ] }, { \"name\": \"strategyProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"collateralVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Collateral vault account\" ] }, { \"name\": \"reserve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"feeVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"fee_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] }, { \"name\": \"admin\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"admin\" ] } ], \"args\": [] }, { \"name\": \"removeStrategy2\", \"docs\": [ \"remove a strategy by advance payment\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Vault account\" ] }, { \"name\": \"strategy\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Strategy account\" ] }, { \"name\": \"strategyProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"collateralVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Collateral vault account\" ] }, { \"name\": \"reserve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"tokenAdminAdvancePayment\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_advance_payemnt\", \"the owner of token_advance_payment must be admin\" ] }, { \"name\": \"tokenVaultAdvancePayment\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault_advance_payment\", \"the account must be different from token_vault\", \"the owner of token_advance_payment must be vault\" ] }, { \"name\": \"feeVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"fee_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] }, { \"name\": \"admin\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"admin\" ] } ], \"args\": [ { \"name\": \"maxAdminPayAmount\", \"type\": \"u64\" } ] }, { \"name\": \"collectDust\", \"docs\": [ \"collect token, that someone send wrongly\", \"also help in case Mango reimbursement\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"Token vault, must be different from vault.token_vault\" ] }, { \"name\": \"tokenAdmin\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token admin, enforce owner is admin to avoid mistake\" ] }, { \"name\": \"admin\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"admin\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] } ], \"args\": [] }, { \"name\": \"addStrategy\", \"docs\": [ \"add a strategy\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"strategy\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"strategy\" ] }, { \"name\": \"admin\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"admin\" ] } ], \"args\": [] }, { \"name\": \"depositStrategy\", \"docs\": [ \"deposit liquidity to a strategy\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"strategy\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"strategy\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"feeVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"fee_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"strategyProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"collateralVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"collateral_vault\" ] }, { \"name\": \"reserve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] }, { \"name\": \"operator\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"operator\" ] } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" } ] }, { \"name\": \"withdrawStrategy\", \"docs\": [ \"withdraw liquidity from a strategy\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"strategy\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"strategy\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"feeVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"fee_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"strategyProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"collateralVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"collateral_vault\" ] }, { \"name\": \"reserve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] }, { \"name\": \"operator\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"operator\" ] } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" } ] }, { \"name\": \"withdraw2\", \"docs\": [ \"Withdraw v2. Withdraw from token vault if no remaining accounts are available. Else, it will attempt to withdraw from strategy and token vault. This method just proxy between 2 methods. Protocol integration should be using withdraw instead of this function.\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"userToken\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_token\" ] }, { \"name\": \"userLp\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_lp\" ] }, { \"name\": \"user\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"user\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] } ], \"args\": [ { \"name\": \"unmintAmount\", \"type\": \"u64\" }, { \"name\": \"minOutAmount\", \"type\": \"u64\" } ] }, { \"name\": \"deposit\", \"docs\": [ \"user deposit liquidity to vault\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"userToken\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_token\" ] }, { \"name\": \"userLp\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_lp\" ] }, { \"name\": \"user\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"user\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] } ], \"args\": [ { \"name\": \"tokenAmount\", \"type\": \"u64\" }, { \"name\": \"minimumLpTokenAmount\", \"type\": \"u64\" } ] }, { \"name\": \"withdraw\", \"docs\": [ \"user withdraw liquidity from vault\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"userToken\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_token\" ] }, { \"name\": \"userLp\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_lp\" ] }, { \"name\": \"user\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"user\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] } ], \"args\": [ { \"name\": \"unmintAmount\", \"type\": \"u64\" }, { \"name\": \"minOutAmount\", \"type\": \"u64\" } ] }, { \"name\": \"withdrawDirectlyFromStrategy\", \"docs\": [ \"user withdraw liquidity from vault, if vault reserve doesn't have enough liquidity, it will withdraw from the strategy firstly\" ], \"accounts\": [ { \"name\": \"vault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"vault\" ] }, { \"name\": \"strategy\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"strategy\" ] }, { \"name\": \"reserve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"strategyProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"collateralVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"collateral_vault\" ] }, { \"name\": \"tokenVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"token_vault\" ] }, { \"name\": \"lpMint\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"lp_mint\" ] }, { \"name\": \"feeVault\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"fee_vault\" ] }, { \"name\": \"userToken\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_token\" ] }, { \"name\": \"userLp\", \"isMut\": true, \"isSigner\": false, \"docs\": [ \"user_lp\" ] }, { \"name\": \"user\", \"isMut\": false, \"isSigner\": true, \"docs\": [ \"user\" ] }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false, \"docs\": [ \"token_program\" ] } ], \"args\": [ { \"name\": \"unmintAmount\", \"type\": \"u64\" }, { \"name\": \"minOutAmount\", \"type\": \"u64\" } ] } ], \"accounts\": [ { \"name\": \"Vault\", \"docs\": [ \"Vault struct\" ], \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"enabled\", \"docs\": [ \"The flag, if admin set enable = false, then the user can only withdraw and cannot deposit in the vault.\" ], \"type\": \"u8\" }, { \"name\": \"bumps\", \"docs\": [ \"Vault nonce, to create vault seeds\" ], \"type\": { \"defined\": \"VaultBumps\" } }, { \"name\": \"totalAmount\", \"docs\": [ \"The total liquidity of the vault, including remaining tokens in token_vault and the liquidity in all strategies.\" ], \"type\": \"u64\" }, { \"name\": \"tokenVault\", \"docs\": [ \"Token account, hold liquidity in vault reserve\" ], \"type\": \"publicKey\" }, { \"name\": \"feeVault\", \"docs\": [ \"Hold lp token of vault, each time rebalance crank is called, vault calculate performance fee and mint corresponding lp token amount to fee_vault. fee_vault is owned by treasury address\" ], \"type\": \"publicKey\" }, { \"name\": \"tokenMint\", \"docs\": [ \"Token mint that vault supports\" ], \"type\": \"publicKey\" }, { \"name\": \"lpMint\", \"docs\": [ \"Lp mint of vault\" ], \"type\": \"publicKey\" }, { \"name\": \"strategies\", \"docs\": [ \"The list of strategy addresses that vault supports, vault can support up to MAX_STRATEGY strategies at the same time.\" ], \"type\": { \"array\": [ \"publicKey\", 30 ] } }, { \"name\": \"base\", \"docs\": [ \"The base address to create vault seeds\" ], \"type\": \"publicKey\" }, { \"name\": \"admin\", \"docs\": [ \"Admin of vault\" ], \"type\": \"publicKey\" }, { \"name\": \"operator\", \"docs\": [ \"Person who can send the crank. Operator can only send liquidity to strategies that admin defined, and claim reward to account of treasury address\" ], \"type\": \"publicKey\" }, { \"name\": \"lockedProfitTracker\", \"docs\": [ \"Stores information for locked profit.\" ], \"type\": { \"defined\": \"LockedProfitTracker\" } } ] } }, { \"name\": \"Strategy\", \"docs\": [ \"Strategy struct\" ], \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"reserve\", \"docs\": [ \"Lending pool address, that the strategy will deposit/withdraw balance\" ], \"type\": \"publicKey\" }, { \"name\": \"collateralVault\", \"docs\": [ \"The token account, that holds the collateral token\" ], \"type\": \"publicKey\" }, { \"name\": \"strategyType\", \"docs\": [ \"Specify type of strategy\" ], \"type\": { \"defined\": \"StrategyType\" } }, { \"name\": \"currentLiquidity\", \"docs\": [ \"The liquidity in strategy at the time vault deposit/withdraw from a lending protocol\" ], \"type\": \"u64\" }, { \"name\": \"bumps\", \"docs\": [ \"Hold some bumps, in case the strategy needs to use other seeds to sign a CPI call.\" ], \"type\": { \"array\": [ \"u8\", 10 ] } }, { \"name\": \"vault\", \"docs\": [ \"Vault address, that the strategy belongs\" ], \"type\": \"publicKey\" }, { \"name\": \"isDisable\", \"docs\": [ \"If we remove strategy by remove_strategy2 endpoint, this account will be never added again\" ], \"type\": \"u8\" } ] } } ], \"types\": [ { \"name\": \"VaultBumps\", \"docs\": [ \"Vault bumps struct\" ], \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"vaultBump\", \"docs\": [ \"vault_bump\" ], \"type\": \"u8\" }, { \"name\": \"tokenVaultBump\", \"docs\": [ \"token_vault_bump\" ], \"type\": \"u8\" } ] } }, { \"name\": \"StrategyBumps\", \"docs\": [ \"Strategy bumps struct\" ], \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"strategyIndex\", \"docs\": [ \"strategy_index\" ], \"type\": \"u8\" }, { \"name\": \"otherBumps\", \"docs\": [ \"Bumps of PDAs for the integrated protocol.\" ], \"type\": { \"array\": [ \"u8\", 10 ] } } ] } }, { \"name\": \"LockedProfitTracker\", \"docs\": [ \"LockedProfitTracker struct\" ], \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"lastUpdatedLockedProfit\", \"docs\": [ \"The total locked profit from the last report\" ], \"type\": \"u64\" }, { \"name\": \"lastReport\", \"docs\": [ \"The last timestamp (in seconds) rebalancing\" ], \"type\": \"u64\" }, { \"name\": \"lockedProfitDegradation\", \"docs\": [ \"Rate per second of degradation\" ], \"type\": \"u64\" } ] } }, { \"name\": \"StrategyType\", \"docs\": [ \"StrategyType struct\" ], \"type\": { \"kind\": \"enum\", \"variants\": [ { \"name\": \"PortFinanceWithoutLM\" }, { \"name\": \"PortFinanceWithLM\" }, { \"name\": \"SolendWithoutLM\" }, { \"name\": \"Mango\" }, { \"name\": \"SolendWithLM\" }, { \"name\": \"ApricotWithoutLM\" }, { \"name\": \"Francium\" }, { \"name\": \"Tulip\" }, { \"name\": \"Vault\" }, { \"name\": \"Drift\" }, { \"name\": \"Frakt\" }, { \"name\": \"Marginfi\" } ] } } ], \"events\": [ { \"name\": \"AddLiquidity\", \"fields\": [ { \"name\": \"lpMintAmount\", \"type\": \"u64\", \"index\": false }, { \"name\": \"tokenAmount\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"RemoveLiquidity\", \"fields\": [ { \"name\": \"lpUnmintAmount\", \"type\": \"u64\", \"index\": false }, { \"name\": \"tokenAmount\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"StrategyDeposit\", \"fields\": [ { \"name\": \"strategyType\", \"type\": { \"defined\": \"StrategyType\" }, \"index\": false }, { \"name\": \"tokenAmount\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"StrategyWithdraw\", \"fields\": [ { \"name\": \"strategyType\", \"type\": { \"defined\": \"StrategyType\" }, \"index\": false }, { \"name\": \"collateralAmount\", \"type\": \"u64\", \"index\": false }, { \"name\": \"estimatedTokenAmount\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"ClaimReward\", \"fields\": [ { \"name\": \"strategyType\", \"type\": { \"defined\": \"StrategyType\" }, \"index\": false }, { \"name\": \"tokenAmount\", \"type\": \"u64\", \"index\": false }, { \"name\": \"mintAccount\", \"type\": \"publicKey\", \"index\": false } ] }, { \"name\": \"PerformanceFee\", \"fields\": [ { \"name\": \"lpMintMore\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"ReportLoss\", \"fields\": [ { \"name\": \"strategy\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"loss\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"TotalAmount\", \"fields\": [ { \"name\": \"totalAmount\", \"type\": \"u64\", \"index\": false } ] } ], \"errors\": [ { \"code\": 6000, \"name\": \"VaultIsDisabled\", \"msg\": \"Vault is disabled\" }, { \"code\": 6001, \"name\": \"ExceededSlippage\", \"msg\": \"Exceeded slippage tolerance\" }, { \"code\": 6002, \"name\": \"StrategyIsNotExisted\", \"msg\": \"Strategy is not existed\" }, { \"code\": 6003, \"name\": \"UnAuthorized\", \"msg\": \"UnAuthorized\" }, { \"code\": 6004, \"name\": \"MathOverflow\", \"msg\": \"Math operation overflow\" }, { \"code\": 6005, \"name\": \"ProtocolIsNotSupported\", \"msg\": \"Protocol is not supported\" }, { \"code\": 6006, \"name\": \"UnMatchReserve\", \"msg\": \"Reserve does not support token mint\" }, { \"code\": 6007, \"name\": \"InvalidLockedProfitDegradation\", \"msg\": \"lockedProfitDegradation is invalid\" }, { \"code\": 6008, \"name\": \"MaxStrategyReached\", \"msg\": \"Maximum number of strategies have been reached\" }, { \"code\": 6009, \"name\": \"StrategyExisted\", \"msg\": \"Strategy existed\" }, { \"code\": 6010, \"name\": \"InvalidUnmintAmount\", \"msg\": \"Invalid unmint amount\" }, { \"code\": 6011, \"name\": \"InvalidAccountsForStrategy\", \"msg\": \"Invalid accounts for strategy\" }, { \"code\": 6012, \"name\": \"InvalidBump\", \"msg\": \"Invalid bump\" }, { \"code\": 6013, \"name\": \"AmountMustGreaterThanZero\", \"msg\": \"Amount must be greater than 0\" }, { \"code\": 6014, \"name\": \"MangoIsNotSupportedAnymore\", \"msg\": \"Mango is not supported anymore\" }, { \"code\": 6015, \"name\": \"StrategyIsNotSupported\", \"msg\": \"Strategy is not supported\" }, { \"code\": 6016, \"name\": \"PayAmountIsExeeced\", \"msg\": \"Pay amount is exceeded\" }, { \"code\": 6017, \"name\": \"FeeVaultIsNotSet\", \"msg\": \"Fee vault is not set\" }, { \"code\": 6018, \"name\": \"LendingAssertionViolation\", \"msg\": \"deposit amount in lending is not matched\" }, { \"code\": 6019, \"name\": \"HaveMoneyInLending\", \"msg\": \"Cannot remove strategy becase we have some in lending\" } ] }" + } +} \ No newline at end of file diff --git a/sol-anchor/tests/integration/generators/orca.json b/sol-anchor/tests/integration/generators/orca.json new file mode 100644 index 0000000..fab9ae1 --- /dev/null +++ b/sol-anchor/tests/integration/generators/orca.json @@ -0,0 +1,9 @@ +{ + "generator": "sol-anchor-beta", + "state": { + "name": "my_project", + "chainName": "solana-mainnet", + "initialBlockSet": true, + "idlString": "{ \"version\": \"0.3.0\", \"name\": \"whirlpool\", \"metadata\": { \"address\": \"whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc\" }, \"instructions\": [ { \"name\": \"initializeConfig\", \"accounts\": [ { \"name\": \"config\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"feeAuthority\", \"type\": \"publicKey\" }, { \"name\": \"collectProtocolFeesAuthority\", \"type\": \"publicKey\" }, { \"name\": \"rewardEmissionsSuperAuthority\", \"type\": \"publicKey\" }, { \"name\": \"defaultProtocolFeeRate\", \"type\": \"u16\" } ] }, { \"name\": \"initializePool\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"feeTier\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"bumps\", \"type\": { \"defined\": \"WhirlpoolBumps\" } }, { \"name\": \"tickSpacing\", \"type\": \"u16\" }, { \"name\": \"initialSqrtPrice\", \"type\": \"u128\" } ] }, { \"name\": \"initializeTickArray\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"tickArray\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"startTickIndex\", \"type\": \"i32\" } ] }, { \"name\": \"initializeFeeTier\", \"accounts\": [ { \"name\": \"config\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"feeTier\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"tickSpacing\", \"type\": \"u16\" }, { \"name\": \"defaultFeeRate\", \"type\": \"u16\" } ] }, { \"name\": \"initializeReward\", \"accounts\": [ { \"name\": \"rewardAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardMint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rewardVault\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" } ] }, { \"name\": \"setRewardEmissions\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"rewardVault\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" }, { \"name\": \"emissionsPerSecondX64\", \"type\": \"u128\" } ] }, { \"name\": \"openPosition\", \"accounts\": [ { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"owner\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionMint\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"positionTokenAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"associatedTokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"bumps\", \"type\": { \"defined\": \"OpenPositionBumps\" } }, { \"name\": \"tickLowerIndex\", \"type\": \"i32\" }, { \"name\": \"tickUpperIndex\", \"type\": \"i32\" } ] }, { \"name\": \"openPositionWithMetadata\", \"accounts\": [ { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"owner\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionMint\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"positionMetadataAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"associatedTokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"metadataProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"metadataUpdateAuth\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"bumps\", \"type\": { \"defined\": \"OpenPositionWithMetadataBumps\" } }, { \"name\": \"tickLowerIndex\", \"type\": \"i32\" }, { \"name\": \"tickUpperIndex\", \"type\": \"i32\" } ] }, { \"name\": \"increaseLiquidity\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayLower\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayUpper\", \"isMut\": true, \"isSigner\": false } ], \"args\": [ { \"name\": \"liquidityAmount\", \"type\": \"u128\" }, { \"name\": \"tokenMaxA\", \"type\": \"u64\" }, { \"name\": \"tokenMaxB\", \"type\": \"u64\" } ] }, { \"name\": \"decreaseLiquidity\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayLower\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayUpper\", \"isMut\": true, \"isSigner\": false } ], \"args\": [ { \"name\": \"liquidityAmount\", \"type\": \"u128\" }, { \"name\": \"tokenMinA\", \"type\": \"u64\" }, { \"name\": \"tokenMinB\", \"type\": \"u64\" } ] }, { \"name\": \"updateFeesAndRewards\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayLower\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tickArrayUpper\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"collectFees\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"collectReward\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rewardOwnerAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardVault\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" } ] }, { \"name\": \"collectProtocolFees\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"collectProtocolFeesAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenDestinationA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenDestinationB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"swap\", \"accounts\": [ { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArray0\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArray1\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArray2\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"oracle\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" }, { \"name\": \"otherAmountThreshold\", \"type\": \"u64\" }, { \"name\": \"sqrtPriceLimit\", \"type\": \"u128\" }, { \"name\": \"amountSpecifiedIsInput\", \"type\": \"bool\" }, { \"name\": \"aToB\", \"type\": \"bool\" } ] }, { \"name\": \"closePosition\", \"accounts\": [ { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"receiver\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionMint\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"setDefaultFeeRate\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"feeTier\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true } ], \"args\": [ { \"name\": \"defaultFeeRate\", \"type\": \"u16\" } ] }, { \"name\": \"setDefaultProtocolFeeRate\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true } ], \"args\": [ { \"name\": \"defaultProtocolFeeRate\", \"type\": \"u16\" } ] }, { \"name\": \"setFeeRate\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true } ], \"args\": [ { \"name\": \"feeRate\", \"type\": \"u16\" } ] }, { \"name\": \"setProtocolFeeRate\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true } ], \"args\": [ { \"name\": \"protocolFeeRate\", \"type\": \"u16\" } ] }, { \"name\": \"setFeeAuthority\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newFeeAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"setCollectProtocolFeesAuthority\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"collectProtocolFeesAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newCollectProtocolFeesAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"setRewardAuthority\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newRewardAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" } ] }, { \"name\": \"setRewardAuthorityBySuperAuthority\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardEmissionsSuperAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newRewardAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" } ] }, { \"name\": \"setRewardEmissionsSuperAuthority\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardEmissionsSuperAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newRewardEmissionsSuperAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"twoHopSwap\", \"accounts\": [ { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"whirlpoolOne\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"whirlpoolTwo\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountOneA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultOneA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountOneB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultOneB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountTwoA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultTwoA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountTwoB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultTwoB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayOne0\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayOne1\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayOne2\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayTwo0\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayTwo1\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayTwo2\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"oracleOne\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"oracleTwo\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" }, { \"name\": \"otherAmountThreshold\", \"type\": \"u64\" }, { \"name\": \"amountSpecifiedIsInput\", \"type\": \"bool\" }, { \"name\": \"aToBOne\", \"type\": \"bool\" }, { \"name\": \"aToBTwo\", \"type\": \"bool\" }, { \"name\": \"sqrtPriceLimitOne\", \"type\": \"u128\" }, { \"name\": \"sqrtPriceLimitTwo\", \"type\": \"u128\" } ] }, { \"name\": \"initializePositionBundle\", \"accounts\": [ { \"name\": \"positionBundle\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleMint\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"positionBundleTokenAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleOwner\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"associatedTokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"initializePositionBundleWithMetadata\", \"accounts\": [ { \"name\": \"positionBundle\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleMint\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"positionBundleMetadata\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleTokenAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleOwner\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"metadataUpdateAuth\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"associatedTokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"metadataProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"deletePositionBundle\", \"accounts\": [ { \"name\": \"positionBundle\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleMint\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleTokenAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleOwner\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"receiver\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"openBundledPosition\", \"accounts\": [ { \"name\": \"bundledPosition\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundle\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionBundleAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"bundleIndex\", \"type\": \"u16\" }, { \"name\": \"tickLowerIndex\", \"type\": \"i32\" }, { \"name\": \"tickUpperIndex\", \"type\": \"i32\" } ] }, { \"name\": \"closeBundledPosition\", \"accounts\": [ { \"name\": \"bundledPosition\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundle\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionBundleTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionBundleAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"receiver\", \"isMut\": true, \"isSigner\": false } ], \"args\": [ { \"name\": \"bundleIndex\", \"type\": \"u16\" } ] }, { \"name\": \"collectFeesV2\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgramA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"collectProtocolFeesV2\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"collectProtocolFeesAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenDestinationA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenDestinationB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgramA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"collectRewardV2\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rewardOwnerAccount\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardMint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rewardVault\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardTokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" }, { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"decreaseLiquidityV2\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgramA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayLower\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayUpper\", \"isMut\": true, \"isSigner\": false } ], \"args\": [ { \"name\": \"liquidityAmount\", \"type\": \"u128\" }, { \"name\": \"tokenMinA\", \"type\": \"u64\" }, { \"name\": \"tokenMinB\", \"type\": \"u64\" }, { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"increaseLiquidityV2\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenProgramA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"positionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"position\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"positionTokenAccount\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayLower\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayUpper\", \"isMut\": true, \"isSigner\": false } ], \"args\": [ { \"name\": \"liquidityAmount\", \"type\": \"u128\" }, { \"name\": \"tokenMaxA\", \"type\": \"u64\" }, { \"name\": \"tokenMaxB\", \"type\": \"u64\" }, { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"initializePoolV2\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenBadgeA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenBadgeB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"feeTier\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"tickSpacing\", \"type\": \"u16\" }, { \"name\": \"initialSqrtPrice\", \"type\": \"u128\" } ] }, { \"name\": \"initializeRewardV2\", \"accounts\": [ { \"name\": \"rewardAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardMint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rewardTokenBadge\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rewardVault\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"rewardTokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" } ] }, { \"name\": \"setRewardEmissionsV2\", \"accounts\": [ { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"rewardAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"rewardVault\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"rewardIndex\", \"type\": \"u8\" }, { \"name\": \"emissionsPerSecondX64\", \"type\": \"u128\" } ] }, { \"name\": \"swapV2\", \"accounts\": [ { \"name\": \"tokenProgramA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"whirlpool\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenMintA\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintB\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultA\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultB\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArray0\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArray1\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArray2\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"oracle\", \"isMut\": true, \"isSigner\": false } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" }, { \"name\": \"otherAmountThreshold\", \"type\": \"u64\" }, { \"name\": \"sqrtPriceLimit\", \"type\": \"u128\" }, { \"name\": \"amountSpecifiedIsInput\", \"type\": \"bool\" }, { \"name\": \"aToB\", \"type\": \"bool\" }, { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"twoHopSwapV2\", \"accounts\": [ { \"name\": \"whirlpoolOne\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"whirlpoolTwo\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenMintInput\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintIntermediate\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenMintOutput\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramInput\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramIntermediate\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgramOutput\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountInput\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultOneInput\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultOneIntermediate\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultTwoIntermediate\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenVaultTwoOutput\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenOwnerAccountOutput\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tokenAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"tickArrayOne0\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayOne1\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayOne2\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayTwo0\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayTwo1\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"tickArrayTwo2\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"oracleOne\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"oracleTwo\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"memoProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" }, { \"name\": \"otherAmountThreshold\", \"type\": \"u64\" }, { \"name\": \"amountSpecifiedIsInput\", \"type\": \"bool\" }, { \"name\": \"aToBOne\", \"type\": \"bool\" }, { \"name\": \"aToBTwo\", \"type\": \"bool\" }, { \"name\": \"sqrtPriceLimitOne\", \"type\": \"u128\" }, { \"name\": \"sqrtPriceLimitTwo\", \"type\": \"u128\" }, { \"name\": \"remainingAccountsInfo\", \"type\": { \"option\": { \"defined\": \"RemainingAccountsInfo\" } } } ] }, { \"name\": \"initializeConfigExtension\", \"accounts\": [ { \"name\": \"config\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"configExtension\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"feeAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"setConfigExtensionAuthority\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpoolsConfigExtension\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"configExtensionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newConfigExtensionAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"setTokenBadgeAuthority\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpoolsConfigExtension\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"configExtensionAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"newTokenBadgeAuthority\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"initializeTokenBadge\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpoolsConfigExtension\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenBadgeAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"tokenMint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenBadge\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"funder\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"deleteTokenBadge\", \"accounts\": [ { \"name\": \"whirlpoolsConfig\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"whirlpoolsConfigExtension\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenBadgeAuthority\", \"isMut\": false, \"isSigner\": true }, { \"name\": \"tokenMint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenBadge\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"receiver\", \"isMut\": true, \"isSigner\": false } ], \"args\": [] } ], \"accounts\": [ { \"name\": \"WhirlpoolsConfigExtension\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"whirlpoolsConfig\", \"type\": \"publicKey\" }, { \"name\": \"configExtensionAuthority\", \"type\": \"publicKey\" }, { \"name\": \"tokenBadgeAuthority\", \"type\": \"publicKey\" } ] } }, { \"name\": \"WhirlpoolsConfig\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"feeAuthority\", \"type\": \"publicKey\" }, { \"name\": \"collectProtocolFeesAuthority\", \"type\": \"publicKey\" }, { \"name\": \"rewardEmissionsSuperAuthority\", \"type\": \"publicKey\" }, { \"name\": \"defaultProtocolFeeRate\", \"type\": \"u16\" } ] } }, { \"name\": \"FeeTier\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"whirlpoolsConfig\", \"type\": \"publicKey\" }, { \"name\": \"tickSpacing\", \"type\": \"u16\" }, { \"name\": \"defaultFeeRate\", \"type\": \"u16\" } ] } }, { \"name\": \"PositionBundle\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"positionBundleMint\", \"type\": \"publicKey\" }, { \"name\": \"positionBitmap\", \"type\": { \"array\": [ \"u8\", 32 ] } } ] } }, { \"name\": \"Position\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"whirlpool\", \"type\": \"publicKey\" }, { \"name\": \"positionMint\", \"type\": \"publicKey\" }, { \"name\": \"liquidity\", \"type\": \"u128\" }, { \"name\": \"tickLowerIndex\", \"type\": \"i32\" }, { \"name\": \"tickUpperIndex\", \"type\": \"i32\" }, { \"name\": \"feeGrowthCheckpointA\", \"type\": \"u128\" }, { \"name\": \"feeOwedA\", \"type\": \"u64\" }, { \"name\": \"feeGrowthCheckpointB\", \"type\": \"u128\" }, { \"name\": \"feeOwedB\", \"type\": \"u64\" }, { \"name\": \"rewardInfos\", \"type\": { \"array\": [ { \"defined\": \"PositionRewardInfo\" }, 3 ] } } ] } }, { \"name\": \"TickArray\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"startTickIndex\", \"type\": \"i32\" }, { \"name\": \"ticks\", \"type\": { \"array\": [ { \"defined\": \"Tick\" }, 88 ] } }, { \"name\": \"whirlpool\", \"type\": \"publicKey\" } ] } }, { \"name\": \"TokenBadge\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"whirlpoolsConfig\", \"type\": \"publicKey\" }, { \"name\": \"tokenMint\", \"type\": \"publicKey\" } ] } }, { \"name\": \"Whirlpool\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"whirlpoolsConfig\", \"type\": \"publicKey\" }, { \"name\": \"whirlpoolBump\", \"type\": { \"array\": [ \"u8\", 1 ] } }, { \"name\": \"tickSpacing\", \"type\": \"u16\" }, { \"name\": \"tickSpacingSeed\", \"type\": { \"array\": [ \"u8\", 2 ] } }, { \"name\": \"feeRate\", \"type\": \"u16\" }, { \"name\": \"protocolFeeRate\", \"type\": \"u16\" }, { \"name\": \"liquidity\", \"type\": \"u128\" }, { \"name\": \"sqrtPrice\", \"type\": \"u128\" }, { \"name\": \"tickCurrentIndex\", \"type\": \"i32\" }, { \"name\": \"protocolFeeOwedA\", \"type\": \"u64\" }, { \"name\": \"protocolFeeOwedB\", \"type\": \"u64\" }, { \"name\": \"tokenMintA\", \"type\": \"publicKey\" }, { \"name\": \"tokenVaultA\", \"type\": \"publicKey\" }, { \"name\": \"feeGrowthGlobalA\", \"type\": \"u128\" }, { \"name\": \"tokenMintB\", \"type\": \"publicKey\" }, { \"name\": \"tokenVaultB\", \"type\": \"publicKey\" }, { \"name\": \"feeGrowthGlobalB\", \"type\": \"u128\" }, { \"name\": \"rewardLastUpdatedTimestamp\", \"type\": \"u64\" }, { \"name\": \"rewardInfos\", \"type\": { \"array\": [ { \"defined\": \"WhirlpoolRewardInfo\" }, 3 ] } } ] } } ], \"types\": [ { \"name\": \"OpenPositionBumps\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"positionBump\", \"type\": \"u8\" } ] } }, { \"name\": \"OpenPositionWithMetadataBumps\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"positionBump\", \"type\": \"u8\" }, { \"name\": \"metadataBump\", \"type\": \"u8\" } ] } }, { \"name\": \"PositionRewardInfo\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"growthInsideCheckpoint\", \"type\": \"u128\" }, { \"name\": \"amountOwed\", \"type\": \"u64\" } ] } }, { \"name\": \"Tick\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"initialized\", \"type\": \"bool\" }, { \"name\": \"liquidityNet\", \"type\": \"i128\" }, { \"name\": \"liquidityGross\", \"type\": \"u128\" }, { \"name\": \"feeGrowthOutsideA\", \"type\": \"u128\" }, { \"name\": \"feeGrowthOutsideB\", \"type\": \"u128\" }, { \"name\": \"rewardGrowthsOutside\", \"type\": { \"array\": [ \"u128\", 3 ] } } ] } }, { \"name\": \"WhirlpoolRewardInfo\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"mint\", \"type\": \"publicKey\" }, { \"name\": \"vault\", \"type\": \"publicKey\" }, { \"name\": \"authority\", \"type\": \"publicKey\" }, { \"name\": \"emissionsPerSecondX64\", \"type\": \"u128\" }, { \"name\": \"growthGlobalX64\", \"type\": \"u128\" } ] } }, { \"name\": \"WhirlpoolBumps\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"whirlpoolBump\", \"type\": \"u8\" } ] } }, { \"name\": \"RemainingAccountsSlice\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"accountsType\", \"type\": { \"defined\": \"AccountsType\" } }, { \"name\": \"length\", \"type\": \"u8\" } ] } }, { \"name\": \"RemainingAccountsInfo\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"slices\", \"type\": { \"vec\": { \"defined\": \"RemainingAccountsSlice\" } } } ] } }, { \"name\": \"CurrIndex\", \"type\": { \"kind\": \"enum\", \"variants\": [ { \"name\": \"Below\" }, { \"name\": \"Inside\" }, { \"name\": \"Above\" } ] } }, { \"name\": \"TickLabel\", \"type\": { \"kind\": \"enum\", \"variants\": [ { \"name\": \"Upper\" }, { \"name\": \"Lower\" } ] } }, { \"name\": \"Direction\", \"type\": { \"kind\": \"enum\", \"variants\": [ { \"name\": \"Left\" }, { \"name\": \"Right\" } ] } }, { \"name\": \"AccountsType\", \"type\": { \"kind\": \"enum\", \"variants\": [ { \"name\": \"TransferHookA\" }, { \"name\": \"TransferHookB\" }, { \"name\": \"TransferHookReward\" }, { \"name\": \"TransferHookInput\" }, { \"name\": \"TransferHookIntermediate\" }, { \"name\": \"TransferHookOutput\" }, { \"name\": \"SupplementalTickArrays\" }, { \"name\": \"SupplementalTickArraysOne\" }, { \"name\": \"SupplementalTickArraysTwo\" } ] } } ], \"errors\": [ { \"code\": 6000, \"name\": \"InvalidEnum\", \"msg\": \"Enum value could not be converted\" }, { \"code\": 6001, \"name\": \"InvalidStartTick\", \"msg\": \"Invalid start tick index provided.\" }, { \"code\": 6002, \"name\": \"TickArrayExistInPool\", \"msg\": \"Tick-array already exists in this whirlpool\" }, { \"code\": 6003, \"name\": \"TickArrayIndexOutofBounds\", \"msg\": \"Attempt to search for a tick-array failed\" }, { \"code\": 6004, \"name\": \"InvalidTickSpacing\", \"msg\": \"Tick-spacing is not supported\" }, { \"code\": 6005, \"name\": \"ClosePositionNotEmpty\", \"msg\": \"Position is not empty It cannot be closed\" }, { \"code\": 6006, \"name\": \"DivideByZero\", \"msg\": \"Unable to divide by zero\" }, { \"code\": 6007, \"name\": \"NumberCastError\", \"msg\": \"Unable to cast number into BigInt\" }, { \"code\": 6008, \"name\": \"NumberDownCastError\", \"msg\": \"Unable to down cast number\" }, { \"code\": 6009, \"name\": \"TickNotFound\", \"msg\": \"Tick not found within tick array\" }, { \"code\": 6010, \"name\": \"InvalidTickIndex\", \"msg\": \"Provided tick index is either out of bounds or uninitializable\" }, { \"code\": 6011, \"name\": \"SqrtPriceOutOfBounds\", \"msg\": \"Provided sqrt price out of bounds\" }, { \"code\": 6012, \"name\": \"LiquidityZero\", \"msg\": \"Liquidity amount must be greater than zero\" }, { \"code\": 6013, \"name\": \"LiquidityTooHigh\", \"msg\": \"Liquidity amount must be less than i64::MAX\" }, { \"code\": 6014, \"name\": \"LiquidityOverflow\", \"msg\": \"Liquidity overflow\" }, { \"code\": 6015, \"name\": \"LiquidityUnderflow\", \"msg\": \"Liquidity underflow\" }, { \"code\": 6016, \"name\": \"LiquidityNetError\", \"msg\": \"Tick liquidity net underflowed or overflowed\" }, { \"code\": 6017, \"name\": \"TokenMaxExceeded\", \"msg\": \"Exceeded token max\" }, { \"code\": 6018, \"name\": \"TokenMinSubceeded\", \"msg\": \"Did not meet token min\" }, { \"code\": 6019, \"name\": \"MissingOrInvalidDelegate\", \"msg\": \"Position token account has a missing or invalid delegate\" }, { \"code\": 6020, \"name\": \"InvalidPositionTokenAmount\", \"msg\": \"Position token amount must be 1\" }, { \"code\": 6021, \"name\": \"InvalidTimestampConversion\", \"msg\": \"Timestamp should be convertible from i64 to u64\" }, { \"code\": 6022, \"name\": \"InvalidTimestamp\", \"msg\": \"Timestamp should be greater than the last updated timestamp\" }, { \"code\": 6023, \"name\": \"InvalidTickArraySequence\", \"msg\": \"Invalid tick array sequence provided for instruction.\" }, { \"code\": 6024, \"name\": \"InvalidTokenMintOrder\", \"msg\": \"Token Mint in wrong order\" }, { \"code\": 6025, \"name\": \"RewardNotInitialized\", \"msg\": \"Reward not initialized\" }, { \"code\": 6026, \"name\": \"InvalidRewardIndex\", \"msg\": \"Invalid reward index\" }, { \"code\": 6027, \"name\": \"RewardVaultAmountInsufficient\", \"msg\": \"Reward vault requires amount to support emissions for at least one day\" }, { \"code\": 6028, \"name\": \"FeeRateMaxExceeded\", \"msg\": \"Exceeded max fee rate\" }, { \"code\": 6029, \"name\": \"ProtocolFeeRateMaxExceeded\", \"msg\": \"Exceeded max protocol fee rate\" }, { \"code\": 6030, \"name\": \"MultiplicationShiftRightOverflow\", \"msg\": \"Multiplication with shift right overflow\" }, { \"code\": 6031, \"name\": \"MulDivOverflow\", \"msg\": \"Muldiv overflow\" }, { \"code\": 6032, \"name\": \"MulDivInvalidInput\", \"msg\": \"Invalid div_u256 input\" }, { \"code\": 6033, \"name\": \"MultiplicationOverflow\", \"msg\": \"Multiplication overflow\" }, { \"code\": 6034, \"name\": \"InvalidSqrtPriceLimitDirection\", \"msg\": \"Provided SqrtPriceLimit not in the same direction as the swap.\" }, { \"code\": 6035, \"name\": \"ZeroTradableAmount\", \"msg\": \"There are no tradable amount to swap.\" }, { \"code\": 6036, \"name\": \"AmountOutBelowMinimum\", \"msg\": \"Amount out below minimum threshold\" }, { \"code\": 6037, \"name\": \"AmountInAboveMaximum\", \"msg\": \"Amount in above maximum threshold\" }, { \"code\": 6038, \"name\": \"TickArraySequenceInvalidIndex\", \"msg\": \"Invalid index for tick array sequence\" }, { \"code\": 6039, \"name\": \"AmountCalcOverflow\", \"msg\": \"Amount calculated overflows\" }, { \"code\": 6040, \"name\": \"AmountRemainingOverflow\", \"msg\": \"Amount remaining overflows\" }, { \"code\": 6041, \"name\": \"InvalidIntermediaryMint\", \"msg\": \"Invalid intermediary mint\" }, { \"code\": 6042, \"name\": \"DuplicateTwoHopPool\", \"msg\": \"Duplicate two hop pool\" }, { \"code\": 6043, \"name\": \"InvalidBundleIndex\", \"msg\": \"Bundle index is out of bounds\" }, { \"code\": 6044, \"name\": \"BundledPositionAlreadyOpened\", \"msg\": \"Position has already been opened\" }, { \"code\": 6045, \"name\": \"BundledPositionAlreadyClosed\", \"msg\": \"Position has already been closed\" }, { \"code\": 6046, \"name\": \"PositionBundleNotDeletable\", \"msg\": \"Unable to delete PositionBundle with open positions\" }, { \"code\": 6047, \"name\": \"UnsupportedTokenMint\", \"msg\": \"Token mint has unsupported attributes\" }, { \"code\": 6048, \"name\": \"RemainingAccountsInvalidSlice\", \"msg\": \"Invalid remaining accounts\" }, { \"code\": 6049, \"name\": \"RemainingAccountsInsufficient\", \"msg\": \"Insufficient remaining accounts\" }, { \"code\": 6050, \"name\": \"NoExtraAccountsForTransferHook\", \"msg\": \"Unable to call transfer hook without extra accounts\" }, { \"code\": 6051, \"name\": \"IntermediateTokenAmountMismatch\", \"msg\": \"Output and input amount mismatch\" }, { \"code\": 6052, \"name\": \"TransferFeeCalculationError\", \"msg\": \"Transfer fee calculation failed\" }, { \"code\": 6053, \"name\": \"RemainingAccountsDuplicatedAccountsType\", \"msg\": \"Same accounts type is provided more than once\" }, { \"code\": 6054, \"name\": \"TooManySupplementalTickArrays\", \"msg\": \"Too many supplemental tick arrays provided\" }, { \"code\": 6055, \"name\": \"DifferentWhirlpoolTickArrayAccount\", \"msg\": \"TickArray account for different whirlpool provided\" } ] }" + } +} \ No newline at end of file diff --git a/sol-anchor/tests/integration/generators/pump-fun.json b/sol-anchor/tests/integration/generators/pump-fun.json new file mode 100644 index 0000000..524fa73 --- /dev/null +++ b/sol-anchor/tests/integration/generators/pump-fun.json @@ -0,0 +1,9 @@ +{ + "generator": "sol-anchor-beta", + "state": { + "name": "my_project", + "chainName": "solana-mainnet", + "initialBlockSet": true, + "idlString": "{ \"version\": \"0.1.0\", \"name\": \"pump\", \"metadata\": { \"address\": \"6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P\" }, \"instructions\": [ { \"name\": \"initialize\", \"docs\": [ \"Creates the global state.\" ], \"accounts\": [ { \"name\": \"global\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"user\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] }, { \"name\": \"setParams\", \"docs\": [ \"Sets the global state parameters.\" ], \"accounts\": [ { \"name\": \"global\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"user\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"eventAuthority\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"program\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"feeRecipient\", \"type\": \"publicKey\" }, { \"name\": \"initialVirtualTokenReserves\", \"type\": \"u64\" }, { \"name\": \"initialVirtualSolReserves\", \"type\": \"u64\" }, { \"name\": \"initialRealTokenReserves\", \"type\": \"u64\" }, { \"name\": \"tokenTotalSupply\", \"type\": \"u64\" }, { \"name\": \"feeBasisPoints\", \"type\": \"u64\" } ] }, { \"name\": \"create\", \"docs\": [ \"Creates a new coin and bonding curve.\" ], \"accounts\": [ { \"name\": \"mint\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"mintAuthority\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"bondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedBondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"global\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"mplTokenMetadata\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"metadata\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"user\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"associatedTokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"eventAuthority\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"program\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"name\", \"type\": \"string\" }, { \"name\": \"symbol\", \"type\": \"string\" }, { \"name\": \"uri\", \"type\": \"string\" } ] }, { \"name\": \"buy\", \"docs\": [ \"Buys tokens from a bonding curve.\" ], \"accounts\": [ { \"name\": \"global\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"feeRecipient\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"mint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"bondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedBondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedUser\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"user\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"eventAuthority\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"program\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" }, { \"name\": \"maxSolCost\", \"type\": \"u64\" } ] }, { \"name\": \"sell\", \"docs\": [ \"Sells tokens into a bonding curve.\" ], \"accounts\": [ { \"name\": \"global\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"feeRecipient\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"mint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"bondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedBondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedUser\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"user\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"associatedTokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"eventAuthority\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"program\", \"isMut\": false, \"isSigner\": false } ], \"args\": [ { \"name\": \"amount\", \"type\": \"u64\" }, { \"name\": \"minSolOutput\", \"type\": \"u64\" } ] }, { \"name\": \"withdraw\", \"docs\": [ \"Allows the admin to withdraw liquidity for a migration once the bonding curve completes\" ], \"accounts\": [ { \"name\": \"global\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"lastWithdraw\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"mint\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"bondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedBondingCurve\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"associatedUser\", \"isMut\": true, \"isSigner\": false }, { \"name\": \"user\", \"isMut\": true, \"isSigner\": true }, { \"name\": \"systemProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"tokenProgram\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"rent\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"eventAuthority\", \"isMut\": false, \"isSigner\": false }, { \"name\": \"program\", \"isMut\": false, \"isSigner\": false } ], \"args\": [] } ], \"accounts\": [ { \"name\": \"Global\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"initialized\", \"type\": \"bool\" }, { \"name\": \"authority\", \"type\": \"publicKey\" }, { \"name\": \"feeRecipient\", \"type\": \"publicKey\" }, { \"name\": \"initialVirtualTokenReserves\", \"type\": \"u64\" }, { \"name\": \"initialVirtualSolReserves\", \"type\": \"u64\" }, { \"name\": \"initialRealTokenReserves\", \"type\": \"u64\" }, { \"name\": \"tokenTotalSupply\", \"type\": \"u64\" }, { \"name\": \"feeBasisPoints\", \"type\": \"u64\" } ] } }, { \"name\": \"LastWithdraw\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"lastWithdrawTimestamp\", \"type\": \"i64\" } ] } }, { \"name\": \"BondingCurve\", \"type\": { \"kind\": \"struct\", \"fields\": [ { \"name\": \"virtualTokenReserves\", \"type\": \"u64\" }, { \"name\": \"virtualSolReserves\", \"type\": \"u64\" }, { \"name\": \"realTokenReserves\", \"type\": \"u64\" }, { \"name\": \"realSolReserves\", \"type\": \"u64\" }, { \"name\": \"tokenTotalSupply\", \"type\": \"u64\" }, { \"name\": \"complete\", \"type\": \"bool\" } ] } } ], \"events\": [ { \"name\": \"CreateEvent\", \"fields\": [ { \"name\": \"name\", \"type\": \"string\", \"index\": false }, { \"name\": \"symbol\", \"type\": \"string\", \"index\": false }, { \"name\": \"uri\", \"type\": \"string\", \"index\": false }, { \"name\": \"mint\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"bondingCurve\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"user\", \"type\": \"publicKey\", \"index\": false } ] }, { \"name\": \"TradeEvent\", \"fields\": [ { \"name\": \"mint\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"solAmount\", \"type\": \"u64\", \"index\": false }, { \"name\": \"tokenAmount\", \"type\": \"u64\", \"index\": false }, { \"name\": \"isBuy\", \"type\": \"bool\", \"index\": false }, { \"name\": \"user\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"timestamp\", \"type\": \"i64\", \"index\": false }, { \"name\": \"virtualSolReserves\", \"type\": \"u64\", \"index\": false }, { \"name\": \"virtualTokenReserves\", \"type\": \"u64\", \"index\": false }, { \"name\": \"realSolReserves\", \"type\": \"u64\", \"index\": false }, { \"name\": \"realTokenReserves\", \"type\": \"u64\", \"index\": false } ] }, { \"name\": \"CompleteEvent\", \"fields\": [ { \"name\": \"user\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"mint\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"bondingCurve\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"timestamp\", \"type\": \"i64\", \"index\": false } ] }, { \"name\": \"SetParamsEvent\", \"fields\": [ { \"name\": \"feeRecipient\", \"type\": \"publicKey\", \"index\": false }, { \"name\": \"initialVirtualTokenReserves\", \"type\": \"u64\", \"index\": false }, { \"name\": \"initialVirtualSolReserves\", \"type\": \"u64\", \"index\": false }, { \"name\": \"initialRealTokenReserves\", \"type\": \"u64\", \"index\": false }, { \"name\": \"tokenTotalSupply\", \"type\": \"u64\", \"index\": false }, { \"name\": \"feeBasisPoints\", \"type\": \"u64\", \"index\": false } ] } ], \"errors\": [ { \"code\": 6000, \"name\": \"NotAuthorized\", \"msg\": \"The given account is not authorized to execute this instruction.\" }, { \"code\": 6001, \"name\": \"AlreadyInitialized\", \"msg\": \"The program is already initialized.\" }, { \"code\": 6002, \"name\": \"TooMuchSolRequired\", \"msg\": \"slippage: Too much SOL required to buy the given amount of tokens.\" }, { \"code\": 6003, \"name\": \"TooLittleSolReceived\", \"msg\": \"slippage: Too little SOL received to sell the given amount of tokens.\" }, { \"code\": 6004, \"name\": \"MintDoesNotMatchBondingCurve\", \"msg\": \"The mint does not match the bonding curve.\" }, { \"code\": 6005, \"name\": \"BondingCurveComplete\", \"msg\": \"The bonding curve has completed and liquidity migrated to raydium.\" }, { \"code\": 6006, \"name\": \"BondingCurveNotComplete\", \"msg\": \"The bonding curve has not completed.\" }, { \"code\": 6007, \"name\": \"NotInitialized\", \"msg\": \"The program is not initialized.\" }, { \"code\": 6008, \"name\": \"WithdrawTooFrequent\", \"msg\": \"Withdraw too frequent\" } ] }" + } +} \ No newline at end of file diff --git a/sol-anchor/tests/integration/integration_test.go b/sol-anchor/tests/integration/integration_test.go new file mode 100644 index 0000000..9de1054 --- /dev/null +++ b/sol-anchor/tests/integration/integration_test.go @@ -0,0 +1,77 @@ +package solanchor + +import ( + "fmt" + "os" + "os/exec" + "testing" +) + +func TestIntegrationPumpFun(t *testing.T) { + err := runTest("pump-fun") + if err != nil { + t.Fail() + } +} + +func TestIntegrationMeteora(t *testing.T) { + err := runTest("meteora") + if err != nil { + t.Fail() + } +} + +func TestIntegrationOrca(t *testing.T) { + err := runTest("orca") + if err != nil { + t.Fail() + } +} + +func runTest(generatorName string) error { + tempDir, err := os.MkdirTemp("", "temp") + if err != nil { + fmt.Printf("Error creating temporary directory: %v\n", err) + return err + } + fmt.Printf("Temporary directory created: %s\n", tempDir) + + defer os.RemoveAll(tempDir) + + // Move generator to temp directory + cpCmd := exec.Command("cp", fmt.Sprintf("generators/%s.json", generatorName), fmt.Sprintf("%s/%s.json", tempDir, generatorName)) + output, err := cpCmd.CombinedOutput() + if err != nil { + fmt.Printf("Error moving files: %v\n", err) + return err + } + fmt.Printf("Output %s\n", output) + + // Set the command to execute + cmd := exec.Command("substreams", "init", "--state-file", fmt.Sprintf("%s.json", generatorName)) + cmd.Env = append(os.Environ(), "SUBSTREAMS_CODEGEN_ENDPOINT=https://localhost:9000") + cmd.Dir = tempDir + + // Run the command and capture the output + output, err = cmd.CombinedOutput() + if err != nil { + fmt.Printf("Error running command: %v\n", err) + return err + } + + fmt.Printf("Command output:\n%s\n", output) + + // Execute build + cmd1 := exec.Command("substreams", "build") + cmd.Dir = tempDir + + output1, err := cmd1.CombinedOutput() + if err != nil { + fmt.Printf("Error running command: %v\n", err) + return err + } + + fmt.Printf("Command output:\n%s\n", output1) + + return nil +}