Type
CONTRACT
Validation date
2023-11-22 01:31:46 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 1700623860,
    secret_hash: 0xF990880DE48FAABA5535D1A7FD010B39DCFF6DBB7D2301B325ACE0A4627393DB,
    secret_hash_signature: [
      r: 0xDDCDB5F40FE66DC5E0296E7E19A2FBF7F83E3CA6167BBBFDF5B49DA304BEC482,
      s: 0x293C3672ABE7EB995CA8E12D7E1E89F65F50FD90CF09D3B641B3E47A53CEBA7A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D6028A3CAAF53549A3FA447A1758AE8857F9F64D9C7B78745327D9466C881CFFB786199B99E02F0CBE8868D945869DF96A16BDF1B31D96EADD99DCB7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001ACC89A015C887AC97922185B0A0B0BE7A95F1E4D44534941909AF52CCD01A387

Previous signature

9C59A77B6A581CB2E0CC3BFFEB5AD3CF44FB68784B49B3FCBEF9EA143896C5F57272628F1EE687A7046DF08FA28265F11487433C19C939FE8D935C2ADC628B07

Origin signature

3046022100B630C015694D77D89856B6C0C62148678D0077BCA7B333A5FC7C88A2C459235E022100E81D2139C145D2AF9248B438207C08B5A40E558C0F8E9282DFF788B89A5EFC1B

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

004DE7774A5A42E9A253BAE27A9C3D57505737300AD7EFED1A414EC33BFCBE3783

Coordinator signature

6A53C7BB39D88EB3CFF2087BB623BFD9E2770395852AF4CFC3D11987464A14E9D046EC88B9BA7EF11391605C914087985FFA8BA84B0B30B6B8B230B470A25300

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A3A73CFDE0A758CC7E70CB314A96C6FE53D4674BCFAF981E026285C3132EE52F62B1D74FF4D466DDDC31E953BAB7A1ACC2E6C20AFABBBECA7FA45E65BFF83605

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

27513BBF8E1DF28CE0FFFB6451EFBA5E7DA1C09EF6986FC63729F7E1BA67D7A1CD74BAB581BAB4D1E24ED00823E2BD36D19C1E9E36D3C8A6E565F4F01CE2F709