Type
CONTRACT
Validation date
2023-11-13 18:16:14 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1699906560,
    secret_hash: 0xD1D194ECDF062F8D9EE7A772D6013C56B6FA185386805156E6BEA966057E68CB,
    secret_hash_signature: [
      r: 0xEB4F88323DC3B17407972B72022F06A9D810EF105423F164C1C5DA8F508CF952,
      s: 0x1234E7F137D059E96CE87FEA257859D3ED8D741128420F65A43F354B3D368482,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2082BD17C5AAFC98F16F109BB41279A688608B72C181C2FBBAA96CE3864A9217FF1CAC2E5E73A2E1040644648B28F2D06717EE7A187AED1FADAE3803

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000178406105BBFD9C04AEB1598D6F4DFE801E7DBE641830645593C3D3A06C2FA477

Previous signature

B16E2AD0281A9C8C8E214DEF66B45D738AB88044460942E88B4B155F8C2FE4D3CDEB620893214D67A330CE95046212BA42C70C6B8B92CE7FEA219E9CFDA0640A

Origin signature

3046022100D8CACF3D4F7DB6EE29087B56EEE2228841AB726E8EDD7B001118ED5E0DE97DAB0221008111DD029BAC09AF4C477A3E1B6FF8F4767865DCF6B5F71EBFCD63DFA2A13199

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

001F35670A4FDE0E4A9B30779D8E1422ACF53663A67ED474E101C80D9AE9074834

Coordinator signature

0127677D8F88709F0483ABD550297646C2BD7E8B747952E58FBAD49179323F323DA277BB40E13A2F6D7836522FB8FE11B19A429F958A9AFFCA0C1D57E36CD305

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

549D9D4270FE796948F61DBC9EDB2A8674D0D9CB7FCFE9C91677B1194546FE9768EAA4DA0E787C5EA4E673791E793D35D2749295C339C3363B3BDA7F7C73F004

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

512D33FE40F79D5B4C3113279C6AB9C5D74F22D0EFE44ADE924E80B48F9D1EAE728859F4C35A280EF91B9DDFC9F8612962556D2885612FEDF0DD8417DAE32F01