Type
CONTRACT
Validation date
2023-11-15 09:21:20 UTC
Fee
0 UCO

Code (928 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700047260 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 0.009, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 0.009, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1700047260,
  content: Crypto.hash(String.to_hex(secret)) == 0x46B32CA6FA684587AE1CF9F32038F43D70277F99D3329003A2BD8A6E7D1F6BFA
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.008973, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.7e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.008973,
    end_time: 1700047260,
    secret_hash: 0x46B32CA6FA684587AE1CF9F32038F43D70277F99D3329003A2BD8A6E7D1F6BFA,
    secret_hash_signature: [
      r: 0x22F462DCC370A39162BEF6B4CC3E792D47ABA7D9A5CC13EF1CC02005E2A8B1AE,
      s: 0x7ED6507805F49315C4115BFE9094D99541425124D59D02B95B157F5068311F0B,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    BFEDCD300BC20A6808DB270C4F694A2FE1AAD8AD74AA800E0DA4C0F3BC15099133885A3C613A5373BADEF7AFBE04AAE0EE6A21D3D640F58C600013DA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C14A4BDC3EE280FB9DA9F641714C41454A013BA9720A62A0D40BF1223B090538

Previous signature

30B3EB009F2549A702918A37FC9C41A4C22A617F5C1C5700699CF3E6ED379DF0B8B5A60C0F0F4A8A0899AEFCB5522D53B87C12EDE72E6F981B9A16859DA27904

Origin signature

3045022078F3A4D771E14CD7A3111E998971625ED648A6410C57B0833AA0290EB229F991022100B92126EC3B4F332A0F7CFF104BEE39E19E86939A5CCA8254AB72F0F74D3E53F7

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00387D317FEE08ADF8A7B19DD7A151AFBA4DEB41D244FB482BE8A9E6AA029351FC

Coordinator signature

BD8908A145F2DB35CE277B17C004A24D2C043729A9B474E5752118B4A1063DD92BB0B165FC301D0AAFEDA344FEEF5160047D23C27ACE85C60308BAC1E098720D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

273C2B1B397A8FF1A9DC007ACD9EA005E766EA07B88387E614922CDC0C1E324EBD43ECF0814664773005A21B05F2733454435DC8D9412A54AA5273A652523209

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8FE8078D973B79BFF59C057DC671A05A62D23A92552B224EDE791EA1CB2C81562BC423A53BFA3450CB9D355842B58350419D9A700C44BBB3D7C9481DF23A8E0B