Type
CONTRACT
Validation date
2023-11-30 10:26:06 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 19.94,
    end_time: 1701347100,
    secret_hash: 0xCB599461123B84250144F810C797068229616CDB6461831BAB73638768116EEE,
    secret_hash_signature: [
      r: 0xFA0FBE937C4A250EFF18AC24C935FE6D53C6D5DF24966B4BB5C76C37F1E758DE,
      s: 0x0F794AE5C596B5413699953115D9051F622A48C560D7F527795B029AECCF0E3C,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FBBE1009751A9C6878108F863BE77DCAC5C31FA6954ECA9C16C77CCCE77531AF0B000B5F71361CD289B1C9CFAE318C99519F0567E29DE03A394718DD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001154CF63F1C8167AF7896E3D3DBDECF55C8ECC60FF45C7B989EC3F62843AE48CF

Previous signature

D8FBCC7DE9819FBEE74F80F213CB45E523B5E94CFE3842F4D3BB493DDB25132FBB87D1B0CD8DC1380D3046FE964F2CB5D7FE5F9CEA56F433D668748D11309400

Origin signature

304502205C022EB92279A7893BAD4DDDBC8CB5F8953843FDCFB09A003E2BFD993858652B0221008D891D44E7546E416118B985A3FDF40492D09D9C1BAFF80D2CCD2096FCA644AB

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

003EFB2D98C8778378F4A1DE69923FDBE3293CFEF98CC0B8361772B1205CBB8D86

Coordinator signature

6289311A41129CAD9EC108C846506DD1D460D4B8593158705D5F7A3E633E11FEC442F517C3B27FD174506366A3E1D6399FC9009735D0C2BC860DFAC299E62A0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

C56D2363D4DEF49A791DB2A174B92CF7968EE8C720C52219066E1075551EA61F978939EEDC5E49EA9B328CB5AA9B74E3A12869F8155B49F7A8B7C9A22A4F7D04

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F680AFF8ADD54F534B7F4D0A2431B0B36B9C03FDF3AF52828FE46FF1FE91ECA836231F9B188D5A9FBEFC40518411A6C016ABC7CCA46FC5C85F09430388B0DA01