system_instruction_example.sol 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // SPDX-License-Identifier: Apache-2.0
  2. import '../../solana-library/system_instruction.sol';
  3. contract TestingInstruction {
  4. function create_account(address from, address to, uint64 lamports, uint64 space, address owner) public {
  5. SystemInstruction.create_account(from, to, lamports, space, owner);
  6. }
  7. function create_account_with_seed(address from, address to, address base, string seed, uint64 lamports, uint64 space, address owner) public {
  8. SystemInstruction.create_account_with_seed(from, to, base, seed, lamports, space, owner);
  9. }
  10. function assign(address account, address owner) public {
  11. SystemInstruction.assign(account, owner);
  12. }
  13. function assign_with_seed(address account, address base, string seed, address owner) public {
  14. SystemInstruction.assign_with_seed(account, base, seed, owner);
  15. }
  16. function transfer(address from, address to, uint64 lamports) public {
  17. SystemInstruction.transfer(from, to, lamports);
  18. }
  19. function transfer_with_seed(address from_pubkey, address from_base, string seed, address from_owner, address to_pubkey, uint64 lamports) public {
  20. SystemInstruction.transfer_with_seed(from_pubkey, from_base, seed, from_owner, to_pubkey, lamports);
  21. }
  22. function allocate(address pub_key, uint64 space) public {
  23. SystemInstruction.allocate(pub_key, space);
  24. }
  25. function allocate_with_seed(address addr, address base, string seed, uint64 space, address owner) public {
  26. SystemInstruction.allocate_with_seed(addr, base, seed, space, owner);
  27. }
  28. function create_nonce_account_with_seed(address from, address nonce, address base, string seed, address authority, uint64 lamports) public {
  29. SystemInstruction.create_nonce_account_with_seed(from, nonce, base, seed, authority, lamports);
  30. }
  31. function create_nonce_account(address from, address nonce, address authority, uint64 lamports) public {
  32. SystemInstruction.create_nonce_account(from, nonce, authority, lamports);
  33. }
  34. function advance_nonce_account(address nonce, address authorized) public {
  35. SystemInstruction.advance_nonce_account(nonce, authorized);
  36. }
  37. function withdraw_nonce_account(address nonce, address authority, address to, uint64 lamports) public {
  38. SystemInstruction.withdraw_nonce_account(nonce, authority, to, lamports);
  39. }
  40. function authorize_nonce_account(address nonce, address authority, address new_authority) public {
  41. SystemInstruction.authorize_nonce_account(nonce, authority, new_authority);
  42. }
  43. // This is not available on Solana v1.9.15
  44. // function upgrade_nonce_account(address nonce) public {
  45. // SystemInstruction.upgrade_nonce_account(nonce);
  46. // }
  47. }