Type
CONTRACT
Validation date
2023-11-21 16:30:48 UTC
Fee
0 UCO

Code (930 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000647409F94DE9798EA91E049B9AABA07B8CF3570A22056513B3437091C04B6807, amount: 0.0001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1700591400,
  content: Crypto.hash(String.to_hex(secret)) == 0x0A937747B7571A882D54410236CC0BDCA2DB5179726FFCF5C9C7F1D727E1D038
]

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: 9.97e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-7, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-5,
    end_time: 1700591400,
    secret_hash: 0x0A937747B7571A882D54410236CC0BDCA2DB5179726FFCF5C9C7F1D727E1D038,
    secret_hash_signature: [
      r: 0x86337AEBCC9647B8EF85C11AC4BE9E8E481FAD34CFB4DA21DFCDFDF3768F11BE,
      s: 0x3BE004FF123BF258A71768E67A51FD2F8902BC44473D1485E91DB324AFF0CFB7,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F97180344F20174392CABD0AE2A48D219F5514F2286AAB96FDB3188722ADB7E5DC1AAD39043AB4B57674DBAF81921E8686A4740715ABCC14C04BB816

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E6A36EDA204590E5C8B47C2EEE9175CB9FCF5A7E2D5343D1624178EA6CD0017C

Previous signature

E2E9E76D591AC80AF45F49427B06B923594AF7619BCFB9DB0F2FDA327CBD30192899F68EE0374BC5F137AB3F77A1C457F1D586442BB02495966AB2B2D1076A0A

Origin signature

3044022041A2CF2DC5EEA40A5FD6A8C9C94E8EDFEF54404DC0B70964577A884B83CE9F610220221C71E51665B9626086724812C397D064765C90067C798298725F3FF95EE7EA

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006607640C9BA205E0BA27DCB818B94B17A47910C3839AF04E9631264A14097E23

Coordinator signature

D75324629FC63E49D33A98675AB59B43FC838FB5EDFE9A37652808E756D64ED5EEBAF95CB57D2DE98DA23BFCB0C8F4BD1DE9499C0BB0C71F8FA5B45111075C0A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9490D719DB5C90FC001DA3CE66A622C24A11F35186025D76CB5C2D30D5EF9254FA3649203E3EE3A030C2396725BB6477867DDE4109A76567BDE5F85B239ABF02

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8CA118948FFC84984B908095325AD79CA20A4EADBB2C0238082ADBC5B4EB3932D5C1ACC0EF0E0701CF111BE81110B3F9304194217FD669FB5C8A55FA21CD4A05