Type
CONTRACT
Validation date
2023-12-02 16:21:34 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 19.94,
    end_time: 1701541260,
    secret_hash: 0x9244B6392EA41B78FBC6C126F33C2F47255CFE92F9B5375CCB69F6568859D7D5,
    secret_hash_signature: [
      r: 0xFD88BDF67BC7AC7F1E6D8EF15D085FDBF4B8F1E2BF155D5457ED6C96FE196DE0,
      s: 0x3175984CFC872EFD01A9BF22C00189F92B533E144CC42AB01C8343E32940C611,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2EB7DED5A915616A6F3F13930A265823E7DC76B4207F8DEFF71B8E0BE9F8EA5237B2DD996BEF577A8B0E1D403B512A35ADE0B85987988E01D90023D1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011F0A81D607D8EF7720A0CD421356B6B68DC13FA6DC0523C49DA1648A1A5D7513

Previous signature

BCA8869377BA0FEB33EF3473B152570F1831C432413E263C110623BED4D565E878C7FFEFE9D166C581EEB78B95373052E4E9621097930AC7BCB81E36CDF34105

Origin signature

3045022100ACEF5D2BC9F20B9C4B307093C43C48295814F7E9BB81D6DB060DE227718DDCA40220591C9C5006EF78F26E9C5CE4021D08AD116B9AE9AF2BB3C3817C69580F70967C

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

00AC0F20D2AF3C3D3F44E0BDFC401D461C514F347DD0D3BC1D7AF8F7FAFE2A243C

Coordinator signature

E06EEA82143CE5933D598ED0336465BA651B83BA2D840F4C18274BA5C800598C2C82F2B087033F5034F4F2ED85D377B2B3A0E4133B45F3F7649E3993698DE100

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

BF2C7971D0E965B7D89FF1FAED36934161CF8295E08FA18E0C4A57A5B38E79F5351FFF8F79F0E45DB6CE2D827FDC38A743628421B9FE967708E0022B6EF91A09

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D4C0967BFE04211BBB89F17DFF10C418531A8CC7A717E93EB3A46F221813A0F99219F203760DB6E7EA9D5AC5E421D38691100311BC1356F88870FD252006610F