Type
CONTRACT
Validation date
2023-12-13 18:24:12 UTC
Fee
0 UCO

Code (877 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 7.45694295,
    end_time: 1702498980,
    secret_hash: 0x063CE04DE6A7A388D55DE24C2D1F557857FA56C89399A611B76AF5A4D2DC3D79,
    secret_hash_signature: [
      r: 0x3120E7A65830905C52331BC06B269CF3A73DA099C63106ECA86110C934392B8C,
      s: 0x56A63B53C61B7514A2395B2D6223EDCCF60C952DDAF0583384EAEC4092AD3978,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A73DC109519C39C6E03A8CCAA36E1C0E8C671BD25FBF21FC8F54DD81C99B82E247DE1CC45E4919EABEC6E7566D84F43601414B51AC099E9D96DEC650

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00015FAF3B027FD2184FE6ED5EAF4671AFACA3937A30D487462C81B3EBC26914FD2D

Previous signature

DCB29DFCA3A9F7767F2BF8E9BB0DCB410648CA591C75C68A08BCB932FC53836DBA81923B51EC869C9211543A7746FA7E20654A9BCDBA53D9A83ADA76B493C70A

Origin signature

3044022053FA543A0A09ADCC121624328FA5084CAD8D566AC5D8DCCEFE1A765B4BB8424C02206EF9657EDBC9E0D0FCB8F45EEC74A18C2C6AAF58146AAA904BB5F56960F4E363

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00B56F8930269855DA62FD08896EE69EAF7BD70783A8B5D3C6D5CBF38025BF4E65

Coordinator signature

6F0CF56779AE0FA8EEEAC0D7B09B8C33C0ECD346E6805B8AD68A244EC92A63A6FD0A3999AD20BE566A930D6A3C73861475B040D6730171175A95A1C8509B050C

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

479D6AFEEAC358BB55763D2E8A846F192F1BF2DEB724F837E3309F2982B157D0BFE9636E9207AA1CA0A9A449A5B4B14A74AA72A64CAA15F13EB4E8D11165C20B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

150A318C17146C95A4AC79A88D43191BFE3D320CE4438F1032BAA496C7274220E22864B8219113C0B64E85032FAE49ABF442C2D51E91167E90CADFE9EB7CAA00