Type
CONTRACT
Validation date
2023-10-30 15:01:31 UTC
Fee
0 UCO

Code (932 B)

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

end

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

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

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: 9.97e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-7, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-5,
    end_time: 1698685260,
    secret_hash: 0x669439285C23D7AB40C5A5DC3F0772CDC4342807D2F3C6EA919932A78EB47FF1,
    secret_hash_signature: [
      r: 0x3F172154420B647981727EBFC1309B2B4B0D2B5B80E6C07DD73D068B4DBA4843,
      s: 0x3F53BDD79C6891EDDB7CD6B626740FE7C5E8858467B13C71A38F2959AA8D45A9,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7507607764AB9D39369DBB4EF4EB639474CD57A39B949D810F2C8E743AD64B4EEE60EB69BF1EA4E165A2A6D9AD06C00ECFF08BEC73B535794C9A3D90

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001905D742915FD101862DC0A60B76DC3158DF41C0A78A0390206B32183446C194F

Previous signature

089A01495B5EC861B3AD0A6807EDE18735CCDC47AA20AAE77D20EEC651CA5703325549165156E0B9B0E7FC3417EE2F604821E51B54A2ADA4BF5F9BB8EF6E3306

Origin signature

3046022100C0628EDE75E867174C33E80F023A63405EE8B642E7BF1910623506FACA4FCDD7022100DF521E0DAD0DD8604259F0C1395636655D7394E9C5F8A1354BE6945E863CAF64

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0022E08FB44DC7EC4DDB9FE03741AD7326EBF0C04EE8FD520FB0C70C235C0EFFA0

Coordinator signature

01C5613AB90381A1F350AED7B5C448BEC746D46610CEFC3092B6058CB53746F6A86388D0F0BEB62CDE3EDFEA62F92434D62BA7B6B9B7BA8EB30B38E564191D03

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

77C0967C081FC8451D7CCC188236A48ABF39BA52FFBE3A1D9464C503B49F5A1FA1707A5DD09DA64FBCB8BF46C3B4BAC712DFF78B8756379EF58A2C1635AA3100

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

11BB9FE78A7790D28E21391B9E8ECE889F272291A8C37AC9E79C2D5AD94725D6D8B3E57A2406F09A4844028622809F79B95C028F8DB16A9D4C0A34A0AC54CA06