Type
CONTRACT
Validation date
2023-11-14 23:44:46 UTC
Fee
0 UCO

Code (871 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 14.955,
    end_time: 1700012640,
    secret_hash: 0x81162F5383237AA257A51B21246F05F2818B615D9D3EB9FFCF6C8D4F40602E74,
    secret_hash_signature: [
      r: 0xA050AB576E60B27D97CDB322C817A960BDB9421D8B2980FC796CA097E392CCA7,
      s: 0x3B8DF584A8683388536165E9973BD903767B1D372FEDEBACA6AB0C5B771B8A7C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3DE78FFB293F5C35B458B5931B2CA476AB82CF9EF8DBEA697BB8938E4E7E20CA83F4D5D79AB5EF5FC3BE92159D663BB0F4E2F25D56F2AB243F0A6398

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001AE2E4431C9F7327BA264CDCA1CC1406300987FF0B48FA431FC92D6915B8A09AD

Previous signature

D3C954849A1C1618A9818D4F17D8B83052E5F3C7709513F49C0C7266834A88D70E694650E411960BACD1C68BFCEEAE42758629FA8B2D835F300DC14CE5012E0F

Origin signature

30450221008F8FA9F120A97403EFDB3CD38C9864A9C1A7A6881948D52F5FB96FA031F0D5810220197B8B64EBEDC84ED992E8CB9F88686BE0D6F7EC918F650BC17CBEF1E88A0984

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00D219BB87CDC0E3BC1627485DA7E079589946499A9C1ABD5AA5CEA9DD4A4D06FD

Coordinator signature

A642F28B1E44516292B8DCF9406E99E7E251D33B03566C86EF5C43A36206ADF37638B627C20CE5F566BFEF5C65C2465CC5CD7231A2E9D4D172EBFD9EBFD54102

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

EA1006179F1A12F2791EB26E7C9B5072912AAE05221B414CA281662266540287F757051C579CD436F81F561A617B38AA26AD94444A4D07E832A848455154B40A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

5CB0C7817E79E9D389BDBC1A9C5BE72D676ACC3979A6EFDD1B3F46423B475AF096E5E57833466860668629D1FC7B8088C823D7CC58C6D8D304F2C0698D6EC000