Type
CONTRACT
Validation date
2023-11-16 23:47:53 UTC
Fee
0 UCO

Code (873 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.99991,
    end_time: 1700185620,
    secret_hash: 0x5EA1676568DB9E85C74212B856A01A1493B0809DC1E4411738F3156E35371140,
    secret_hash_signature: [
      r: 0xAFA4A74E01E83A5CD5816FDC85E3435E31D05A0C9EC2B7EAD0D4709D84C12361,
      s: 0x35A206B8A7D8247434716EE5C437A61C44C47F33C8DBED113475B27A54E63BFF,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A3F89776826D3EEB5455A6E52375FBB018D16A2AA6A5D2EBFD70D80001D8FC1CB0F299830E2EC6FA523F7A35934DA7E9CF71B268EA38E8B24D63B275

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C6C4C73CEF089CFF063F44390CAE8873E037F32E606AB893C89E0C2C158C3649

Previous signature

9B00E2F7B73D1159A34E0E7B882FFB1A4E7539CCB2906F546E230AE0EEC8A55FE2ADEFF66673467204875573BCE4BB663634D7B564DBF5F6E11FAE7A62B67908

Origin signature

3045022063B12A5CB96BA94BDE28BDF97DB920F07A8086273B3F76D7CF53014A514C3A93022100DA8C05EFB86D21B016998A5C26FFC7C9BA5438350EBF0685F6900FE4F0CF95D4

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

000E0202F006411AB0DB5B5D5787763E195E16C61A69A7313FBEBC8ACB4E44EF92

Coordinator signature

5C568DAE99E9DA16C5B6D5A7466964F752B5B21189709C1ED64FA59474AA0C98E8D039C837078F9D04B936EC10A9C3D40C03178015A76E08219C8D5BF3E2DE08

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

34DD845C85C5A97FD83A47FAAA06F9278E1243839C042ABA58F442099EE35694DFEA15A375B6564811C8AC7831DDADBB7887EA6D7F75D7B79D23DE00C5413202

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

EE0B5A85063263E0B9CAC7CC809D8557FC4BFCC4F855CAAA8F000576BEFB43107903C917DB4EF82C20928CFED2056EC9CE7B3842BB2D2DC33ADE3FACDF03CB0B