Type
CONTRACT
Validation date
2023-12-01 12:57:08 UTC
Fee
0 UCO

Code (862 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1701442560,
    secret_hash: 0x5A48C3702419E433A4053F46D4A6D8F7049F2F033A0301BFF21F0854325BA254,
    secret_hash_signature: [
      r: 0xFDA3CD3DAD00B2FC7C4BC376F56D867C8D1002720AA3B18730FA644E1759EE61,
      s: 0x5B649BE240B4B3441BCB4D44C4E0AF656801CAF62210756DD7CAF4CCA9DA1760,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    437F12C4F5676C9D9AA6FF3943C9EA08715A0C15B79B76E5488FE83B4FD6A95DFD0EC16256C9C0EB79ECE454A718C6CB6DD973E5C2B69C3ACFB0D387

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000119E8552FA0351ECCCA36F2441AE3F6B2CFF0485B73C541F7A2B6F599E81B6866

Previous signature

6D088E74304384E8B70F039124BA834D48BE9070BBE1AE31C06A8332B9AA4FFFE04021EE827A4AF4F6B3F7217126293A3569CACF6D6161E28056345DB5E2B601

Origin signature

3044022051808EFD28204F6C47144B51C5ACE414E4612F7BF5DEB60A455BC17232F6C633022056B5E89B11C8C6AC458EF60DA48AF5F6C95B96408AC0A62027AC8274E411A057

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00708138AC5A62EAAE1ABE7CB713FFD6017E5F5C655AD870F71EE223C3F03E20D8

Coordinator signature

5C4E07EAA66605E660284661FCFD23161FAA0F98B50683670281D40F4C2B6CFAA299C073B7F64B1CFB68E2F9796DBB205D480C5B2C431BFFB961B04CBE2EB609

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

359B390DA8EADCD65186065702047BA04A98DE86027B8E6BC30050BA3157B3F376368EB98835942030A074F523331106CC84899F441F93D5BEFB78728555FC03

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

39A8D36BD97BF43EB358607BF5F26DAB808D49E23016641F88450C3BB4E6985F1A77FA452A3EA6C9CE4C391B1EA85AF6BD5666144F4D1034313ADB9D635D9C00