Type
CONTRACT
Validation date
2023-10-25 15:26:34 UTC
Fee
0 UCO

Code (872 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698254760 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.01
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1698254760
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.01
Contract.set_code ""

end

condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
  previous_public_key: (
  # Transaction is not yet validated so we need to use previous address
  # to get the genesis address
  previous_address = Chain.get_previous_address()
 Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1698254760,
  content: Crypto.hash(String.to_hex(secret)) == 0x13009B304C3325DB7B8CD405D6F247CA58062C19F6335E3B5C2EA44890ABBCED
]

actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
  next_code = """
  @version 1

  export fun get_secret() do
    [
      secret: 0x#{secret},
      secret_signature: [
        r: 0x#{secret_signature.r},
        s: 0x#{secret_signature.s},
        v: #{secret_signature.v}
      ]
    ]
  end

  """

  Contract.set_type "transfer"
  Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.00997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1698254760,
    secret_hash: 0x13009B304C3325DB7B8CD405D6F247CA58062C19F6335E3B5C2EA44890ABBCED,
    secret_hash_signature: [
      r: 0xA31B0FCC0C123C63814EBDBE0849FB6734CB89865781F7EB751F1CB36A564AD4,
      s: 0x04EE203EA98FBB947A0D8C3D6AB43B4A1A8E1C8270C070E1B6EFDA0510F94E9E,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3B23F78FB16B83B8DC2834CB8043FC0E4F05C39E2269A40F3A0F879553891750F399DB7191DA08257F5425D3EBAD90D97A015AC8D18BB04F1690BB08

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00012B5B60A29529ED49594051AFDD0081A7E675F6C84BD06455B6648BB36089B15A

Previous signature

4F07EB0A74629564DC8B98A81562FC16B03D8205459C1F2FD62EE3A9E00643BE6E153A027540572C22AAAD0D6CFD27A238CB7907EBBFB43F909B6DCB426D0F06

Origin signature

3044022001E57C9A9DEAD461B8DD1228F060E3CDF4FDC9927B763D472078C27331749724022071E7F6D44EE762A4573C9517936651BB6F237960C35EB03EF5A1C6095B3F13D3

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00CBACA9C77A25994C1EC5C5B715C72802E43CDA94594135AF93FC02821819E942

Coordinator signature

4893704DDF048E7D2777AD74334598A34FF8D98A101960EC1501F63B0EF6E0253460BA21BF64C77C07EC0483201E1B6DB207AF6CA44E859C0EA2E0174233DF04

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

81359F52FE019D47294B18465154CFCC142B5957053C88F3FC3D39C8551C310FAFF103AEBF39616D3294CC1D078078075F3FAD54824C382A1F9628EA3C2A1309

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

A8CA17B34C3E9BC13EAB2056C55D4D0F171BE0E71C639C2761C0AC824E26D777BFBE650AE97F91E25C5A9B99F747060D92A23DDFB1AC2E4DDD4A15D1A0A17C0B