Type
CONTRACT
Validation date
2023-12-28 21:26:35 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 6.979,
    end_time: 1703805960,
    secret_hash: 0xBD657631053223075DD72FC8992265AA6BDF95800CB98B350D38F6D62A8B5E8B,
    secret_hash_signature: [
      r: 0xBF889E4633AC36F96D4E548487876AD5A850590D608CABA3899D5B95925CEEB0,
      s: 0x1887A09D5764848BA9B8F34833FB75BB3EA4C2921221E684EF1D425D3FC8BF59,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B88EBD4C65C9B36B91AD56BF5AD7FD8F3A5E1A48908899F7421C002FF467B586781A3AD0625D4E96BE6947D118195D2A47D5E58F57C4766F76A070B3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F865B4BAF1F7585922180514298DB48A6F03DC3509845CC17D7425EC86596345

Previous signature

DDCE6ED11279F55425BD93B10C27E7CA528E2EE8186AD8C07663508E6759DE27CFC15EF4A5424F0F35FBAB93FF600E0697CD34F8DD972F91741F80BC8BA61B0D

Origin signature

3045022100F64E9CDB815454AB7CB5EA03134C082A4023BDFBCFED5D01ACC354A5243E76D802205FBC794B0C769B475E3FBBE10DB6D63FF792E36EA6AB91383E4B3354B8060FD3

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

0020231FA2963F8906E950287B80D84E04C3BB7BF2360363D44A67551EB09BCDAC

Coordinator signature

C03BC3C181E51EAAABFCA76B326DD8C19A4A43B1AD95B304DC8110BF2887F120D6D57BC0A870A0C301FF6FA94DBF411131D819B36DDBED243EC9CE5E5777BD0B

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6DD60914DE2CEE3E2232787690056B2E27864EB1341EC003C016D287B40C3964D5F8208677D7D9E0976CC0FB4492E9645A5454AA042B3BEDA13043CF17ADF200

Validator #2 public key

00010F2A0E4C424582A94BD90E05FE6931628F91988ABBE387D365994F1F3FCF5A12

Validator #2 signature

3940D6A835AD942371FFF5E2BD3101AE548B6DD114CD1416B06272065FFF55B783548A477EAE6A663713019D60FEB4AC09AB97C5DA339C361C1D212157F6D809