Type
CONTRACT
Validation date
2023-12-08 07:08:23 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 7.976,
    end_time: 1702026480,
    secret_hash: 0x0255B2D08E8D2E1224FA3CD59F6D2B151BCE58CA82EBE0420EA4D9603EBCEEFD,
    secret_hash_signature: [
      r: 0x0226B73BE6E763F3E713DE4971E0174A0716C6DA0C34A3FE6083DC7E7CF767D5,
      s: 0x61A23006D319329AA73055E91622EDBED2E8D7CF72D8202E7ED6645672AD5A84,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9828BD07C4F1B64F43488AB50431F9510BADDB2B915A67F5EB46F9DB6322523C5E85F702E40EDDFD8D5075685A05FCE5D4B9E935DFDAAC83FF8661BD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F23436EDAF821C3E5F50374F19F3A934BA964B5EB164CA7AE3B440300B38E8CD

Previous signature

55B48B10F5CF13EFD2C9B14DBDF1CE05819DADD6B89FD20526622A63C2FB30FF9985DCF72699A14EE98335D2E92892C64DB6E46DE4D31A21871F92690DCD5C08

Origin signature

304502204451CC762C5218380DB1E2C423FD3E4D0F4AA69865F605B55FCBAF865C714F7B022100A5E12283376124FA3D64BB6DADBF7F1F5877B9791D641B394284019E7EA4AF68

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

00F52BB4658E2A978680A4CAF7753818AB1CC0423A09B7408986ECC9739319CFEF

Coordinator signature

5826000C39AF381320BF488F231BCB9CB20800C63ABF15BE683D1C051BD288979F01ACF6201E516023B7C36C536DD2485D4837669B036284BECFA58C7583DB0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

7F3E709108CC3071A821E15756BDAE225189CC266C51679D9C0E924FDA29879C43CEBF81860B4806CB9435F3DD451553D725D8B575FF046C38085F003CAAEB02

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

1CAB7A6A82BD8C3EA3566F2AC2E7FE8AC659797D2476BEA56B8B03EDC0BCD65041B2867C0381BAFF65AFD4E8D25B0D887F1521F1E4E148DEB5DA27BF9F190A0B