Type
CONTRACT
Validation date
2024-01-25 17:48:21 UTC
Fee
0 UCO

Code (929 B)

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

end

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

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

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: 1706212080,
    secret_hash: 0xAF4F238BFC08A117665C26DB588B39195964D63C0C4749FCE9CBA94D858BE5CB,
    secret_hash_signature: [
      r: 0x69F2D65569D07D0C0C61535A96FEAE7D53AEDCD8032FFA3254675B2F7757B802,
      s: 0x44F81F69743BD7B30AE089AD4BDF2BB04F33C6675ABA2CCB897C31E0013B1D2F,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    4408D54A66A8562969E0A551FEFE023ABA6D32E9F2A9384E691E3171D826266967D6986887A25361223A096D1004EB126C14E2CD10378E77EDF4A3B1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001065F2C9BA0E89ECB2F9B8705327C0B3BFED1872B74189642E140FBB805D43EBB

Previous signature

7653636B386DC26D11D62054C928521FD51B998B066DDDF1641E3BFF24192120FDEFCFFBA2BB4E11909E11033A831A662A5DCBA39BCA06843822ED8C504B0103

Origin signature

304502203EF031879E648285E2D1C5F276428605B07532C1B35646CAC08EBCE0C5F67F5E02210097C805D24783D51240CFAD68604FCA267365BB6047CFE8EFE0C84D7561E9B069

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

0083716DA8DDB7C30AA1AF2B2986B0DC4D011F01FF363BCA2D71EB4DDDFD4CE528

Coordinator signature

6132AC24B275BCEF20DB354B890714BD0ECA127CDF17B9CC97075DF12B7B448ECA030DD9A7CFD9D92EC0227D26136E40200D4AA702237E4036CD71D4A430B90F

Validator #1 public key

000162E6ADFF9FBBBC4BDBB3CD56A5A13A1E8576C3619ADC58A189F7E9A3A77FF95D

Validator #1 signature

5A5728F18E8C97D0757829CB7446EB6797D9C265F3D90D311CAE99326CB066CD3551BF217CCE11400F5000CDD62048A662C21334867C8D3DD6D3A9493062E10E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

E8936700312F38D783F356AD013E89FC9E9127F97EB9ABC05482799E41BA88FFEF24228D070B3883942A405564F79E51339621D5F25423952677740B1E73890E