lib.rs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. use anchor_lang::prelude::*;
  2. declare_id!("FmpfPa1LHEYRbueNMnwNVd2JvyQ89GXGWdyZEXNNKV8w");
  3. // This program is simply used to generate the IDL for the token program.
  4. //
  5. // Note that we manually add the COption<Pubkey> type to the IDL after
  6. // compiling.
  7. //
  8. #[program]
  9. pub mod spl_token {
  10. use super::*;
  11. pub fn initialize_mint(
  12. ctx: Context<InitializeMint>,
  13. decimals: u8,
  14. mint_authority: Pubkey,
  15. // freeze_authority: COption<Pubkey>,
  16. ) -> ProgramResult {
  17. Ok(())
  18. }
  19. pub fn initialize_account(ctx: Context<InitializeAccount>) -> ProgramResult {
  20. Ok(())
  21. }
  22. pub fn initialize_multisig(ctx: Context<InitializeMultisig>, m: u8) -> ProgramResult {
  23. Ok(())
  24. }
  25. pub fn transfer(ctx: Context<Transfer>, amount: u64) -> ProgramResult {
  26. Ok(())
  27. }
  28. pub fn approve(ctx: Context<Approve>, amount: u64) -> ProgramResult {
  29. Ok(())
  30. }
  31. pub fn revoke(ctx: Context<Revoke>) -> ProgramResult {
  32. Ok(())
  33. }
  34. pub fn set_authority(
  35. ctx: Context<SetAuthority>,
  36. authority_type: u8,
  37. // new_authority: COption<Pubkey>,
  38. ) -> ProgramResult {
  39. Ok(())
  40. }
  41. pub fn mint_to(ctx: Context<MintTo>, amount: u64) -> ProgramResult {
  42. Ok(())
  43. }
  44. pub fn burn(ctx: Context<Burn>, amount: u64) -> ProgramResult {
  45. Ok(())
  46. }
  47. pub fn close_account(ctx: Context<CloseAccount>) -> ProgramResult {
  48. Ok(())
  49. }
  50. pub fn freeze_account(ctx: Context<FreezeAccount>) -> ProgramResult {
  51. Ok(())
  52. }
  53. pub fn thaw_account(ctx: Context<ThawAccount>) -> ProgramResult {
  54. Ok(())
  55. }
  56. pub fn transfer_checked(
  57. ctx: Context<TransferChecked>,
  58. amount: u64,
  59. decimals: u8,
  60. ) -> ProgramResult {
  61. Ok(())
  62. }
  63. pub fn approve_checked(
  64. ctx: Context<ApproveChecked>,
  65. amount: u64,
  66. decimals: u8,
  67. ) -> ProgramResult {
  68. Ok(())
  69. }
  70. pub fn mint_to_checked(
  71. ctx: Context<MintToChecked>,
  72. amount: u64,
  73. decimals: u8,
  74. ) -> ProgramResult {
  75. Ok(())
  76. }
  77. pub fn burn_checked(ctx: Context<BurnChecked>, amount: u64, decimals: u8) -> ProgramResult {
  78. Ok(())
  79. }
  80. pub fn initialize_account_2(
  81. ctx: Context<InitializeAccount2>,
  82. authority: Pubkey,
  83. ) -> ProgramResult {
  84. Ok(())
  85. }
  86. pub fn sync_native(ctx: Context<SyncNative>) -> ProgramResult {
  87. Ok(())
  88. }
  89. pub fn initialize_account3(
  90. ctx: Context<InitializeAccount3>,
  91. authority: Pubkey,
  92. ) -> ProgramResult {
  93. Ok(())
  94. }
  95. pub fn initialize_multisig_2(ctx: Context<InitializeMultisig2>, m: u8) -> ProgramResult {
  96. Ok(())
  97. }
  98. pub fn initialize_mint_2(
  99. ctx: Context<InitializeMint2>,
  100. decimals: u8,
  101. mint_authority: Pubkey,
  102. // freeze_authority: COption<Pubkey>,
  103. ) -> ProgramResult {
  104. Ok(())
  105. }
  106. }
  107. #[derive(Accounts)]
  108. pub struct InitializeMint<'info> {
  109. #[account(mut)]
  110. mint: AccountInfo<'info>,
  111. rent: AccountInfo<'info>,
  112. }
  113. #[derive(Accounts)]
  114. pub struct InitializeAccount<'info> {
  115. #[account(mut)]
  116. account: AccountInfo<'info>,
  117. mint: AccountInfo<'info>,
  118. authority: AccountInfo<'info>,
  119. rent: AccountInfo<'info>,
  120. }
  121. #[derive(Accounts)]
  122. pub struct InitializeMultisig<'info> {
  123. #[account(mut)]
  124. account: AccountInfo<'info>,
  125. rent: AccountInfo<'info>,
  126. }
  127. #[derive(Accounts)]
  128. pub struct Transfer<'info> {
  129. #[account(mut)]
  130. source: AccountInfo<'info>,
  131. #[account(mut)]
  132. destination: AccountInfo<'info>,
  133. authority: Signer<'info>,
  134. }
  135. #[derive(Accounts)]
  136. pub struct Approve<'info> {
  137. #[account(mut)]
  138. source: AccountInfo<'info>,
  139. delegate: AccountInfo<'info>,
  140. authority: Signer<'info>,
  141. }
  142. #[derive(Accounts)]
  143. pub struct Revoke<'info> {
  144. #[account(mut)]
  145. source: AccountInfo<'info>,
  146. authority: Signer<'info>,
  147. }
  148. #[derive(Accounts)]
  149. pub struct SetAuthority<'info> {
  150. #[account(mut)]
  151. pub mint: AccountInfo<'info>,
  152. pub authority: Signer<'info>,
  153. }
  154. #[derive(Accounts)]
  155. pub struct MintTo<'info> {
  156. #[account(mut)]
  157. pub mint: AccountInfo<'info>,
  158. #[account(mut)]
  159. pub to: AccountInfo<'info>,
  160. pub authority: Signer<'info>,
  161. }
  162. #[derive(Accounts)]
  163. pub struct Burn<'info> {
  164. #[account(mut)]
  165. source: AccountInfo<'info>,
  166. #[account(mut)]
  167. mint: AccountInfo<'info>,
  168. authority: Signer<'info>,
  169. }
  170. #[derive(Accounts)]
  171. pub struct CloseAccount<'info> {
  172. #[account(mut)]
  173. account: AccountInfo<'info>,
  174. #[account(mut)]
  175. destination: AccountInfo<'info>,
  176. authority: AccountInfo<'info>,
  177. }
  178. #[derive(Accounts)]
  179. pub struct FreezeAccount<'info> {
  180. #[account(mut)]
  181. account: AccountInfo<'info>,
  182. mint: AccountInfo<'info>,
  183. authority: Signer<'info>,
  184. }
  185. #[derive(Accounts)]
  186. pub struct ThawAccount<'info> {
  187. #[account(mut)]
  188. account: AccountInfo<'info>,
  189. mint: AccountInfo<'info>,
  190. authority: Signer<'info>,
  191. }
  192. #[derive(Accounts)]
  193. pub struct TransferChecked<'info> {
  194. #[account(mut)]
  195. source: AccountInfo<'info>,
  196. mint: AccountInfo<'info>,
  197. #[account(mut)]
  198. destination: AccountInfo<'info>,
  199. authority: Signer<'info>,
  200. }
  201. #[derive(Accounts)]
  202. pub struct ApproveChecked<'info> {
  203. #[account(mut)]
  204. source: AccountInfo<'info>,
  205. mint: AccountInfo<'info>,
  206. delegate: AccountInfo<'info>,
  207. authority: Signer<'info>,
  208. }
  209. #[derive(Accounts)]
  210. pub struct MintToChecked<'info> {
  211. #[account(mut)]
  212. mint: AccountInfo<'info>,
  213. #[account(mut)]
  214. to: AccountInfo<'info>,
  215. authority: Signer<'info>,
  216. }
  217. #[derive(Accounts)]
  218. pub struct BurnChecked<'info> {
  219. #[account(mut)]
  220. source: AccountInfo<'info>,
  221. #[account(mut)]
  222. mint: AccountInfo<'info>,
  223. authority: Signer<'info>,
  224. }
  225. #[derive(Accounts)]
  226. pub struct InitializeAccount2<'info> {
  227. #[account(mut)]
  228. account: AccountInfo<'info>,
  229. mint: AccountInfo<'info>,
  230. rent: AccountInfo<'info>,
  231. }
  232. #[derive(Accounts)]
  233. pub struct SyncNative<'info> {
  234. #[account(mut)]
  235. account: AccountInfo<'info>,
  236. }
  237. #[derive(Accounts)]
  238. pub struct InitializeAccount3<'info> {
  239. #[account(mut)]
  240. account: AccountInfo<'info>,
  241. mint: AccountInfo<'info>,
  242. }
  243. #[derive(Accounts)]
  244. pub struct InitializeMultisig2<'info> {
  245. #[account(mut)]
  246. account: AccountInfo<'info>,
  247. }
  248. #[derive(Accounts)]
  249. pub struct InitializeMint2<'info> {
  250. #[account(mut)]
  251. mint: AccountInfo<'info>,
  252. }