Type
CONTRACT
Validation date
2023-11-30 21:13:48 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1701385980,
    secret_hash: 0xF90B5FF4AEDA548816233E2A74F49837654B6DBB6C0718E1E6D79D0D24DC54BC,
    secret_hash_signature: [
      r: 0x3F556B9F46C40CB7BF6EF5A084F2290AF6EC18878FFCC2ED2F7A55D7865E2997,
      s: 0x5ACFCA32B71D471F4069F65AA08E3F6E580B123997D8FE9CA3A3DBAFAA9AB3EC,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B2D154A14D135D9C2D1782C4D171D049092A51BEF1BA905C4FECD4D2873EC25F06A2C67B05A4B3D6789CEEDF7A9D549270C9AF1B5D25D71EB95179C2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000151BBAEB8310B0F272CEBD23537CE5F11903D3F1839BCC780CEABC7CFBA07DDEE

Previous signature

33EAD49F5AF18B4395C0A97B0557E9722B41137C5A4842B74A9D6E23BECAE7D0C4D6261487937436E6D1C1BD7B5F09C6ADAA83076D9A344D683690C1DE031005

Origin signature

3045022100A67DE4929037922ECA2DD1DA64D9182A0D60545640E89F07C3E41A5AE87B83EE02200F824B8C681944FE2588E74B2FA83B98C7A19286E31F5E46B7E353C499CE7B0D

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

006DDD086AC80EC4DFA9D865073433A5CCC1276E676EBA512C0B08E682AA5572D6

Coordinator signature

078C979F334476787BF6A99C355BDCFE03B0433072A8DFA19BFE6D350D079DC3129BAFF8C9F7217A10287215CA226F35D1722DC9F878C76E5FAA0C90CDD74203

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

09ED80BC4CC73C676B5B140918E08612C0CB762D1F583C624D1B2197FD1D00CBBD08A102E34CA99A62186962F475782F1726C4F5BB96310DCD0E1E47A57A1207

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

9BDD597F51BD82D7DD893936F0B4F6AC66D9285F3D40559D86461F7AC92AD3D39C15C1D8977DB32397067055A08BB6DF492016F58D29B1A119F53AB52091E005