import_ext_call.sol 1.1 KB

12345678910111213141516171819202122232425
  1. // RUN: --target solana --emit cfg
  2. import '../import_test.sol' as My;
  3. @program_id("6qEm4QUJGFvqKNJGjTrAEiFhbVBY4ashpBjDHEFvEUmW")
  4. contract Foo {
  5. // BEGIN-CHECK: Foo::Foo::function::get_b
  6. function get_b(address id) public pure {
  7. // External calls
  8. // CHECK: external call::regular address:(arg #0) payload:%abi_encoded.temp.2 value:uint64 0 gas:uint64 0 accounts:[0] [ ] seeds: contract|function:(2, 2) flags:
  9. My.Dog.barks{program_id: id}("woof");
  10. // CHECK: external call::regular address:(arg #0) payload:%abi_encoded.temp.4 value:uint64 0 gas:uint64 0 accounts:[0] [ ] seeds: contract|function:(2, 2) flags:
  11. My.Dog.barks{program_id: id}({what: "meow"});
  12. }
  13. }
  14. contract Cat is My.Dog {
  15. // BEGIN-CHECK: Cat::Cat::function::try_cat
  16. function try_cat() public pure {
  17. // Internal calls
  18. My.Dog.barks("woof");
  19. // CHECK: Cat::Dog::function::barks__string (alloc string uint32 4 "woof")
  20. My.Dog.barks({what: "meow"});
  21. // CHECK: Cat::Dog::function::barks__string (alloc string uint32 4 "meow")
  22. }
  23. }