Type
CONTRACT
Validation date
2023-11-13 20:00:31 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699912800 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 100
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 100
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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1699912800,
  content: Crypto.hash(String.to_hex(secret)) == 0xD5965122216C14F0B1DBBDC19CD127AB4C91CB1A78DB5C23BA177E68B9138C96
]

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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 99.7
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1699912800,
    secret_hash: 0xD5965122216C14F0B1DBBDC19CD127AB4C91CB1A78DB5C23BA177E68B9138C96,
    secret_hash_signature: [
      r: 0xF7C417EC46CD6443194934059F03C45B0FACC607563D6AD6B4AE1798C37C946E,
      s: 0x258F42704F02D1D739EAEC00ACA86D4A0B1A0471FD43EC179D13B4E10FF127C0,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8889EEF2E7793C15246849F502AF4F488AA343EB19A45DFA15E1DA8F3F4A384A3EDF22C90202B45C8B56CFACDDCC7FC1630D6934505E8BEECAB9970F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001624AD88DA534B6D1AB8493C950B8B727D557BA21B0B18C11701F8E7BCD9CAAA0

Previous signature

34D9CC9735E145AF9E4A34F5AEA4D9B9D3CEE82884911E23663910454C0199DC20C8B710121D194DF313037EBDC48FE53C0A7DFF95F740D171359F6BB2D62108

Origin signature

30450220403D0C4CD610B890525FBD676FE0416B8FD975C972758D93231509A04D72351A022100AA1BF4810F33F2906C178BCC6CA03F9F4D6BDAC16EBC1B0C5C562E8DA836CF0E

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00A6FFE9E945141F87D692B63903B2253A33D71016A4A77D01DD6D5F82F386EFA0

Coordinator signature

58E2143C2B6D4345491481E1C2062D4A4E08E269E3A550605E7EE586B161A15701084F211DA0B63EBDA2DADC572E4A7D9AD037310B5F43D4D65FAE2311980F07

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

6E8C753414DD360A553171305C4B8F5210BF1620D1D14CE6C431901A046EBFD11733A5973E9E3E5E1BF4888FAFA386D4B8E1626B95B9B4FF5877FD524A04F305

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

8218B272FB6C26F2F0640CA4D7AB9FA3A409AB48A8C609CC64E20D18630CB8D8FEDB8F61DAC152DD311B12EBFDE45E2A7321232F455F48861D6C1B91A861580D