Type
CONTRACT
Validation date
2023-11-14 21:02:24 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700002920,
    secret_hash: 0x030C6D47BEEA265B83C2544498A4A7C418582854DF45C867876F5B1FD9891ECD,
    secret_hash_signature: [
      r: 0x075754F5E3697A61DAB75D3E2DAD961F833E5423FD28BF473AD2D2D7BB855B79,
      s: 0x16E3506FFF7E741FF10712EFD01BCC9C90843B26AC52558E7B56D2876AFBBAB4,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C85C032605C3E5E0CCF2DEA010E89C49C46C83A95BC4F35A241A255CEF4D4D5481C948360E8EFE1F5273622775A397ADB45D38FCDB3BB0F3CD1E5519

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EA6961AE1511FEB6856B756DA99D93E1BC8C666F721AD0C300FFAEAFE846A644

Previous signature

F7650F19FE675EE7F2F41793BC0254FCA27B13A41D5242CAAC210A8BBEA551C94B5A42920759018B6F29928A4716AA6F5B092B4860548D2D744768ACD6DCB90A

Origin signature

30460221009E3F3AE6D8BFD588E94E7E17D27053B4F03B01192017B3180A987DB9EC511131022100FEC8125E26297E47A2ABFCBD40C0CDB18451A420A9DBEE0D7C2BEC5CD3CBA1DA

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

004987BB6925F776CCA129A14BD39DD390DA8F3D3A812DB162281FF1AD13A2C0E7

Coordinator signature

472BF13F8C6E1DEEAABE4F6A8D65A8EE0993DC22052C867D9588F5EEBF2DEF64F5AA240491C3F5624A19E8A5AE01DD3F4A7BE98006B4ECBAB2300A0F470A550D

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

33381AAF9A83E53E4CF2C49C3B682FE1BB3CE33F7F3D6D256E7474E1C15522E55B2DB2D3FD03D005E1A9C50C32DA2ECF609FA229EF177FE69402BBA8D2292A03

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

3B2BE0447190F4B6B6D4BCB148CB576D267620BC5E1613BE713128E420739DBFED32956F0067ADB18B64EEC4DADE36B683CE93E4336CDD34FE4CE9513320D401