Type
CONTRACT
Validation date
2023-11-30 01:35:52 UTC
Fee
0 UCO

Code (923 B)

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

end

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

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

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.0997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1701315300,
    secret_hash: 0xC65A12983434FC7ADAA8DA208622CF0604864148013D2C0710CA9725AB9BCB79,
    secret_hash_signature: [
      r: 0xFE6A7A2CA798450AC28DC82399F82421D753C51EEAC34F43C63B8A1F7617CF87,
      s: 0x5BDCA4EB1BB9C6B227A672EB962F435CBCC6C6BC71BE58BC3B6D89E65EC4C92D,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EC5BE0088F86D11332720861B4EFF0D5EBF4729C78F8950452ADBA657B26903475C5BB5A6AB98BD95343B7E97E10BEFD4DBED710E0F172BDCEEFD173

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A1551A114867DA3FEE4E99D9BA40C905D0FE572592A1638B8E22AD19A863B948

Previous signature

7948E1180B0EFECEF1FAB342F9266F4824A2C4BD6FA340B7003AE48BEB8B18F1E260E529AF079D23F95A5FB38923C8CD26D0E22E7655D29233AFE7DD129D6A09

Origin signature

304502200F2640FD87ACB061C9A6D87B85A2815C7DA5FBB11C0482CD03A0027F7019A45602210091FC3E9042410E7CAD4881AF33FCA2A440771B0933D48B04C50668F926075115

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00988ACA2E5CE9650EA500B110CCD97587D0532C7DBB5A0781BA5997F0C0152882

Coordinator signature

DA6AB8A42C2B4FB249D1189C6B9D2ECF6DBDD5970380AD815C609DA27E574B8C4A544B12116547CF7A1297742D93592A5662B8CF9FD845D539F69AA5B7C66B02

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

03D6AEAD116DBF1AC4526B9550902A2877C2F5A207342324E01125F86111E24B692838950AE9416E5A5157A21357E098803DDE5908DCBA38C7DC1563AAA70B0F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8E51D791F8B0E1DF0E84E6E04C4FD8EC1D854CE9D6A36A8FD5C94BE5884F17F0176B39FCB36B32F03754E6180CD6170ABE36D1F66E0B00263235FC82017E6F05