Type
CONTRACT
Validation date
2023-11-15 22:21:10 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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: 1700094060,
    secret_hash: 0xA7B6CBC6F7750DC0F0474A17F3B27C173D53BC811F553545086B4CD519CBD1FC,
    secret_hash_signature: [
      r: 0x34031605E42F8575373E7AEAA2B9B9F0426BC530AAC60827A5C1D0B4D9B7C4B3,
      s: 0x0DEDF733E1ABA8E428C4D22CDC182B89C6F0DCEF472B54D502EB90E60FAE2101,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0AA4CF094C7304DF565CA932F72D086A2A637AE836438AB41E53C7B70320F9ED51148CB03C615DBFD27D55D9EF7AA908A9921505E3C94C8B4AEDDEB3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00014EE2506CF129164B3B30478B409AB335EA19B88E0B009CB77A9EE942477578E0

Previous signature

4E14BE4EFB02D6EC474BC6488DD0AA2DBBB3187BE45B170BDF02AEC96D4EA7B731922A60C2D14ECDCBEE3D0101F2A09880D6FFD19AFFA68E3EE174E1CA9A9309

Origin signature

3046022100CDCF36C61B2FCAFB32223D1D67B78915079E85C90C7849AA21CA77EB9E675B3D022100AAE1BC89F26EBEEF999D54F036BE0F147A48741595C42DF6DB4DC461E6808E4A

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

008493F9370610328C499985D69174E9306DB33E81EF9577B5EAE4A298C0FF65D6

Coordinator signature

12475C9D34FB4C405E7C3CF8E644392DE9AFEA427DBC3A759E1B91C040B7DDA9F03418C0563B805736CCDDB499A1E9CCC51940CF1046889A208BE741B6A2280B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

D6A2F783ABE8D7BBFB7C58B7D85AE4EEA8E84EB134FD0B64F96D3532E026C95453ECD62B14B3E3E7F6BE902B69E1497744B45099222145DFFDD6B254905EAB08

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

893C53A21B5EFF2D40EE745553F9689ADD1413640DAF9030EA51AC72E9999FE837F034DE2158FF0BC37B9B45C98342B3E3BEAB2FDCC11A7A0D063E475DBF0501