Type
CONTRACT
Validation date
2023-12-06 09:42:22 UTC
Fee
0 UCO

Code (933 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.01978078,
    end_time: 1701862920,
    secret_hash: 0x35A87DEBB21A42B778688DB5F9FC353DFBD0267866626228360A693708ED7DBD,
    secret_hash_signature: [
      r: 0xE607173293CB3A20AF53A656CE2EEDC89297982168AD3613436208AEB4C1B1AE,
      s: 0x1763D1F325C80A5529EB5099EBBE9A50CC1A91B241EA3BC825191FFFE2FA39A2,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EF358B1638A905873FFFAAC3A1A20751AE25FC3289315BEF630E119FCAE3D27326459EC53BC09893B59F2C852152111AEE89249912084144897B5051

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A241B0941478C46B5E7B920F6314D6D4A0C2AD6BE498D4765D5C0530B561145D

Previous signature

53B52BD02340D40E6C106E6554D7E3F824A7822E3B68D4F177FE9B619CFB4F216BCB94088A7FE8AF344C67710754CE6F99E3066670DBCB71B4E06748F5863F07

Origin signature

3045022100D3BFCD096DF281A8447A665B9BD4154BFBB86B5D4A7F299A44BC271F354B5A6C0220786BF30B143FC6C6C540FC6960DA3963ADA40149119094B5E9183B29E711EB61

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

0022359955AEAFC75AE0F6B4F6654F181DDD923A36F530806981D1F9B2C1A99BE2

Coordinator signature

B9E0792BC4D1B43112C1044FFD2B81B14CE5291B626C4A48652764862C3692C001EAF8ADF7D2FE63DC913A314A748C0735E99AE143FA6110A9E6CB59E2A7870B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

BF1CC3B8E15B054F386C3CB82081E472D8632B0AD5E1D4E452064F79FB1F8FA413EAD8479D8147535240D74354CF1E0BE83654C5543F6F080CE905F53678DD05

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

CD450133000BD2CD676065B2661017AACF8D0808FAD639CF25F828A65282E2B9A4B5B1763967D04186B4B396DA924E01DB06563D5613B0A9BF6EC5AEED4D0D03