Type
CONTRACT
Validation date
2023-11-30 01:11:43 UTC
Fee
0 UCO

Code (872 B)

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

end

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

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

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.004985
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5e-5

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.004985,
    end_time: 1701313860,
    secret_hash: 0x90BBD9CE88F7D06FC2A86D914EC6EB1FD297C2608968CA8F5B43BC301C4B8CA2,
    secret_hash_signature: [
      r: 0x8BBDF1DCB504F0BA1E65165CF300D4D5F1F6AC86F3D24C8C35A9E3ECE04A9078,
      s: 0x57A668ACD2617E2A679756C5F513C343A4E97507D999EC090C65A6F7C6E09AD3,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8228BCCF5CD61029F34AE49A43D18D74A8B528C70D160565ADA0B9E80B80B772E89C47A6C3CC4A3FBE8B476759BB08624F101401F01D7D15A9C659E8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001980B0D2E2015154FD5FA4F4B0A8248ADE3AC6A295F3AEEF28912572AC22D6285

Previous signature

3C76B51432AC6376930C730708EC329A21B21EAF5B794F0B16F3A0E9E37C227FF8FF465C18A46552E05F06473068905D1BB02877B800A76CB1D8E718B007CA09

Origin signature

3044022038CC68C94DD6A43D276AF54A3C559B040D409862C0DE2C403A09F92FD98198850220142E960BB0EC6F43E30A37C48FCED35317BF1AC84D2BBAE3C99E0F35FD005DD7

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

001F708C7918110E2EED7C5E6549E82AB2CF1A8EE7C0FBF5CD8E06510936A85F92

Coordinator signature

96E3BFD3534E7D51A70CA8DE2AFA6B610040381C96C8B78CD57BCFEF2D5836EBB2121D1F5ED98442C866FCEDBEF07D8E9F8763F2B81912504280F7A2D539D303

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

159029586E2E845DA3BB514BBDFA6F9FB08FFFA70FE55D0F9B095BC3BB8956DB44818C33984E0D95545E6CDECC9B22C80BAEA2EA5DBB38A16F5FF0F2ABDA2703

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

29319C3B0955EFCE407009755F3471213A022478F6A83A3C267E249C377F27BCB20F2EA630C2C4DE13790DA433A3DE87D9842C43CE09B0D2B66794909603BC0D