Type
CONTRACT
Validation date
2023-11-13 19:46:48 UTC
Fee
0 UCO

Code (935 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 0.0992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
  timestamp: transaction.timestamp < 1699911960,
  content: Crypto.hash(String.to_hex(secret)) == 0x915C3A1567EC7BF10ECFA64821AC3B3EB9C510011580D1E8A5D8A657AC6379CC
]

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.0989039, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.976e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0989039,
    end_time: 1699911960,
    secret_hash: 0x915C3A1567EC7BF10ECFA64821AC3B3EB9C510011580D1E8A5D8A657AC6379CC,
    secret_hash_signature: [
      r: 0x0884A28A2C12354D12D1CE3905BDF06A4FF65DE75925FCBEC9ADCE4C93CADCEF,
      s: 0x7101ECF242951B38217ACA2616D513993877EEB57409D0F0F74E0A22E3622659,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3B49845A45719046A84456775D892D8F3ECEE01F5AE6BC4C37EE8F9F3A2FC72048C4C5902DA02188070A0852EE427A0CBFC1748C5204231788325124

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001136B5744F3322301192D6C893B810B3F46E7D3EFEFAC4E7057F882BD6DBAAD88

Previous signature

F98C66A515022AFE3483912A98084A8A745A44A2B73341AD4EDF08841BD5A6C7E267CA0741886990279AAD1669B7FF4AA1AC2BFD4B85EC8469D2BB3EB213F606

Origin signature

3045022100F7146777B62B63D5EC85FD89824303D399661C3AB5A3648C88A48928BD53A60002204F9F1F0429B61FDD54AFDC6FF689C3957E6C2B9F46D7503B2BB6A5976E3FEE95

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0008923EF754CF6CE7EB41AA671C0DFCF151F85AEBE4345F2BC9B80CBA6E0CBD4A

Coordinator signature

E19140F2A3ADE89508C923CB6F796F2ECA3945F65E33BCA541299EBD5F58A4261E5206B55D6E82620AA917CF2DCCF475F0347C619D1E0248632FA646FAAEDB0C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

885E2B44DA8DE0FFE6B463341F2F1F62D515EE3A1B11D59530492ACACF480532CE9F96102F45915F9F896BB60AAE219EA82021D2C6B60529362B56163A352C0F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

A1D3037D1FD45EBFBB9E459509F0A780EF474CF772905DEA37E1BD58E936C0B920FE9BC8D05EE34405A020DE71C7C1E2603E38F2089B315935DF84E210D23002