solana_payer_account.sol 1.6 KB

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