Type
CONTRACT
Validation date
2023-11-14 20:26:18 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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: 50
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 < 1700000760,
  content: Crypto.hash(String.to_hex(secret)) == 0xF295F97CD653A709CA68C627E9AB4096F38EA482C05560CAE518831FCA37E83C
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700000760,
    secret_hash: 0xF295F97CD653A709CA68C627E9AB4096F38EA482C05560CAE518831FCA37E83C,
    secret_hash_signature: [
      r: 0xAE041C5BA5490800CB5F962EC46BB67E07528879B422B609A2CF51AF303DDBED,
      s: 0x0405F55552EE2F18D665833DB3CB484CC078AE6242556C264DB46D8B59E197C4,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    80D59AA10831BA06C17DFF7349FB475B841436A94552D54BDDB6A50D462C6873B6B1D55C31B5649FA64D2711C5CCF01BE72EEF0865C8207B3EC47C44

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000159C405E04DC2839DD0C012EE765E6394F5A25CF54852E8ED8501F828A8C6E008

Previous signature

BE1C90D5E289A7EAB14340081B31F62E43E090ED0D7690EEEAA96EB5FADAB7755F7473730BD37373C4EF1B38CA4B97F09E0908917BA1C5E2A7C14B26FBEF1D05

Origin signature

3045022100EF3D1DAFE8B637EFF93E7B42122F3A25F1D98EFD5EC08F9D2713DC44ABC938590220412DBF0B1650A904B9343766D563DE77F1E30419C946257B47162EB642B9F0F7

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00AF7AA7188F501D5FB6AF0021699B2FB06A211A8B3EFBCC5BE99C91026643B7C9

Coordinator signature

B179BC45F8BDA8C95CAEF5C4EA911F12D0D67ACCB999E036CD0D088CD54C027D45448202CF4A2BFD559499E64FF14E44DD456871E136F21A1ACBA8C61452C807

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

3F5D796D2CC27FAE186CF61101343E8E54A902562CEE55751C7333C489C07B7BDA73E8B07DD57570C571A8A4F34AC4DB7AAF4B72E193ED1ED2AB91642B833301

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

4BD0D1C236A8115D1D5D4ACBDAF8693FA69ACAEE33EE414174F868A7803805E0BDA3F805D9039009A697CBFE7240D4DBDA6AC7E7C82181D86D5998F768F6D10F