ContractInvocation.java

  1. /*
  2.  * @copyright defined in LICENSE.txt
  3.  */

  4. package hera.api.model;

  5. import static hera.util.ValidationUtils.assertNotNull;
  6. import static java.util.Collections.unmodifiableList;

  7. import hera.annotation.ApiAudience;
  8. import hera.annotation.ApiStability;
  9. import java.util.List;
  10. import lombok.Builder;
  11. import lombok.EqualsAndHashCode;
  12. import lombok.Getter;
  13. import lombok.ToString;

  14. @ApiAudience.Public
  15. @ApiStability.Unstable
  16. @ToString
  17. @EqualsAndHashCode
  18. @Builder(builderMethodName = "newBuilder")
  19. public class ContractInvocation {

  20.   @Getter
  21.   protected final ContractAddress address;

  22.   @Getter
  23.   protected final ContractFunction function;

  24.   @Getter
  25.   protected final List<Object> args;

  26.   @Getter
  27.   protected final Aer amount;

  28.   @Getter
  29.   protected final boolean delegateFee;

  30.   ContractInvocation(final ContractAddress contractAddress, final ContractFunction contractFunction,
  31.       final List<Object> args, final Aer amount, final boolean delegateFee) {
  32.     assertNotNull(contractAddress, "Contract address must not null");
  33.     assertNotNull(contractFunction, "Contract function must not null");
  34.     assertNotNull(args, "Contract function args must not null");
  35.     assertNotNull(amount, "Amount must not null");
  36.     this.address = contractAddress;
  37.     this.function = contractFunction;
  38.     this.args = unmodifiableList(args);
  39.     this.amount = amount;
  40.     this.delegateFee = delegateFee;
  41.   }

  42. }