Type
CONTRACT
Validation date
2023-12-05 21:30:42 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 54.835,
    end_time: 1701819000,
    secret_hash: 0x9BDF29F9F8E9C88E2BD53EEC62013D156EA02BFE35D2A37F83BD41B85732CC60,
    secret_hash_signature: [
      r: 0xC0785ED5D62B3ED0CBE57566BFB67CA4C6D78888075035FD0F58EB2945BB74DD,
      s: 0x0DAB87F9A1202B2F2E6EEFF90612B4A483F2E87F0FA6F08F9D441D774FEC4CB0,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9992ADEAA7C4DF71B65AE016626A7183A9378B230CA232EBD44BA4928631D4687F191D9421C92F78F496AB19239A23415172648FF527A66C0052BEEC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019A275C09EED576F1A00D2E93895D591BBC39635AEB111BD20DB28F6122F3E17E

Previous signature

BDDD200D10E0045B17208D8C468B7207E144A17A8ABFA1C5AF557A7DEC11E8AE3C6E9FCD5913A4D323A98F09B3F99AA764A17F07097966C3B1FB914F855A9606

Origin signature

3046022100956FFB23FFA3F64B59B2A7407D9784443B2F0103E1C521E390696E876F7F4D0B022100C421BB185008A99C41618B84E7393AA30019A63AF9075FAE040DA6C89CAC0DDD

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00B7F6A411CD6F5DD47C4D6CC8EEEF1A4E861212ADB9F21908A69E7598A2492E8B

Coordinator signature

2F77B17B4BB6ECE726D86C522563C255ADCA8320D41ECB7B68864270BB6E93844E8D9BCF1F8FAA7160CB26B0CB06FED9676D174549BBDE106A7E31DA1876140F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

83BDB21478E08AF9E3EADC6525F062005708D6D0263CF5F671E3A2A15311AF818F67F57222ABDBFAB791011D37A9E26AF06108565FB5F1C646CDDC2F6E295E01

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

6116DDA81A534209B241173BC96BE3061EAAA4F5725D70210B2B90027094E62906B9E71852E34E0BED0501894BB10D7C7E37F2151ADEF91357C312277AE1060B