Type
CONTRACT
Validation date
2023-11-15 08:07:15 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.1994,
    end_time: 1700042820,
    secret_hash: 0x0C1AA2CBD5E441E4B7A721D82FA9861F67CF47435BEC08FB76B7CD4C0AFFAD7F,
    secret_hash_signature: [
      r: 0xDBA0EB512FD9269589CC5F42AEBC76580E7ADF4A4BE3B2CA19B786656B05E4E3,
      s: 0x0CEF7BCDBEE7579FFB7F2EEB4892C058296C289C3F8AC6A1B8A552937471C647,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0CEDE8D60414B819C63EDE1E160C956FCFA3BA0991B01729CD5FA3FC751C9A14FB31E68290017CFA1C9263E6D3B4E93DD328D0EAF041E132C36801DE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000189C9C66C4D1674955AED5A8BD05E4A84495FEB876E461C4235A507C5FFF19970

Previous signature

CD07EA910CFE277789449AFA32184DECFC84B2F4799735B2FE8FAA62768E8514D5AA77C1910894D6322D2EDA0D5A8468D7C7349CCDE7BB791599569309AF930A

Origin signature

3045022053DDD217DEFBE0F87301D406E4C44089FFBF5A24154D5B6AFEE62C9B6AE148A30221008234D11096930A889EBA855FDD1B6B6E82F0BCA16BDB3D64DBE8207AFC3804F6

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006C0A573C6F8F0B5E754EE659165C5D0BE009F40D78118409C18580C860BBDEAD

Coordinator signature

4A5F6B84A5DCE04DEE71A608FBAABDA56B9E7AEB9C4CA481B5C6766E69FD10D2DD5C3587A9C8B8A6824A19ED8C297A8049CAE44CDE694C032AA198056EB49307

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

3BD7D4A7D9B89F6469BEE5544320212BF46A58F5B327AEEAE17A9A41132B3EF037468657C3A802D4934278E7CD5ACB955BB1D6879A43024299A50A45724CA603

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

889597C02686A424B038947FC6E5240F2782D3D376234E0E161775B4DD79CA4387FF2DCF4F606087417170B599EE690C24608E1D491DAF37D61AB23801763608