Type
CONTRACT
Validation date
2023-11-14 10:45:14 UTC
Fee
0 UCO

Code (918 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 0.5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1699965900,
  content: Crypto.hash(String.to_hex(secret)) == 0xA7B625153D111BCAA16158E907511D59F2DFB0F74B8BCA95FDE09545AACA0A94
]

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.4985, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.4985,
    end_time: 1699965900,
    secret_hash: 0xA7B625153D111BCAA16158E907511D59F2DFB0F74B8BCA95FDE09545AACA0A94,
    secret_hash_signature: [
      r: 0xA844CC4F5EEB0A59E5FD2F4217905E2F0C580D22E6B80082293253A0BDF4F43F,
      s: 0x028E62C6F3CDD6E8CF032BB7344CE924CE7518A743F1F11C656C6F6EC928E3CA,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C504FC7F5B6510B6F1AFB86A74013E66D61674CC018CB028EFC26766C867E69C155F517B991B7E4708BE87DB8B969680D4C4BD0F839093C80451C5A1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019E165E1A1ECB3748FAA3C0AB5A64403E0778E86A584BD37CBC70CC5F27E1E8ED

Previous signature

28DDE433C1C8DFC20587774593ACAF0EB52CFDD1EAF3EEDECC2F1C794196594208CB3F3BF532899262346AE645D3C1E787EE828254F007EBA0C78BCC39D0770A

Origin signature

3045022100C6EC30EA048E8E5B28BC7A55A1AF91E5411C58BD31E920CD64936A76F045071702205AC4054112D351C82EC585F6F504A1528E9346C31773C887DD0178198DDBE2DD

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00E013ABD1495663EE1BD06446C344816C63FDF352BB7087F0734BC0E058758094

Coordinator signature

2B3B99E7A2082C8CF40CB71A21730505D80B7BE4ACA9758F5733D3DFB772CCE3F1C1958ABF703E09042FADB29BE185F534FB6D679EB9430A4B688BA897B13701

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B01E84973B5F08127B6DCA7EECE7AEA53BD6F3E1D6ECE33B0F253E5F7804249917B2E03BCB087615AA3AFC60F0D827315176B07E82547A8D5A856F8BE76E4805

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

3771DA703216A318DFA6BF8DDE15FDDC8413BFC2560B9FFEEA9A4A7EDA54948949ACC82E3B2CAD2413FE277BE32DE11E68CAFA34F3E48BC57F7C6FB98335DD0F