Type
CONTRACT
Validation date
2023-10-24 14:14:04 UTC
Fee
0 UCO

Code (928 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.004985,
    end_time: 1698163980,
    secret_hash: 0xB77E908EA02B4C700B7D51C4DEB8AA164F0AF0B82AE4937F997D0201CF37CC8E,
    secret_hash_signature: [
      r: 0xA2E57B1B45C53FE72432D8AFEC6A8B27623A9D3542BBBCDF25BFFF3A0623541B,
      s: 0x7D394188294214B1774A524646F640AA8AFB891678BCB76F2DDE7387CECFC6B0,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    918BCC170E93DF8A085DF0E341B28F2255D2C099D6D0584F18F8AF425E4AC6CE2605B80D40F4A82EBD1778C226F458C05529ED017EB24E76196607FD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B03BAB47CFA2CBE2D454B56CDA43FBACF0B0017D4ECD5E8EE3D628F280464971

Previous signature

87A225231A7094E9651B6C943586DFBC1483F0DEC6F9909BC65062433C9F5ED46FC8E9B3A1829A47DF57F38FA0A9D51ECA2CF688EE8100FF4B565220DB66FD0C

Origin signature

3045022100B1452F7D4AB7489449FB3627C8851CA0F4FFF4C2914E05BC9E63F06DCCCE96F0022058359BD3BAE3ADA4110F02D8B181812E04DE82ACE40DDD467116B07FF4AF64AE

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00A99D5344D208FD7F5D3B3487E6FF918EC438CC005C3DD5055D5AC4CFEF11CF54

Coordinator signature

1A198EFBABFC2C4FC94F0856CB11AC7398188FD1865300AB7DAFBFFABE14DCAF1492F67B34AC575315AA562A215C6D76DE4CFF3D694F4F08C8D9E4A6B1E1E80A

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

B8EDA2115559C469B1A6FD7CF07018A80509EB9A3F683C3581C5054718623E60F961150F93E239DF8F31A9368D474A933EB9B805B591C89000A0965E3C396605

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

ED6149F4A0E2248413EB2DBF8EFBDD84909591EA8EDF26D6F0B2FA9A311BC2017155529822D7D714C16C36787A0FDBC155E41C14987CC794032016D3213CB706