Type
CONTRACT
Validation date
2023-11-13 19:20:34 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 1699910400,
    secret_hash: 0x2F31F7043893BC94E16F163823C608DEC9CB34D897A6A26F0052CB674295C1A9,
    secret_hash_signature: [
      r: 0x5312FBAE587E9137088B46B49E2F19A020C83F624EC54DCB59856BA3C7FDF0C5,
      s: 0x34B8BB68BFD7AF2825C50BD74E8AD3C3466F6098B577100A1A377CB18529E834,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0C53F5FC595F6EED5FDB25FBFA5A1C671F1BC0023AAA1E544E1BC39AE2B305FE6C4609C47065EE6AC57A868AF5BD3B45FBD74565DCA7A00168BCEE76

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EA73212B28C34F8749EFCE44421240720F73422F02C8AEEB731A96992B61E730

Previous signature

15005F32D07296E0CDEF1C8514B81DCFCF8134801EB175B587D0A08EDA105F527F5E44C8D6AD086741F83E851F14078838336FC671D9C240DC2920D730DA3408

Origin signature

3045022015B9CDF2B0D76AF3F753F0BA607686611F26591281E1B8E6A18ECC3862B32081022100D8700B398FAD4B297C447DEEB3A08A58EECF44F8A583E848C360E4229FFE2F18

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00FCEC3C863B4557BC93AE48ADF03D1C5FFB6B22AC8E2C05FF5D8DA78A05BFAA8B

Coordinator signature

A430C9A738EB518DA6009FED00B0A79D4EBA389A704182E505F01ADD137FCFC07A65BBFDAEDCEF1AF4B1A4B98F403BAD5560F0C2A8DEC2528C50B3CAF062C009

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

88A4D85AC01696BB1706957B021A23BDBB065177DA894FB9150F9F750F366B3C712EC91BB9474414C3F72DEF3BF482B9FFDCBFB61519F8C0EA785B08C1C0060A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

4D40BC1C594EF922594A9DB0D01AA4E65AD7452A2F4DB1DF4885CA88C50899E5E4CA1A7496713DB217DD5BC4F2F4E84E79444687EA38C628EA338AB74D3A580C