Type
CONTRACT
Validation date
2023-10-25 17:35:30 UTC
Fee
0 UCO

Code (874 B)

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

end

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

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

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: 9.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698262500,
    secret_hash: 0x92351C91ACEFCA9CEE16DAA9786218FB83D322B933E491C4FD5248188BF11B21,
    secret_hash_signature: [
      r: 0x3C494642A0ECA91F79609BDD79A078A63C4568455AFC96BE421A406B15C86F0F,
      s: 0x7D1F19CE14E59DF3B00089BBCCF884233B846343921744D810D3B5881F2E4E6A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0AC6320CBFB162A6737474FFA8D23730718305E6D14687DF4F446DDEA6C4A9AFCB0D622B6EB6AC376EE5513851489AE43D13AB3E3D29098C0465B6C3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E725C76E70DEC794A205610C488296E6BBC8E4F885DA3AE2755D68FB796EF8AC

Previous signature

939CCC4ECA8CC617235D6F4C82F14E6691BB80F9E40C367FD78720F2FC3EB12A51484F3E466BAB38E476592591E33F667E05E2C4B2E7C24A39DF70369FF17403

Origin signature

304502205CE78D510637103018003A03882EEC2F854B4325327DE9D17F78BDBC90F18089022100CE9B5B0B4E63DBD4C3837C2CCB1BFE5ACD2AD0DD1F961FCFD7496E108C525F9C

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0017EA10FBA4E357DDE217CDD8A9E5F206801C73F0C6DD30BC7C30CD2A39C0EA74

Coordinator signature

EF209CB6D9C656B72506AC6F8AF628D1B6C42996F456AC8C4931DF424757BB7EE35AA1B121913FC53C9FBB3EDABF8DAD0B0104844B266923549484FE87C85709

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

1B8D9A1CB595D05B2E6B4C997FAB4A3E6C409A1DB19FBB4B6E9B4713743CC008210B7E1E8E5556CAE1030D8AABCF88B3EC730B26D7F7A3E94E238F3F06342F07

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

54E786618A6BCC0558F3BF0A9A2962D0BD92E1C36281C265B18C383179ED94132C6DB7B674E0B6F95AA5F2275009CCBAC91D559A98A5C462D0810E6BF8830908