program_id.sol 583 B

123456789101112131415161718192021222324252627
  1. @program_id("Foo5mMfYo5RhRcWa4NZ2bwFn4Kdhe8rNK5jchxsKrivA")
  2. contract Foo {
  3. function say_hello() public pure {
  4. print("Hello from foo");
  5. }
  6. }
  7. contract OtherFoo {
  8. function say_bye() public pure {
  9. print("Bye from other foo");
  10. }
  11. }
  12. contract Bar {
  13. function create_foo() external {
  14. Foo.new();
  15. }
  16. function call_foo() public {
  17. Foo.say_hello();
  18. }
  19. function foo_at_another_address(address other_foo_id) external {
  20. OtherFoo.new{program_id: other_foo_id}();
  21. OtherFoo.say_bye{program_id: other_foo_id}();
  22. }
  23. }