Type
CONTRACT
Validation date
2023-11-15 00:55:30 UTC
Fee
0 UCO

Code (928 B)

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

end

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

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

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.04985, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.5e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.04985,
    end_time: 1700016900,
    secret_hash: 0x377D1E0A723D6BB59CC632CC72501449FCA9F009599AD32F830624CA28BB43B5,
    secret_hash_signature: [
      r: 0xF4B1429CCC47CE57A29C89F24DE29C93706A8A80C9466CCFAEBF4F2CBA3B73D5,
      s: 0x7A4E2C887ED449BAD4E6B913E0885C59520DCDCB2EBDF4FF2C82FE8AFE8441E4,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D29672414A59BD1C8BDCEDE2A61E2CD132EA410D3B03FB4A1922E65B2985878BC0D011F0D4598ACBDADB9B0045BEF5F520C264F443B9ECE7555AE7CB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A13EAD2BC42AAD3E7F63E00605C6C0958F8C2834446F0102C915A4AD474C15E1

Previous signature

716EAA06660041ECEAA7F0C2A7578800A0EED4CFDC704B3C08CD73AF90C410BF988A61E2FE4629A6B26470D4360325A1239FE7443B267145EBB4C6BC3E74DE0A

Origin signature

3044022056BDA7A277F6184A8786FC3774AF9ACCA71CB2589C7EAEDA966920D9D2760B42022070FDEF1F78BC15401E43D6206227BEEEA5F77FCB12629D373BA57B8D9D302E87

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

003A5EE2CC6AB0C3665FD6ADE18C43B04F636CA7AEE11DA56FA887BF5D589AA817

Coordinator signature

6699089D49B8554940D5131D67AAD8C1806A5DE06A7C6C22F92ED096B394A166A463552F30DA57D3438E19C9673886D372F9DCFDE320135ED8CBF32BE5989B0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

C9ED8EE8D94EC8DDCF805F764B0DF5EBB304AE32DBE37D043C87830848555CECCCFFA7D26D9BF93E5D38093532FD31500833E906F8B4416A10A9EE7B55427C0D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

1BCBD6EAEA688909C4B5615F3CF42BE41CE45BDF6BE9116873F8754760D49A2E29CA81551D7395E28884E5072603292A34E0063F292F5D9924DD5EA12EA1C30E