Type
CONTRACT
Validation date
2023-12-31 19:52:35 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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.97
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1704059520,
    secret_hash: 0x75F0390896F1FB486DDA9F1D6276D72C1D5DC3D576B12629768AB3D74A39176F,
    secret_hash_signature: [
      r: 0xFB671E0CAD526A1942FF7F1472F46D249E37DF89A396F924A19FF0FA6828B2A2,
      s: 0x5CDDB0B0456D324230AFA2CBB0DCD5EC9876758D1923DE496C15429928C319ED,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    27B0816281F146660567EE33D9E68BF843D50A5F182104D26E6F01F137BB313F549904EDA11FFA43BCB7BD7966DCA85C93A27CC4311CD88A42D97D76

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001BBAF9AF44DDAD3DD2B16C93BE306F8EB300E3903068256BEDEE0851840763D59

Previous signature

CD97F860193B6DF1CADA41A8C73984DFA0D66AC7EEAC4B2950933D0213F6AD12F16B953D3A918135149B75F41477F5EC0B0ACBFC4685E5E8B1D5F77A2459AC03

Origin signature

304402201B593101CE8EACA8B8DB199393683D182A9F05B3D11847A3CAC45AEE6DA43FA1022029DEB2EF27016CC0764FEC35822089608D89E237DA0FAC12096AAAD945715D1E

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00E944D622D969459F28A0C4A90D0A76919F6713DE2627E9607559FDCEFC15DFBE

Coordinator signature

4319E0DE972595B686B8A91DCE0B420EC17FD946C8F0E6850A523B59C74C92C0E48E371CCA73767D1AFA50450C1A380F901816BE8F39F7E64403A7338EAA5F0F

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

C45B92B14EABA56624B6FD00D626FBBD789024F78E6FC3FEBD463053ECE393116FCB6802BCD911303D64DC62901ACA1DA35E1BDF73D8B5161B01164FFAF29200

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A93C9F6F30E2791730DB2CADCDE2B151EB521F9F308990787019122EF628E0B428E49BDFA1D2B914F91522D76DACBC559D691C3DF57AEEDA6AA4CF38A76C1E02