Type
CONTRACT
Validation date
2023-12-07 11:55:20 UTC
Fee
0 UCO

Code (935 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.02967117,
    end_time: 1701957300,
    secret_hash: 0xF1A56F64898683F720D147E4848F185F4ADC696CBA4522E207A5A384BC68DFA5,
    secret_hash_signature: [
      r: 0xA4893FE5ED6DBA84FC1FA291567457123848D606FE66D434C4EC197CD45A27BA,
      s: 0x075C4408188863664AFFC616BA70E396AEE247310FE29E81C652C8124A70AA88,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    995DC3547A45F8D388E1EDA8D36C6EA3240CA23EB3C63707C2E6EEEC9F888ED69B0AE21F21E1BD09F9CA4B1DB192EA386E63C903AF00690FFEBB5E1C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B756B41D6BA0E93717E6A5F79226B5798372F6C03F66D4ADFB844D380F39D3FB

Previous signature

D7EAD30F6F1C7E7ED3B135FB271943E8077085F24D4CEF2B52AE8C7FC1828DB4D956B7440AD85EFCC3517EB47CFC5AEFBD97CE22C6F8804F2695557D45240E08

Origin signature

3045022100E32301062C3E8DF3194484066DA326176201B9E304B9EB1965AA1E0B9DEECC0C02202B2249BBBFC092625DE0728867744965F2F07004315A9BFE80C5D7F6BA0C8CEE

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00423B8723EE6CF3226C9712422A435091E3FEB65D67CA5889012403E83597125F

Coordinator signature

D4566F15997AA2A2C8AE62ED52E66080CB276C3929C12CC2CD7AC2D4E3D3AF707147914B92AD71736591BCDEF4CB19C0BD40C854E2B9C3F18F9F7F7DF1B2070C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

D7F90779C5DA7517B628FF3ECB213094CD94C0C853055C89AE2AFB18286166D6C9D180697362859B363E5CC45665F5F682C8DE7B4C3083120F25085455DF660D

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

12207A1A75A79F19EE85F8B8191E0AD200FDB0AFC30C473BFADE7607F907CD305B408EBB65B1A2774F417FC8ADF4AE08552CF9B2F58C01C5ED51EF6732D58A01