Type
CONTRACT
Validation date
2023-12-05 20:13:45 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1701814380,
    secret_hash: 0xC2D2129FB28193C92E519C2922C8D33160FE24F159D670ADD91D00531B46CA27,
    secret_hash_signature: [
      r: 0x420244C4ACAFB35A2A3A50EB4F24CFEB061ABA03008D25B04100B7B012437743,
      s: 0x78F0031C40D60B3BEC9B1D08B3B3671214892F9DE85166DA64D36948B7C0B061,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    21C5E5A8124EEBC177EEC21359917EDD4CA20380A93E9F2088E7E691F5CFA525FD284A59D91DD0804DFE1B07B7809A3EBC1558FEFDD41E6AFC05C5FE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D1CB76BBA79A371115D389C7F3D8F11D9FB3B441F4F762977A9CCE2AA5826FDE

Previous signature

6BD1667FC0CA45CAFA4BD5EDA8F7C55C9876BA171A9B998FBB36BC03276AE1E30B83871C6B6B641A731FFE721A9BBE2E358F642B999D248AD183B74C4253800A

Origin signature

304502200C8B2DDA9263E10CC5350950A5019ED3E3C7473129597200E30EC2C7B598853A022100C08A33B536F91C63A538A233526DF2F7049ACDAA455084BF971242D8A829F5B2

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00E4E45DAF844121D4BBEF15F4CEC43A00ABE42BC8462560E2BE0E175315798FF7

Coordinator signature

86C79C8C427F9EFC89434902F62DDD961A31C208A1E65AA6A348D028FDAC492866084DA9D0F189D1B204617ABBEFA54B3C3FBF46A5030C694178E6E8BF6D810B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

9668115C2CA68AC577A2B18BB56671BCD0D3501223D265209896E9D6D5E124CFF95AE215F65F83FE0D86BA0066A53B96A867026321516DA55EE160C4309D7202

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

56A991B0330FC6F116617DC562749D5800C6F793CC1524D0D69C38BC456A6BC6FB975F94E16A7BD4368238B28B8E2A120C378471BD4B0D582746C019DAC57E07