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

Code (866 B)

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

end

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

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

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: 1700068020,
    secret_hash: 0xC777D0EDCEB0F052EE71543AF4D9F56F5E15B50128CABBEFD1717D0F05048157,
    secret_hash_signature: [
      r: 0x5D9EDFA384BC91427C4D2249F5F909FB3DDCC2A28F76DBC18E13574B73A5C407,
      s: 0x1E59BAF2A8FC54FF41C49FD5A3186EA2DE69FF1E7E3208238574C9BEDF326338,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    2BA9CCF089488B0784707D06195D0C59A778352A3FF165CDD3D423EC73574EDC3E48D69208194A34EA4CBE2806EBEB47929FED19C2BB96A0C33F1B4A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001EB6B902C1A263F9E238059359C5E304541FB4FB501D5A8F1348AEF9B2685429C

Previous signature

E05085DA2182AFF5AA14DF29156C6E3BFBF6AFE1E541533A0FD857C1BB8A7FE700A62377F71FF32FDE29349B8ACC389D0E06336528D3143BFA4531B7EA535702

Origin signature

3045022004EBBA9E507A1FB86B50BD8E37B9D93BE6A55E822A809F03EB14FEE7815DE3680221008282F4730F302BF104AF337D3E0495F079725E6435EF0AAD9C98CC68C988C5D4

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006EF3CADB8C8FC0448132674A0E9590ADE193ABDD6D22A127B144F841A4D41EBE

Coordinator signature

A79B97D19F062FF8F1E0A4EA6D15D1CB2EBB3D0F1C3DAE0283DF752A460FC364F39B6D1D257015A185DF4DF7C57AD016FCD5FBB873DEBEEE49BC0A70B6760D0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

F499FDE3177ABEF150B798538F103E944A144D0ABA1F4BBAD7059A1B543C61228936FD274EBEA412486EC049CAD298814FAEF72AC170CB2FFD1A4D4E405FE801

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

1BB63DA0ACC6AB667A28E6F64C4F57A65860591EDC30879A16A02AF9FEE80CA55801F506B471C908D3FA7DA685371A6B176329AE1177504AA223AB36F0FAA80B