Type
CONTRACT
Validation date
2023-11-29 20:05:14 UTC
Fee
0 UCO

Code (872 B)

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

end

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

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

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.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1701295500,
    secret_hash: 0x7B8E18D1FB365F68CFA6DCD64874F829475C34D9030D1BEA138A34FDA660C666,
    secret_hash_signature: [
      r: 0x20B8C9C383E6EE04670C75A4154556AEB80C64EBF80AA471858377BB0B246870,
      s: 0x4A54F4364B3B1DB38F9EE1D74F71CDA594C0622A70E3D141979150B806EDEC85,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    DC67AD7143E303D40CF88396D7EB06D7360F663C5F1D783F964AA526A6696A03BE20612E4DFA84C59617CBFB1DAEDA9982954E2CF1E155B425C8A62D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000179F64BCFE037EF1E3B0D79C7EE8E7F97216E7B60113133005A1E6B11B28D81C2

Previous signature

4833D06AD755441545099D00B2F7C2490C4BA9BAA64C5ED4C0851AF2DB8952AA1309EE74E20B731FECAFB93B180CC66D7721A74494C3766F8BA38DE7E7925501

Origin signature

30440220647FA13C87A08C5FD84CF748B3460A293BA8651EFCE9CD5872D5FAB76E73FC32022026E2F5DA2FE63F203A7EED04DE0E500607F4BE32489835AC376A00A255A31A52

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

008CB2AC5B91F99CBB5A0EDDC7F23F9C092C7FB2CAD11AF58BFBBD1645DE08D958

Coordinator signature

EE264005D8B400EACEBD15FCEC15B47C2B1E99F531FC87DF0424951249248860DE7C6EF8D600FA066AD26B2FF4F3BDBFB1653A1CBC8FFCBE6A7B26973A904E01

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

D06555EB0DFCDA59F2B3FF7BB2347D8B095B4B9EC862C608DDD3BB5B594393C9B2749B2FFAC3CA348E46DCD245BA095EC8020315795D25629D5C1CB2DD0C050A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8FAC3B0492B7C8CB7877A080ED418405D52226453422005B9EAC21BDEE720D2D4CE3F5F565121434B1F8F2A5DEBC4E9C2AAC095827B0397B241536838CE33B0C