Type
CONTRACT
Validation date
2023-11-24 06:36:56 UTC
Fee
0 UCO

Code (931 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700814960 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 0.396806, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 0.396806, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1700814960,
  content: Crypto.hash(String.to_hex(secret)) == 0xD700FF9BD83373B160A33A5AA296124D331E7C5785351D1F5E0D88908E28302A
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.39561559, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00119041, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.39561559,
    end_time: 1700814960,
    secret_hash: 0xD700FF9BD83373B160A33A5AA296124D331E7C5785351D1F5E0D88908E28302A,
    secret_hash_signature: [
      r: 0x94BDCF4069D19E96A7A13B397B7BD222F08BAA3C1BB26D06285AE168F6CDEB45,
      s: 0x593BB6D96FF685B53B5EFAEADB8F5B753BD1F1B48599486B6C2C3B6B288A7D92,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    897771C11AAA90BB1FA7845B12814AD906A21759D6E9B1BB68EF5B1B231F09AB6786892F3CD5945FC5695A0ED0BA9C0BE4D846ECA6FD441D3630C6DB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E043E6ED33B6412CB2067643AFC66DDDF0AE75D0D13112FBEB5C979B4B8ECF5F

Previous signature

9DCB8C619FA028BFE66B8F6CBB29271B3DE9957FFCCC9C7443827F8050BCC54C083E7BB27FF59108FD7C914BFA6E7E0DC4F19C3A17B8BD24510DBC77578B3603

Origin signature

3044022013D3080DD306FBD21FFE56FC1EFDF891C78B873226142BE88191B5000EBEB71702206188778960729364A4FAD4E84E422B82761EC87943A301AA1CCE5C3580C6456F

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00BEF768694A1798107D48A8A7EC1F0ABCEB760DEC0D7667B1CAF7687F5B7F70BF

Coordinator signature

12D1379B4AB5F9F9CF329B0806A58D27B3405F5BE89FF81F1D197EE28BB8C7349BEEE7ED963F4160343AA36800D029058D001B54C8291559BE71F21062F15808

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0D67B904ED6D2627C11F70E324AAA8B8F843F1C4AD2B478D9DC4BC50345456D1AA030712761C3FC187A6ED2087DE055EBF006F4793B12CEFD36CE7C318B0AA03

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

409495D1448847E9005FD98AB6897DAFF3889A320B639BAA61C981E0005320DAEECB51769AA5B824EC98213178BC21FED9C87D7BF04EB4B5A3C105592C441F0E