Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error selecting sol-anchor-beta when running substreams init #581

Open
itslesther opened this issue Feb 11, 2025 · 4 comments
Open

Error selecting sol-anchor-beta when running substreams init #581

itslesther opened this issue Feb 11, 2025 · 4 comments
Assignees

Comments

@itslesther
Copy link

Selecting sol-anchor-beta is throwing for my contract:

Error: connection error: unknown: conversation error: embed render entry template "proto/program.proto.gotmpl": template: proto/program.proto.gotmpl:45:8: executing "proto/program.proto.gotmpl" at <$.Idl.IsTypeUsed>: error calling IsTypeUsed: runtime error: invalid memory address or nil pointer dereference

I don't know what to do

@maoueh
Copy link
Contributor

maoueh commented Feb 12, 2025

Seems like a bug with the IDL generation, @enoldev

@enoldev
Copy link
Contributor

enoldev commented Feb 13, 2025

@itslesther, could you share the IDL you are using?

@itslesther
Copy link
Author

{
  "address": "mgUvaoK1AyBpbnXm2tsfbfawroWSDPvwGSvQaGFW22y",
  "metadata": {
    "name": "tars_staking",
    "version": "0.1.0",
    "spec": "0.1.0",
    "description": "Tars Staking Program"
  },
  "instructions": [
    {
      "name": "accept_global_config_authority",
      "docs": [
        "Accept global config authority",
        "This is the new authority that can accept the global config authority."
      ],
      "discriminator": [170, 202, 136, 249, 146, 254, 136, 16],
      "accounts": [
        {
          "name": "new_authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": []
    },
    {
      "name": "add_staking_pool_apy",
      "docs": [
        "Add staking pool APY",
        "This is the APY for the staking pool.",
        "Parameters:",
        "- 'period': The period of the APY to be added.",
        "- 'new_apy': The new APY to be added."
      ],
      "discriminator": [87, 248, 182, 179, 238, 3, 218, 145],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": [
        {
          "name": "period",
          "type": "u32"
        },
        {
          "name": "new_apy",
          "type": "u32"
        }
      ]
    },
    {
      "name": "claim",
      "docs": [
        "Claim tokens",
        "Parameters:",
        "- 'nonce': The nonce of the stake deposit receipt.",
        "- 'action': The action to take."
      ],
      "discriminator": [62, 198, 214, 193, 213, 159, 108, 210],
      "accounts": [
        {
          "name": "user",
          "writable": true,
          "signer": true
        },
        {
          "name": "staker",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [115, 116, 97, 107, 101, 114]
              },
              {
                "kind": "account",
                "path": "user"
              },
              {
                "kind": "account",
                "path": "staking_pool"
              }
            ]
          }
        },
        {
          "name": "stake_deposit_receipt",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115, 116, 97, 107, 101, 45, 100, 101, 112, 111, 115, 105, 116,
                  45, 114, 101, 99, 101, 105, 112, 116
                ]
              },
              {
                "kind": "account",
                "path": "staker"
              },
              {
                "kind": "account",
                "path": "staking_pool"
              },
              {
                "kind": "arg",
                "path": "nonce"
              }
            ]
          }
        },
        {
          "name": "user_rewards_ata",
          "writable": true
        },
        {
          "name": "reward_pool_ata",
          "writable": true
        },
        {
          "name": "staking_pool_ata",
          "writable": true
        },
        {
          "name": "staking_pool",
          "writable": true,
          "address": "938hfdM3my8vM9PnEJ3icMNUrmcVVujhRacnfA6nSM8Y",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [115, 116, 97, 107, 101, 45, 112, 111, 111, 108]
              },
              {
                "kind": "const",
                "value": [
                  246, 193, 83, 97, 191, 222, 105, 114, 252, 143, 90, 105, 163,
                  251, 9, 240, 241, 42, 122, 140, 46, 173, 195, 181, 234, 248,
                  0, 222, 218, 144, 135, 119
                ]
              }
            ]
          }
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        }
      ],
      "args": [
        {
          "name": "nonce",
          "type": "u64"
        },
        {
          "name": "action",
          "type": {
            "defined": {
              "name": "ClaimAction"
            }
          }
        },
        {
          "name": "global_config_bump",
          "type": "u8"
        }
      ]
    },
    {
      "name": "close_program",
      "discriminator": [148, 137, 30, 149, 133, 216, 142, 153],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": []
    },
    {
      "name": "create_global_config",
      "docs": [
        "Create global config",
        "This is the first account that is created when the program is initialized.",
        "It contains the configuration for all the staking pools.",
        "Parameters:",
        "- 'min_stake_amount': The minimum amount of tokens that can be staked.",
        "- 'one_month_apy': The APY for 1 month.",
        "- 'six_months_apy': The APY for 6 months.",
        "- 'one_year_apy': The APY for 1 year.",
        "- 'penalty_rate': The penalty rate for the staking pool."
      ],
      "discriminator": [47, 208, 62, 51, 32, 34, 119, 132],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  103, 108, 111, 98, 97, 108, 45, 99, 111, 110, 102, 105, 103
                ]
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "min_stake_amount",
          "type": "u64"
        },
        {
          "name": "one_month_apy",
          "type": "u32"
        },
        {
          "name": "six_months_apy",
          "type": "u32"
        },
        {
          "name": "one_year_apy",
          "type": "u32"
        },
        {
          "name": "penalty_rate",
          "type": "u64"
        }
      ]
    },
    {
      "name": "create_staking_pool",
      "docs": [
        "Create staking pool",
        "This is the staking pool that is created when a user stakes tokens."
      ],
      "discriminator": [104, 58, 70, 37, 225, 212, 145, 93],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "staking_pool",
          "writable": true,
          "address": "938hfdM3my8vM9PnEJ3icMNUrmcVVujhRacnfA6nSM8Y",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [115, 116, 97, 107, 101, 45, 112, 111, 111, 108]
              },
              {
                "kind": "const",
                "value": [
                  246, 193, 83, 97, 191, 222, 105, 114, 252, 143, 90, 105, 163,
                  251, 9, 240, 241, 42, 122, 140, 46, 173, 195, 181, 234, 248,
                  0, 222, 218, 144, 135, 119
                ]
              }
            ]
          }
        },
        {
          "name": "mint",
          "docs": [
            "SPL Token Mint of the underlying token to be deposited for staking"
          ]
        },
        {
          "name": "staking_pool_ata",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "global_config"
              },
              {
                "kind": "const",
                "value": [
                  6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
                  235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
                  245, 133, 126, 255, 0, 169
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
                13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
                219, 233, 248, 89
              ]
            }
          }
        },
        {
          "name": "reward_pool_ata",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "staking_pool"
              },
              {
                "kind": "const",
                "value": [
                  6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
                  235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
                  245, 133, 126, 255, 0, 169
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
                13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
                219, 233, 248, 89
              ]
            }
          }
        },
        {
          "name": "global_config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  103, 108, 111, 98, 97, 108, 45, 99, 111, 110, 102, 105, 103
                ]
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "associated_token_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        }
      ],
      "args": []
    },
    {
      "name": "remove_staking_pool_apy",
      "docs": [
        "Remove staking pool APY",
        "This is the APY for the staking pool.",
        "Parameters:",
        "- 'period': The period of the APY to be removed."
      ],
      "discriminator": [187, 6, 33, 25, 188, 146, 27, 81],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": [
        {
          "name": "period",
          "type": "u32"
        }
      ]
    },
    {
      "name": "set_global_config_authority",
      "docs": [
        "Set global config authority",
        "This is the authority that can update the global config.",
        "Parameters:",
        "- 'new_authority': The new authority."
      ],
      "discriminator": [100, 34, 55, 163, 44, 113, 252, 113],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": [
        {
          "name": "new_authority",
          "type": "pubkey"
        }
      ]
    },
    {
      "name": "set_global_config_paused_state",
      "docs": [
        "Set global config paused state",
        "This is the state of the global config.",
        "Parameters:",
        "- 'new_paused_state': The new paused state."
      ],
      "discriminator": [7, 249, 6, 112, 52, 171, 20, 204],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": []
    },
    {
      "name": "stake",
      "docs": [
        "Stake tokens",
        "Parameters:",
        "- 'amount': The amount of tokens to stake.",
        "- 'period_days': The lock period for the staking pool."
      ],
      "discriminator": [206, 176, 202, 18, 200, 209, 179, 108],
      "accounts": [
        {
          "name": "user",
          "writable": true,
          "signer": true
        },
        {
          "name": "staker",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [115, 116, 97, 107, 101, 114]
              },
              {
                "kind": "account",
                "path": "user"
              },
              {
                "kind": "account",
                "path": "staking_pool"
              }
            ]
          }
        },
        {
          "name": "stake_token_mint",
          "writable": true
        },
        {
          "name": "user_ata",
          "writable": true
        },
        {
          "name": "staking_pool_vault",
          "writable": true
        },
        {
          "name": "stake_deposit_receipt",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115, 116, 97, 107, 101, 45, 100, 101, 112, 111, 115, 105, 116,
                  45, 114, 101, 99, 101, 105, 112, 116
                ]
              },
              {
                "kind": "account",
                "path": "staker"
              },
              {
                "kind": "account",
                "path": "staking_pool"
              },
              {
                "kind": "account",
                "path": "staker.nonce",
                "account": "Staker"
              }
            ]
          }
        },
        {
          "name": "staking_pool",
          "writable": true,
          "address": "938hfdM3my8vM9PnEJ3icMNUrmcVVujhRacnfA6nSM8Y"
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        },
        {
          "name": "period_days",
          "type": "u32"
        }
      ]
    },
    {
      "name": "unstake",
      "docs": [
        "Unstake tokens",
        "Parameters:",
        "- 'nonce': The nonce of the stake deposit receipt."
      ],
      "discriminator": [90, 95, 107, 42, 205, 124, 50, 225],
      "accounts": [
        {
          "name": "user",
          "writable": true,
          "signer": true
        },
        {
          "name": "staker",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [115, 116, 97, 107, 101, 114]
              },
              {
                "kind": "account",
                "path": "user"
              },
              {
                "kind": "account",
                "path": "staking_pool"
              }
            ]
          }
        },
        {
          "name": "stake_deposit_receipt",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115, 116, 97, 107, 101, 45, 100, 101, 112, 111, 115, 105, 116,
                  45, 114, 101, 99, 101, 105, 112, 116
                ]
              },
              {
                "kind": "account",
                "path": "staker"
              },
              {
                "kind": "account",
                "path": "staking_pool"
              },
              {
                "kind": "arg",
                "path": "nonce"
              }
            ]
          }
        },
        {
          "name": "user_rewards_ata",
          "writable": true
        },
        {
          "name": "staking_pool_ata",
          "writable": true
        },
        {
          "name": "reward_pool_ata",
          "writable": true
        },
        {
          "name": "staking_pool",
          "writable": true,
          "address": "938hfdM3my8vM9PnEJ3icMNUrmcVVujhRacnfA6nSM8Y"
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        }
      ],
      "args": [
        {
          "name": "nonce",
          "type": "u64"
        },
        {
          "name": "global_config_bump",
          "type": "u8"
        }
      ]
    },
    {
      "name": "update_global_config",
      "docs": [
        "Update global config",
        "This is the configuration of the global config.",
        "Parameters:",
        "- 'min_stake_amount': The minimum amount of tokens that can be staked.",
        "- 'one_month_apy': The APY for 1 month.",
        "- 'six_months_apy': The APY for 6 months.",
        "- 'one_year_apy': The APY for 1 year.",
        "- 'penalty_rate': The penalty rate for the staking pool."
      ],
      "discriminator": [164, 84, 130, 189, 111, 58, 250, 200],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": [
        {
          "name": "min_stake_amount",
          "type": "u64"
        },
        {
          "name": "one_month_apy",
          "type": "u32"
        },
        {
          "name": "six_months_apy",
          "type": "u32"
        },
        {
          "name": "one_year_apy",
          "type": "u32"
        },
        {
          "name": "penalty_rate",
          "type": "u64"
        }
      ]
    },
    {
      "name": "update_staking_pool_apy",
      "docs": [
        "Update staking pool APY",
        "This is the APY for the staking pool.",
        "Parameters:",
        "- 'period': The period of the APY to be updated.",
        "- 'new_apy': The new APY to be updated."
      ],
      "discriminator": [186, 169, 106, 179, 46, 142, 66, 46],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": [
        {
          "name": "period",
          "type": "u32"
        },
        {
          "name": "new_apy",
          "type": "u32"
        }
      ]
    },
    {
      "name": "update_staking_pool_penalty_rate",
      "docs": [
        "Update staking pool penalty rate",
        "This is the penalty rate for the staking pool.",
        "Parameters:",
        "- 'new_penalty_rate': The new penalty rate."
      ],
      "discriminator": [66, 214, 106, 240, 247, 167, 122, 18],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "global_config",
          "writable": true,
          "address": "BUfQsK7rxhsjvuWCpLn81zWTiuUTqxMcYe8cUKMmZf5p"
        }
      ],
      "args": [
        {
          "name": "new_penalty_rate",
          "type": "u64"
        }
      ]
    }
  ],
  "accounts": [
    {
      "name": "GlobalConfig",
      "discriminator": [149, 8, 156, 202, 160, 252, 176, 217]
    },
    {
      "name": "StakeDepositReceipt",
      "discriminator": [210, 98, 254, 196, 151, 68, 235, 0]
    },
    {
      "name": "Staker",
      "discriminator": [171, 229, 193, 85, 67, 177, 151, 4]
    },
    {
      "name": "StakingPool",
      "discriminator": [203, 19, 214, 220, 220, 154, 24, 102]
    }
  ],
  "events": [
    {
      "name": "LogAcceptGlobalConfigAuthorityEvent",
      "discriminator": [176, 117, 148, 78, 239, 28, 201, 153]
    },
    {
      "name": "LogAddStakingPoolAPYEvent",
      "discriminator": [63, 54, 45, 157, 121, 251, 242, 56]
    },
    {
      "name": "LogChangeGlobalConfigPausedStateEvent",
      "discriminator": [67, 79, 14, 247, 70, 17, 253, 122]
    },
    {
      "name": "LogClaimEvent",
      "discriminator": [248, 167, 33, 45, 217, 136, 55, 224]
    },
    {
      "name": "LogCreateGlobalConfigEvent",
      "discriminator": [243, 27, 182, 205, 218, 197, 18, 65]
    },
    {
      "name": "LogCreateStakerEvent",
      "discriminator": [4, 102, 112, 158, 12, 101, 48, 23]
    },
    {
      "name": "LogCreateStakingPoolEvent",
      "discriminator": [112, 239, 197, 92, 108, 226, 53, 203]
    },
    {
      "name": "LogRemoveStakingPoolAPYEvent",
      "discriminator": [85, 161, 168, 108, 81, 149, 212, 234]
    },
    {
      "name": "LogStakeEvent",
      "discriminator": [131, 92, 19, 27, 5, 29, 163, 196]
    },
    {
      "name": "LogUnstakeEvent",
      "discriminator": [99, 243, 143, 114, 82, 23, 227, 105]
    },
    {
      "name": "LogUpdateGlobalConfigAuthEvent",
      "discriminator": [149, 149, 182, 43, 2, 8, 16, 202]
    },
    {
      "name": "LogUpdateGlobalConfigEvent",
      "discriminator": [150, 4, 136, 10, 149, 244, 197, 191]
    },
    {
      "name": "LogUpdateStakingPoolAPYEvent",
      "discriminator": [229, 61, 15, 94, 200, 72, 252, 72]
    },
    {
      "name": "LogUpdateStakingPoolPenaltyRateEvent",
      "discriminator": [21, 14, 249, 216, 203, 19, 123, 81]
    }
  ],
  "errors": [
    {
      "code": 6000,
      "name": "Unauthorized",
      "msg": "You are not authorized to perform this action."
    },
    {
      "code": 6001,
      "name": "InvalidMinStakeAmount",
      "msg": "Invalid min stake amount"
    },
    {
      "code": 6002,
      "name": "InvalidOneMonthApy",
      "msg": "Invalid one month APY"
    },
    {
      "code": 6003,
      "name": "InvalidSixMonthsApy",
      "msg": "Invalid six months APY"
    },
    {
      "code": 6004,
      "name": "InvalidOneYearApy",
      "msg": "Invalid one year APY"
    },
    {
      "code": 6005,
      "name": "InvalidMinDepositAmount",
      "msg": "Invalid min deposit amount"
    },
    {
      "code": 6006,
      "name": "UnauthorizedDepositAccount",
      "msg": "Unauthorized deposit account"
    },
    {
      "code": 6007,
      "name": "InvalidTokenAccount",
      "msg": "Token acccount does not match stake token mint account"
    },
    {
      "code": 6008,
      "name": "UnauthorizedStaker",
      "msg": "Unauthorized staker"
    },
    {
      "code": 6009,
      "name": "InsufficientRewardsPoolBalance",
      "msg": "Insufficient rewards pool balance"
    },
    {
      "code": 6010,
      "name": "NoRewardsToClaim",
      "msg": "No rewards to claim"
    },
    {
      "code": 6011,
      "name": "InvalidPartialUnstakeAmount",
      "msg": "Invalid partial unstake amount"
    },
    {
      "code": 6012,
      "name": "StakeDepositReceiptNotActive",
      "msg": "Stake deposit receipt not active"
    },
    {
      "code": 6013,
      "name": "InvalidNonce",
      "msg": "Invalid nonce"
    },
    {
      "code": 6014,
      "name": "RemainingRewardsToClaim",
      "msg": "Remaining rewards to claim"
    },
    {
      "code": 6015,
      "name": "StakingPoolPaused",
      "msg": "Staking pool is paused"
    },
    {
      "code": 6016,
      "name": "InvalidPenaltyRate",
      "msg": "Invalid penalty rate"
    },
    {
      "code": 6017,
      "name": "InvalidStakeToken",
      "msg": "Invalid stake token"
    },
    {
      "code": 6018,
      "name": "InvalidPeriod",
      "msg": "Invalid period"
    },
    {
      "code": 6019,
      "name": "InvalidLockPeriod",
      "msg": "Invalid lock period"
    },
    {
      "code": 6020,
      "name": "PeriodAlreadyExists",
      "msg": "Period already exists"
    },
    {
      "code": 6021,
      "name": "MaxAPYMappingSizeReached",
      "msg": "Max APY mapping size reached"
    },
    {
      "code": 6022,
      "name": "MathOverflow",
      "msg": "Math overflow"
    },
    {
      "code": 6023,
      "name": "StakerNotInitialized",
      "msg": "Staker is not initialized"
    }
  ],
  "types": [
    {
      "name": "APYMapping",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mappings",
            "type": {
              "vec": {
                "defined": {
                  "name": "APYPeriod"
                }
              }
            }
          }
        ]
      }
    },
    {
      "name": "APYPeriod",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "period_days",
            "type": "u32"
          },
          {
            "name": "apy_bps",
            "type": "u32"
          }
        ]
      }
    },
    {
      "name": "ClaimAction",
      "docs": [
        "Claim action.",
        "This is the action that is taken when a user claims rewards."
      ],
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "ClaimOnly"
          },
          {
            "name": "ClaimAndEnd"
          },
          {
            "name": "ClaimAndPartialUnStake",
            "fields": ["u64"]
          }
        ]
      }
    },
    {
      "name": "GlobalConfig",
      "docs": [
        "Global config for the staking program.",
        "This is the first account that is created when the program is initialized.",
        "It contains the configuration for all the staking pools."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "authority",
            "docs": ["Stake master owner"],
            "type": "pubkey"
          },
          {
            "name": "pending_authority",
            "docs": ["Pending authority"],
            "type": {
              "option": "pubkey"
            }
          },
          {
            "name": "min_stake_amount",
            "docs": ["Minimum stake amount"],
            "type": "u64"
          },
          {
            "name": "paused_state",
            "docs": ["PAUSED STATE."],
            "type": "bool"
          },
          {
            "name": "apy_mapping",
            "docs": ["APY mapping"],
            "type": {
              "defined": {
                "name": "APYMapping"
              }
            }
          },
          {
            "name": "penalty_rate",
            "docs": ["Penalty rate"],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "LogAcceptGlobalConfigAuthorityEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "new_auth",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "LogAddStakingPoolAPYEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "period",
            "type": "u32"
          },
          {
            "name": "new_apy",
            "type": "u32"
          }
        ]
      }
    },
    {
      "name": "LogChangeGlobalConfigPausedStateEvent",
      "docs": [
        "Log the change of the [Global Config] paused state",
        "Parameters:",
        "- paused: The new paused state of the [Global Config]"
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "paused",
            "type": "bool"
          }
        ]
      }
    },
    {
      "name": "LogClaimEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "user",
            "type": "pubkey"
          },
          {
            "name": "staker",
            "type": "pubkey"
          },
          {
            "name": "staking_pool",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "action",
            "type": {
              "defined": {
                "name": "ClaimAction"
              }
            }
          }
        ]
      }
    },
    {
      "name": "LogCreateGlobalConfigEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "stake_token",
            "type": "pubkey"
          },
          {
            "name": "min_stake_amount",
            "type": "u64"
          },
          {
            "name": "one_month_apy",
            "type": "u32"
          },
          {
            "name": "six_months_apy",
            "type": "u32"
          },
          {
            "name": "one_year_apy",
            "type": "u32"
          },
          {
            "name": "penalty_rate",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "LogCreateStakerEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "user",
            "type": "pubkey"
          },
          {
            "name": "staker",
            "type": "pubkey"
          },
          {
            "name": "staking_pool",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "LogCreateStakingPoolEvent",
      "docs": [
        "Event emitted when a staking pool is created",
        "Emit Staking pool account"
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "staking_pool",
            "type": "pubkey"
          },
          {
            "name": "stake_token",
            "type": "pubkey"
          },
          {
            "name": "vault",
            "type": "pubkey"
          },
          {
            "name": "reward_vault",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "LogRemoveStakingPoolAPYEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "period",
            "type": "u32"
          }
        ]
      }
    },
    {
      "name": "LogStakeEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "user",
            "type": "pubkey"
          },
          {
            "name": "staker",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "lock_period",
            "type": "u32"
          },
          {
            "name": "stake_apy",
            "type": "u32"
          },
          {
            "name": "start_time",
            "type": "i64"
          },
          {
            "name": "end_time",
            "type": "i64"
          },
          {
            "name": "staking_pool_total_staked",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "LogUnstakeEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "user",
            "type": "pubkey"
          },
          {
            "name": "staker",
            "type": "pubkey"
          },
          {
            "name": "staking_pool",
            "type": "pubkey"
          },
          {
            "name": "unstake_amount",
            "type": "u64"
          },
          {
            "name": "penalty_rate",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "LogUpdateGlobalConfigAuthEvent",
      "docs": [
        "Log the update of the [Global Config] authority",
        "Parameters:",
        "- new_auth: The new [Global Config] authority",
        "- old_auth: The old authority to be replaced"
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "new_pending_auth",
            "type": "pubkey"
          },
          {
            "name": "old_auth",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "LogUpdateGlobalConfigEvent",
      "docs": [
        "Log the update of the [Global Config]",
        "Parameters:",
        "- min_stake_amount: The minimum stake amount of the [Global Config]",
        "- one_month_apy: The one month APY of the [Global Config]",
        "- six_months_apy: The six months APY of the [Global Config]",
        "- one_year_apy: The one year APY of the [Global Config]",
        "- penalty_rate: The penalty rate of the [Global Config]"
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "min_stake_amount",
            "type": "u64"
          },
          {
            "name": "one_month_apy",
            "type": "u64"
          },
          {
            "name": "six_months_apy",
            "type": "u64"
          },
          {
            "name": "one_year_apy",
            "type": "u64"
          },
          {
            "name": "penalty_rate",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "LogUpdateStakingPoolAPYEvent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "period",
            "type": "u32"
          },
          {
            "name": "old_apy",
            "type": "u32"
          },
          {
            "name": "new_apy",
            "type": "u32"
          }
        ]
      }
    },
    {
      "name": "LogUpdateStakingPoolPenaltyRateEvent",
      "docs": [
        "Log the update of the [Staking Pool] penalty rate",
        "Parameters:",
        "- old_penalty_rate: The old penalty rate of the [Staking Pool]",
        "- new_penalty_rate: The new penalty rate of the [Staking Pool]"
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "old_penalty_rate",
            "type": "u64"
          },
          {
            "name": "new_penalty_rate",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "RewardPool",
      "docs": [
        "Reward pool for a staking pool.",
        "This is the structure that is created when a staking pool is created.",
        "It contains the configuration for the reward pool."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "reward_vault",
            "docs": ["Reward vault"],
            "type": "pubkey"
          },
          {
            "name": "last_amount",
            "docs": ["Last amount"],
            "type": "u64"
          },
          {
            "name": "last_claim_time",
            "docs": ["Last claim time"],
            "type": "i64"
          },
          {
            "name": "total_rewards_claimed",
            "docs": ["Total rewards claimed"],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "StakeDepositReceipt",
      "docs": [
        "Stake deposit receipt.",
        "This is the account that is created when a user stakes tokens.",
        "It contains the configuration of the deposit."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "staker",
            "type": "pubkey"
          },
          {
            "name": "stake_nonce",
            "type": "u64"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "unstaked_amount",
            "type": "u64"
          },
          {
            "name": "apy",
            "type": "u32"
          },
          {
            "name": "start_time",
            "type": "i64"
          },
          {
            "name": "end_time",
            "type": "i64"
          },
          {
            "name": "lock_period",
            "type": "u32"
          },
          {
            "name": "active",
            "type": "bool"
          },
          {
            "name": "last_claim_time",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "Staker",
      "docs": [
        "Staker account.",
        "This is the account that is created when a user stakes tokens.",
        "It contains the configuration for the staker."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "authority",
            "type": "pubkey"
          },
          {
            "name": "staking_pool",
            "type": "pubkey"
          },
          {
            "name": "total_claimed_rewards",
            "type": "u64"
          },
          {
            "name": "total_staked",
            "type": "u64"
          },
          {
            "name": "active_deposits",
            "type": "u64"
          },
          {
            "name": "nonce",
            "type": "u64"
          },
          {
            "name": "is_initialized",
            "type": "bool"
          }
        ]
      }
    },
    {
      "name": "StakingPool",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "authority",
            "type": "pubkey"
          },
          {
            "name": "pool_token",
            "type": "pubkey"
          },
          {
            "name": "total_staked",
            "type": "u64"
          },
          {
            "name": "vault",
            "type": "pubkey"
          },
          {
            "name": "reward_pool",
            "type": {
              "defined": {
                "name": "RewardPool"
              }
            }
          }
        ]
      }
    }
  ]
}

@itslesther
Copy link
Author

itslesther commented Feb 13, 2025

@enoldev that's the IDL. I'm using anchor 0.30.1. Contract is deployed on devnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants