solana_payer_account.sol 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. // RUN: --target solana --emit cfg
  2. @program_id("SoLDxXQ9GMoa15i4NavZc61XGkas2aom4aNiWT6KUER")
  3. contract Builder {
  4. Built other;
  5. // BEGIN-CHECK: Builder::Builder::function::build_this
  6. function build_this() external {
  7. // CHECK: constructor(no: 4) salt: value: gas:uint64 0 address:address 0x69be884fd55a2306354c305323cc6b7ce91768be33d32a021155ef608806bcb seeds: Built encoded buffer: %abi_encoded.temp.18 accounts: [3] [ struct { (load (struct (subscript struct AccountInfo[] (builtin Accounts ())[uint32 2]) field 0)), true, false }, struct { (load (struct (subscript struct AccountInfo[] (builtin Accounts ())[uint32 1]) field 0)), true, true }, struct { (load (struct (subscript struct AccountInfo[] (builtin Accounts ())[uint32 4]) field 0)), false, false } ]
  8. other = new Built("my_seed");
  9. }
  10. function call_that() public view {
  11. other.say_this("Hold up! I'm calling!");
  12. }
  13. }
  14. @program_id("SoLGijpEqEeXLEqa9ruh7a6Lu4wogd6rM8FNoR7e3wY")
  15. contract Built {
  16. @space(1024)
  17. @payer(payer_account)
  18. constructor(@seed bytes my_seed) {}
  19. // BEGIN-CHECK: solang_dispatch
  20. // CHECK: ty:struct AccountInfo %temp.10 = (subscript struct AccountInfo[] (builtin Accounts ())[uint32 1])
  21. // CHECK: ty:struct AccountInfo %temp.11 = (subscript struct AccountInfo[] (builtin Accounts ())[uint32 0])
  22. // CHECK: ty:struct AccountMeta[2] %metas.temp.9 = [2] [ struct { (load (struct %temp.10 field 0)), true, true }, struct { (load (struct %temp.11 field 0)), true, true } ]
  23. // The account metas should have the proper index in the AccountInfo array: 1
  24. function say_this(string text) public pure {
  25. print(text);
  26. }
  27. }