Type
CONTRACT
Validation date
2023-11-30 02:26:48 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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: 1701318360,
    secret_hash: 0x7BED2DB601694E61CCC13BD0D78A92493C0146AF720F938A242EE44E9AF47A23,
    secret_hash_signature: [
      r: 0xEB8A3C806FB2D7E5C4F5BE23F600EF9B579EAECD221C3422FFF12189A6083BF4,
      s: 0x2AEE5D1723E5F4A5AE564570F92573EF42CD127180FC8FC71AF79A8E7E8159FB,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F82F57DC7705D3C6563048E376E026FE6865934CD3E947EF80A5DD3B6DCC131E00399449D9FAC9A2361287E819084A44F9DEE97CFBA5C257190A44FB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CFD0FC81FA2B84F8CB5308A7A496528365A41DF19EF9377712BEA22BBAD3B834

Previous signature

34874D743F3976038736C6C078BB2AE2069C0F6F5696CAA60045409B95F9FAB936AD9C39450D98A16DFC63FDE820F498B20CC01321E689053A2A2713A7B4A906

Origin signature

304502204A18EB226C383CC1E19140808FDAE31378557B15B383591DC0BED361C9FAB568022100C1B053FAD760C502CA58E6D7A91A3B1F1569201373905DAE417BF3F211AEF414

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

006A721E533E003F3B85D3BCDBA8E61EDCA4400A612A6337B5BE299B3A1AB4DBC3

Coordinator signature

F864A3877187806BFCBED2BD82247B5CF51C693CB7124DA785F75BF24E323CE11C31591415D7C3967E8603A11B3DFC98237182948C6DF0542AFB24149E1F0802

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

DB9DDB710B81DF881282F25A31D1FD1AB4DA8AAAAA049AB8299246CD1B5F3F5C6E8DABDC3D86C4A8377ED2BE2CA5C5A6FCB7CE7B5A982E4BF5F601D5EC96C60F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

D42B1FA807052D8D94C9F298067C66F1589D48108E847E3815A747A2928BDA9D1CDB66E08769B7E7ACAA08081D4E61A163BBC25EDBAB1963188087FFA3317C0B