Type
CONTRACT
Validation date
2023-12-11 07:03:09 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1702285320,
    secret_hash: 0x83D10ECF32DA50E4048E0962BF0C881922192DFA59889F58F173D36D32D14CE7,
    secret_hash_signature: [
      r: 0x527E1D7BF7E4903114BB702C91A8CE7C6DDAFE61F9F6F8AE30C3DBB5F08BEF58,
      s: 0x4799D84D942A040FD1B976C5CE2CD1161E267E2EF415870BE97BD2C7CA7E23EE,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D831E4842107AF7D4EEEF34AA731DEB2C537A0A6C0CFED5F9F2EA6BC0D87739FE5707D9149B9DB7236D1C9BE37FC9ED8D610175741DE13597921BF00

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001769F0567AAAFF51A757ADEC5BCBB1516ECFB7984ACD8C841016951DF49272EC4

Previous signature

61BE7A289AC7069EBFFAE53DBC5CBE013B536E6A1D0A7B232D2740619029C6FAD45A7A0C311675626E81001F50AFB6A339BCFE42F7332D8799B972DDFB2C1301

Origin signature

30460221008A6E820579912A22E7E1DD450EC331CE525D908C5D0F9B85D61AA8F736C123EE022100FCE6ABC188A8F32B39C444A7669A84E26CECC22B31C9B4D34BE85A26FDA93EC0

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

0057B3137CB708FDEA723A532C473C3D207E0C334507BBF5CDA3FE85C28BFD82AC

Coordinator signature

F208544E1E72C6A3AD32AF55FDD67CDE9251FEA32CA1833D500AC3C2810E2FEE9771B62B4939689EEE61D4D17FE448BDA980D9F1FA41601DEA50669900EE800F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

64FEBFDA9CFCCDDCF367CB571EE453732B125967962D0AB08803B545EECB767B1840E254402DD72784A6732037073911B75E2F0DCE644B8F49C556D7D9281F0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

CB31F065A778D157BA6988C7D45FF5415C369766EE8E0A6D24DD60AF2A079136DC33BE8FDFE3096BC5345771ADD8D7A65B5BB88EB3B5B1C4400E5E41EE510B0D