Type
CONTRACT
Validation date
2023-10-20 10:06:06 UTC
Fee
0 UCO

Code (873 B)

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

end

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

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

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.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1697803500,
    secret_hash: 0xA3B9BDF5B7C14083564770520AA64B16F641EB7319307A158AF4C156E5BF8F2E,
    secret_hash_signature: [
      r: 0xA91CF4E938F02E785BFF398F4F5957D19310DB5C4A518271B92A962831E2B6E8,
      s: 0x03C1BFB0D9E449407B751241BFD8D01508DBD91FD0AAAF48EAFF99A56B0781BC,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2725BB5FC758B74C602099EE2B1F1281380DFA1ABDAAD430691C72A72A2953458E2DB932C6DDFB86FC7265336A7D6DBDD4798837E599FB84A861B6DB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00016F363B2AA90350BE1D1A75196F94D30149F4117EBB7A88D6C2F6AC57B3CADDF7

Previous signature

1C891483B14D4200F2BDECE2825E10BBDD16B97B90132B1ADB5ABB5C50855AEE7595CE46CEAEA43C32DCB55C226BC732FBBAD0D55592C9CAD2048E6A640E4F0B

Origin signature

30450220229F28DE59BB694705E10F27F8EE3A40B4874CF8DF2731BC892146504026144C022100DCD1B77514F063AFA4783F305B0E16DA03DB8B0BC5FB930D8ACC99E8AC6A3FD8

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

003BDDF2CF27E129CC14701AB77D1CDE20BB0B46D99A69CEBDB2CF60964E6D39B6

Coordinator signature

3BD0E32A6CEBA07B68E372D17DFA8A21ECDD779EEE755EB3B7FFDE8B4E15006A0C3FA702B53DA19E5BBD5332EFF78925419D64879944B9BA21CE8818CF1E6700

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

31AD17CC0604C6C3F80C37FFDDD58EA2A44A1B1EAFCD634244A67E055585B8D2E75EC9EB83C8978177405B8771929399099657237DDE8F589837FAC79D22420F

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

415E77ED5FC5B7C0D9F691BE0C3AD05E54ECC0D638AC0A68D58E39F4EA95AAB5423B16CB94082F570C68C6DF3E6E9663DC0271EC288578261592A7B26650450E