Type
CONTRACT
Validation date
2024-01-25 15:13:56 UTC
Fee
0 UCO

Code (926 B)

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

end

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

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

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.8973, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0027, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.8973,
    end_time: 1706202780,
    secret_hash: 0x1D84FA56D32F88211E3A05A56837FC7BAB79548F96848C3731A23EAFBB3526FC,
    secret_hash_signature: [
      r: 0xC17CDD7BFC1F1341A202A59B499FF2136E9EDC016AD7A4706B8676EED63B319C,
      s: 0x297762EE313C428ECD7CBC1B0B1E9FD0137B4C6B608D5321860E19D42DA54C42,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3E0C47670FC18915776A3C9D3966A66A8D74F2AD34410156E31DA2E922A31FB145AF9EDBF9297E486B1707A60A73D623A2D2EFD62959E2510C635257

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000134CD5F477EA0CEE391651C13E76477A606359C01529852FE6438AD5510208BA8

Previous signature

C49F39B8DB1038F467F8D8ADC474FB70FFCC40033D70F07D3F2009DA1166AAFA727566FADE640C2B7B953ADF81D05F17D13C4A28A450EBF1DC221EAD9CB63A09

Origin signature

30440220200A5217210355DD7262282A32AD1DF050D27033BC6E9BAB02F99FE2412EAEF4022038D09663023DD8595166FE5D421527BFAA4D403DFE8331A37A6E0E4DFA654238

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

006E1B570B5E9F8E4000F45175CF81C5564249F1A2A06ABC1048CE3A6DB34B3646

Coordinator signature

CD8AE3B258A9217ED8127C2023B5E8F3B2C28EA0EE2D44FBF996C9C8DD47C2DC0AB43AFCF06BA708954426718AD2ACFA8A469C2FA0DF3E43E0EF39180C7CB809

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

982A91DE33A329613F11D952DF74FBA2C7FA59DE3942B9D7F0A943C7F02095D78C9E2FE7AF49889B0E3AB829D3B59C87B3A11230341FFDA4D027B2D39692D006

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

834EF4E368ED5F4BAAFC43881F8A6DC47C89784C7B72A30639DD92DDB89CFE9E4063121ABAF0F76BDC25A424C9E4C1EDB66835E0F063BB1BDE83B71178BCED05