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

Code (927 B)

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

end

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

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: 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 < 1698164820,
  content: Crypto.hash(String.to_hex(secret)) == 0xE7B5FFCEC98CC6F39DADEFFF1E309B98967EE2CA68826487FA16156FF4D3C665
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.004985,
    end_time: 1698164820,
    secret_hash: 0xE7B5FFCEC98CC6F39DADEFFF1E309B98967EE2CA68826487FA16156FF4D3C665,
    secret_hash_signature: [
      r: 0xA60F69174D8A3C88800794E230E80137AA57638A2A4A43BC28DC054C90A66A3A,
      s: 0x274DC48BF8AF5FB7537F79DD01987CFB67E369203959F1C527FDE3CD1A718E1A,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B6C8417C904FD2D18F59045E04D71897724665851C7D3728FF67C6416E269AF22EEE6FBA9D313E5B3934AA40EE000C67087A1EC0AED72AE66D2DE873

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001618103BEBFC56AF36B1F4FEE94FE1A9572F6D511C643608024853B605B1A748F

Previous signature

5971A4D82A5CC9E4ED7E7A170B922036211254A4B9A5B21A3A8B6FF9244C2EA038549B7F7E9553EB343C84C70C11A53FEA8D6BB7B3285F98BD687200C3861504

Origin signature

304402201F93EB1269AE699EAF743532A90D6CF0610141950A7220E7CB57101C770061CC022048CE4AB39E1540E5F3C133B0F5985CC427E68FAF624CF9B849EABA96495F16C7

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0046435E9B6697B52F46195F1F88BA45F171DFCEB3F9FC9B2C497ADF22E3B3C976

Coordinator signature

1D865F86719FD94890F83FEF02CA0337DA54D04C47F908BCF6F22CAF14B7AEAD182F8872C01D61C0C222CFC120339F397354A0E832AE3AEBAEC1B981396CEA05

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

AC0CC80093B41AD86435192B1962FFC1334D64A9F0CE360B70839BD20919C7A25689CC9C9A6B70FC9C36B7ECA46DC4603AEE4C4AFCFEDDEA93161177BF3F390E

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

7FDA75936A57B8E428294803C8806EA0C4DAE6AC872F2023E7E61F31F87A3B0383199227636894E3F3208324BA670A2BE0A10574A50B3AB8C433FBAB55ED6A0B