Type
CONTRACT
Validation date
2023-11-30 18:34:21 UTC
Fee
0 UCO

Code (871 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000087EAA67B7F82452DA9BEC9A80FAB2F43D8A5E4966085ACBCDDA89B939F039AF1, amount: 25
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 < 1701376440,
  content: Crypto.hash(String.to_hex(secret)) == 0x2EE541510A9BAD468962F2000AB9A94CDB320388551B719368E06D5E94076C0D
]

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: 24.925
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.075

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 24.925,
    end_time: 1701376440,
    secret_hash: 0x2EE541510A9BAD468962F2000AB9A94CDB320388551B719368E06D5E94076C0D,
    secret_hash_signature: [
      r: 0x9091D094F104965B8571122ED8BF8AEAFAC015C484373AA149F62EA5CE9FF9AC,
      s: 0x55E6C2D3BA4BE67B7E947BEDDA08F118854D2C2BA090F63E05CDAE9F4B4588DB,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D02D8AC7A40D6E016F7E80B128F898C1ECCD2D78BE8A216F578272C9BA12F210063A80C4216C2A2468476241AA402FDA803B5B976CC544A3D05C0DF6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F240FE6A74BFC8F6EC9CA08CF972704BD34532ED075FCDB28CAD8A5C6468BFDE

Previous signature

510D88290EDCB91330053D42A112211F4BA5AC319C1B252A324F5BE8186F059BE6E98D242A21C24302C28E8E3DF5E89DD722D57E128B5746736B340DFB7EB20F

Origin signature

3045022100C5D6A531DEC392CEE20171A3C3F4EBF98A6AA57AA4730EF0195B7123DA25ED6402207C86CE11D282DF5003B60FF438B4876E39B451CACD398AEDD0EB2C44DD3A3217

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00242D761CD277F69B43283EF7E99B96DE100EF0FC50BD6D66ABDC0DF551C73CF2

Coordinator signature

E631DA20A7F36F06F51655EFB33F8B0935E49C6722A6A0486EFADE3EFF6AA255626F764536C3EF61549D87F8C279A756DE2F20CF86064E1B86F7B18D4276670F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

3EB11B2BF5018A410F84440370E9F63F379072DED60FE308224F56081C491CE88EF5AF0A5CCC665032666F52F31DBE80E85CE8DBF26A3ECD18CF9407F2D0E106

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C6CCA661E58F805FDEF820C44F8AD56A1B86DE9541CFBB9165B2B18315AA9E75D3E3FCDDD94560DE86177432CB64A8DB12497874C2EDA42707DD738219A83309