counter.sol 590 B

1234567891011121314151617181920212223
  1. @program_id("F1ipperKF9EfD821ZbbYjS319LXYiBmjhzkkf5a26rC")
  2. contract counter {
  3. // The counter value that is stored in the account
  4. uint64 private count;
  5. // The constructor is used to create a new counter account
  6. @payer(payer) // The "payer" pays for the counter account creation
  7. constructor() {
  8. // Initialize the count to zero
  9. count = 0;
  10. }
  11. // Increments the count by one.
  12. function increment() public {
  13. count += 1;
  14. }
  15. // Returns the count value
  16. function get() public view returns (uint64) {
  17. return count;
  18. }
  19. }