Type
CONTRACT
Validation date
2023-11-30 21:16:56 UTC
Fee
0 UCO

Code (923 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.02991,
    end_time: 1701386160,
    secret_hash: 0x814E47BDE2DE9958BBA62CCD756E8F613B67AADA0FE47019B5B31F0FBC1314AE,
    secret_hash_signature: [
      r: 0x170902B4EF4F60AF60F15429ED308A8E4D56E8529E04B3940100D3D2DF85EBDE,
      s: 0x28D5A174E571A2D3FD844892659CD55A0453452A272AD8B44CCD4A7C3A191DC3,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E8D1E7FB8B76C63C003B07D82C05A677A07A1FD1BFDEC08F3AEEA0DD2DB73947DE35A2F4F0C1915D188144937CC404E92BDD9ABAB0D746F6DED11CF1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A80FD6F85845F5263E7033AE3FFEBEE94D5AFA3A883FB7086C1F6D199012ED19

Previous signature

95C64798F82495D65ADCD4BB3F51B8C4682D7A39D7FD5F2764BC128C86052FA0654FF00D4B46BFE9FD07C94BD2766E67A885AFC700D516EFBC90200981FB9E01

Origin signature

304502201D72DDBD3AAF152840F9832939CE3759A2CF2588CE39E0A72652285711307920022100F96651283D4F1D04F53DBF5BCC474D01092E1442B3A47969337775BF42ADB914

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00DBCFC040587B112D79A2FA1C4A6A0A6995A1E3936CA44EA81F983BA0CE08EE61

Coordinator signature

361965A04EFA2CF3BE791D67CFC5206BDCBD1BD3983FDDD64A857488E42450A5EC3994673EE7F2B19DC760F5975468E17FD1C3915E97DA399EE9E696E9A34601

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

0AE09BADE7E2CFC6763A4B68F18891AE596C9D25582DCAC71F44B19CA48EB4565C8A0CC14940018B869DC1B74DBF4F20BB5AED99836F63B646B9A8656876B70C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

0E495C4C5B41F5AEFC58E3C0269CD94ACBB2ECB1BC6F6562B6C04EBADF79157EA56D5FD1BA2D67A9B2CC8788716E740A4C213B985F60FD9198AA34C6AA35CF04