Type
CONTRACT
Validation date
2023-11-30 16:09:46 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1701367740,
    secret_hash: 0x9BADF95DC37B7FEB67E525A520A17F48D5555E92E9BEEFBBC474DD81020DAACC,
    secret_hash_signature: [
      r: 0x54485F1CD43CEF55E2E5CA23EBFA9FDA25E59AA1355CD5D2B43E9D4F19CF03FE,
      s: 0x2047272033DDB9C78AEB4B34E37F376A1270E7EAC56681C5AF1E1C7237BEC857,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A7D4F8EB89CAA4D523B254AD77686330DB74539082302FF2B1E61B6BA9D4FCB68E062BA5B438A84900F6E06B24A2EBD8F0672C7D4BD72AC07F36CBFD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001168A0551437DD875491F0EC79835E0FC2EB4B337DBE61B8794A5B6FC3FEF4A52

Previous signature

4BFAA9247D7E3F9A47CB2370C58CE8DB01B02CDB1377E2634258E09690F942CF18649482BE2028231834CEB5FA84771760426902B0E0EBDC02A9ABA91F81A601

Origin signature

3044022008B7D7311CF25B46D40D7F1364B65C8EA6604AC96B95BDEA50575AB77A627C04022041C037F92C9E59E261D9C6128F18F5254FAF6A1D6AAAF8A06EDD49360F94F2E8

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00D0E854144A4DCF9FE3064FD7B4B9F67D906168A9C87578B08A5FC7E78EA57816

Coordinator signature

F86379722FB207DC9E60E29ED5EAFB5F90C3FCDD52452428E21373A08B126DF477FB9F393AC802793296F0C36FA6B88354903E14B1BC8B09BB75388EBF49E605

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

11B5CCFEB153C58B74EE9B1CF599A6FAEF7FED82740E2CB5F88F0FEA3960813083CAE2270556A06648B5796A4EEE4628B855355600E9B5F7A80CCEAB412F650C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

21CC929A4183458BE0680DC063BBCA5C52C3974691E6A55ADCDF34E5A1E3FA4873283B52165521E738065FD4778F5A1CB2476589A56233B275D5D73A18A4D90F