Type
CONTRACT
Validation date
2023-12-09 13:02:41 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1702134120,
    secret_hash: 0xFEA2DFE93CE09B09BB51DF4416D2EAEDE7275268A27AFFCED36458909539CE0D,
    secret_hash_signature: [
      r: 0xCC0427FC04E6762C9189ACDC43119EE0869BC22752CED93952AB86895F00E6AF,
      s: 0x4C57EE8A2AD73F9DBF3AAC27F00B9439386C10FF84A5A885734D71AC17EC1096,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CD60B46EE688B18523A809B0DED7D9032B6BDEF16B16BC057AA555B5B81CE7A7E8E4E3FD93663C8FF2821B1985DBCE83E8FFBB61304FF07C9FD92C2C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C32F029D2B862ABA549A13857EF006E8DCC7DD8CB35509F638274BCF437DA0B5

Previous signature

34FCCA24E0CC5D8F67247275515A2194D88317D716FAD84126F6B71010255CDF13EE06A92EDA91FEA301C6D1A5D6749C4A1A94421B4DED960BCBBE26BFA8FD08

Origin signature

3046022100EA63A172CBD4C5FD23278FE2D3AC1D84658AA64D84FEF1E341FCF2D39E6E5DA4022100DD2CB88CF3F9448AF8E12BB744E183E9062A1677BAB50E3B6E4EF8A51B4E859B

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00CB788AC3C8DBDFB65306FD672CA9C82E1FD448F303C0EFB67DFCB5B0853DC49B

Coordinator signature

9872638D9A6C7D4251FE99319B4B9EE3BDA213B5C82A3A02607D671E9689C429B1F1B3E638FDC11B279ED846C2B1263070F302613072AA83DB439B26DEAD6601

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0F2EBD4655B6CC26C36FC25BF69F486157748B6E62BC3E175DC4DB5D9E8EECF8910C350D809A9D4A671FB7CDD0893075D8BDB293A9D5AB91ED1CD956A2EE3407

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

F1FEB0588172C731B397AE8FE6DA745F29D5D1DD3BD6109AE521C1D2C6D487B0D718FE9D41207B2034DD6A89198DCDDA4F62D8BD05432402F5C998DE5A493C05