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

Code (933 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-5,
    end_time: 1698166680,
    secret_hash: 0x848D00FC5FFF820FAFDD99669BA7D211AED7428733CD6BD14B7CFFFCC5FD51DF,
    secret_hash_signature: [
      r: 0x555CC839C4228851D2EA431AC3181D8FD20241B7023A49FCD31B8BBA750C3C65,
      s: 0x7776AE5D14AA687FCCC6C60FBF46F367338F70418AC8B759F7F387CCBA86A242,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5A11DE2293B6295BAA9CB93D248C0E8E83EDBCFE927B5BF2E54E8A2144602BD106CB9D0E2C9876BB3319076CC905A12F296F385B3D1063E8B4139243

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B6A58D8092204178BB5FEC1B0B02866370B3EBCED400C418CC7F053334B7C3E7

Previous signature

17153ABD4ED166E290BAE556BEEEA3FD5E118557E7FABD987C5A7C7D388A9BBCFA1999BB29C46D3F2B7703BB18082298FB00C1C09D07C8774E275CDAE93A250F

Origin signature

3046022100D474E321F73DC5F980555AF5070D48D384BC4FD3BC9CC474C0E4C625F181C531022100D33ADEBEFD53C1314F34DAEA114F95E6017FD2EBC979E289B6F4C498EFFE0C26

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

008D087480A35EB4074FC276565BC7DADAB8C7649F7EDEB65FA7AA9B08E9AF71C9

Coordinator signature

1EEA9D51FBAB522B36ABAA4F1C03F9111AFB91DB4A713C38530E8B2C4A3223040EFABA53FF340715600AC2B6971C8FF9CBB215D20EBBA9EAFDCA488D80FF3909

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

F44D8431E788E042E8B903A0E8EBDA0F55F431BF98FF56F04F4D3640779D8B06257C0F5015A74B83E5D5CC34A1E7358AC6A4F98EC71F606C9C025794E22D2D0F

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

25FBB5E27569DCDF85889D0AA1B093CAC1EADD6D458877772734BC54A90EAFB6E7E8FE92BEE7C4A360E3BBB20E577EA653C80773A3056B52326D20AE86611B06