Type
CONTRACT
Validation date
2023-11-16 15:43:35 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1700156580,
    secret_hash: 0x9FC6167AE154BD630D0D14E488AF89B4C48E589D787BA06FF2AE9668D0949C5A,
    secret_hash_signature: [
      r: 0xF6B9CCC3CB6ADDC8648F4C2328A7707522D360F181CCF55485BB857700EEC117,
      s: 0x34A4E9F122EA16BDE8D9D02AF038F490821B4BD6646155F423484128AE67EBB1,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2830D7E84510C40FEC2BCA7E972627C54DF5C0A20AF4CF45D1A8AD08C4EE7649E6531FF186C08E93C9C99524138A29384B9752D5FA497C6DD3C39965

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EFC5BDA8BD4E3414FF3D2BF7BFC238F1F7BEA384E8E621AA7BD78CF98CCD88E0

Previous signature

F7FA46CBE62B2EC3E6FB07DA7C69714A9F633B1C4FB099D471E369DCBFA43CE6B0744C30EA2AD2126181F48E1D3A5A66395D89656FEC117BC6DD00A834A1200D

Origin signature

3046022100B303F67F77477E20422531C2BF95782656A241CC57A1A29C02F983C2649E8A080221009D92F722B37B835639F697F39E88721E0AAE2B7956FE1AFF59218FF145F20C34

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

002ADC2C2355390998B26CCBC4F766A0A94A33627E8C2B44A4736C6E55D326D5AC

Coordinator signature

CEFD117E6BCAB479108A95A480A0E8352D84F2627C017563E1E3C3C69EC45A1C2E6703DE656C59C62C3D7C11542D5CCB6D37505ACA7DF23D4EB7E195AE1A630A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9614CE31E80710170DC4E8F3DDF3A3162F13966B881BAA25D472CC6CB9D792791B7FAEA17E0239812381009098F4CF71106904B600E6569105AEE9906F8FB806

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2A5A5258AB338E8DBF0C20505C5DE168CE9D06B2B282592010F48EA9202EBF1CE7D395EFF3773B0202F6D7EBC12646B080C0C925E86BC63EC0372F3D788EBD0F