Type
CONTRACT
Validation date
2023-11-15 21:36:11 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1700091360,
    secret_hash: 0x291943BAA33738A0DF74BF2D1FE2CFB27805BE675C9903436232341C8AC8B48F,
    secret_hash_signature: [
      r: 0x08C1E5681257FF9F813D6B003F9A37F0296EB8BE84F2729FD7CD995B52382A19,
      s: 0x50BF3F46708047010697DA35E2AC89FFA7A93D7DA9B55715CEFB6EC680CD943D,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    821CAF1C2813CCBE4663D0EDC642F716ECCCA6CFD3A6499C0B0FC3186865BA9E24A0D8DD59FFB6DFAC60DFAAC4A8B6459C1AD51E325B10706EE06677

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00015E4796174663F21D28A471699967D5FBB17E29D9C93189459341E03D5629A215

Previous signature

EC5283844073307F1C3426CEF3E7C76F6479195AD546EA5917AF5415D0DFE39DF4D6ABB55E5F44092B2B71B836F3F653E567C3989D0510C6A4237F589B083001

Origin signature

3046022100EF4D381AF3682D80CA8D7AE3380140D086E0D50DFD71ACD8F2FA374B69524F23022100C84669CE12116B825F4661B4044CFB5AD0BFC411FAAB2D88A27185A6D2584E36

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00E178ECC4FB0A2B17400E1236E153EC5054D91D2693D6A6C04B0EF09F274CA4E5

Coordinator signature

CF01CD62F8B18D78A698CF72303C88F5223753C927D25B1C2D568BDCC13D704E90AC22F52DE6A9B94DAD08BD3D9F589A01206C3FC5535AB6F65CDBB749688F0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0FBADCE1A9A92E4260BFED30A67B1CD609D04408526096D570BC81B0AD3A87A7D614CAC1226FCE644E23CF6151DF5B0CB4CBB65A15A6763FC97FB70DCE147409

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F250C05CB70385E9553632DB62CC882D4F82AB37205700811452A4C7BCA9DF57507FD4FA79F7CA65BC9DD054ABCBCE590FBB6BD361451386046AC645BAC1F30A