Type
CONTRACT
Validation date
2023-12-14 05:06:43 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.7826,
    end_time: 1702537560,
    secret_hash: 0xDC6E80B40348E5CAA853A4BAA269BBACB27D5B7A907CFFFA8E7C9538125ADF9C,
    secret_hash_signature: [
      r: 0x36340030593BB732C579C438CAB43AD649FD2896A63185341083527BDDE084B4,
      s: 0x16CBFE1E46C87AD1B80829F563D7A277E63CDFDFED212626E841219FF32A766D,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    03067052D3939C227E149427FF43A07C88FD68ACF21E21E8CB30241E3824D5A698D7D478D53D781984B05B116AEB364F414E69FEA61757F49192E84F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001850C5F980626920D7FB08F5DECA2280AAB5A6212E4590C78DB0A2BA87F53C9FE

Previous signature

B257E3C526212034F3DDB7A71E665555914A6C226B9D0A8823E7F7C9FE70624BB4E38DE90CB9D422CD5267D47E837B417EE643ED07AE1C3888A071A29E06F509

Origin signature

3046022100B1E0945FE8FEC4E319D218EC7A099F3CB824B1D468DF4FE5DE6128E90B4E77E3022100AB2510432741C3B59132BB4AAD2566E4E85A6293DDBCF9058C5FDA320E19001E

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

001A6FCD34406E950F4F1EB8D53142370198F81A7D23EE75BF2AF35D5BD9C7679C

Coordinator signature

7BE1562ED91BF1121FC9A7CEF5F1053C96F180BFF5E14682218A25C01132C07584B2AA27937C5652D7CD416FF3C036191D3E86B9397C8D812D817AC0AEE09E0F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

740CA519536708AB72CD9D86E6EA7F3128967FB1E696E31460C3DBC6006AC6BE582CB21D35D6BCF3BA61F3E10C7240BA76FE0DA3B350A28E00F0B9ED47708100

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

45D2511E22F9280C106308A0831DA8AFD08767B90F2F241DAE6193414473BCBBEEC89B464F141C58385E8A0F7A1830602E156F03C5166EAFBFFC38A46D097404