Type
CONTRACT
Validation date
2023-12-08 16:15:03 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1702059240,
    secret_hash: 0x8C98B5726A352307D921176143600419E7B2F6CA53938EE924A9F4902CD87AC8,
    secret_hash_signature: [
      r: 0x1CFC2451E22582AA306124839F689CE31A255DEE6F3D0A277DA63FB66FAB8CA7,
      s: 0x3216C9E382321CA8AC3DCF1A063F017F19E6C5969DE5BCFD1CFE25B3662ADA4E,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    70953133370AB955FE3B51B01CC22DACEA8157A48FAA4D60B66A4A1A4E591542CB1F810DD1BE73AC635E2A05CAEBAFA4D4C29F9826B09B9C751780A3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00018BCF4BD0EF703A8BE3327D26A2A84994DB0AB02CEB781D92834D29033EEBC20E

Previous signature

47E2DFE1008F9AD88EA8214C2F9584DCBD62B191882B8ABFDC05FE233902FF5B2B06A466DAC111EF09224A020F7ECD2ADA0919D7FF16F89EFB623E6C8C45800F

Origin signature

3044022065092EFB340BD4CF8D83F5AF992B6FC201F5C5F052776217CE4C04916B1B759A02204C17301D04EF8489CCB1B1F31ED940446F96F7FFAAEB3454CE097B5103C2B2DA

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00336DA206B05E89D222E310C28004522DC965D8760E332A48F2F28ABE9F6F04AE

Coordinator signature

95F615B308826341FC2A6CFEB7B73F0DEF1C922792113E61B9BB8D6FBCCED00C40E849D8BB8B86690F12BFD9791C0AF3757B53CC8320851C34D75E955F7AC106

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

581F31DBE6B9AED0A5A133F452769BF33F6F914305D3F22DCF0B1E58F401581095EA3CF00E1AE6DCB30A00B3D2EA54D2CEB95C2C0D7B8EEA693C5FA9846AC90E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

3FA4713424D56ECD1D2F8F9C20C0DB3996E19719CD90E71F5F347FB28035D91A88135CD70255018F4B087E9F37125B461D3F00BB3CF291B6B36195B93B2F970E