Type
CONTRACT
Validation date
2023-11-30 15:24:37 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1701365040,
    secret_hash: 0xEECE8E34DA4BFA3405E3F0C0C618BF73041AAD564807D6909FC1468225508897,
    secret_hash_signature: [
      r: 0x1DE41DBE4F7A413B87FDBD2B21F9C8DBEB84BCBDB8D4EBC1D086CC35A82F17E6,
      s: 0x1518CEC1669D298BF923973C5B249CAF0DB440ABB73714F326486E31AD6E2626,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    ADE6818065D151C1946480D427F9A460172D5F1F6CBE470D423E8330E2D46217830B12FD3371AC90757D4C5B145B29CA0B4E35C341E639FBBA764E28

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00016089A8A1E5BD45C2F361AAAAB8F2F01A6F29BF7FA3B195592592C13CE1C194F4

Previous signature

1A78ABA91BA12606CB4CDA03BF360D6D0541C0A76D0CD717AFF85E3AC5EFCC12553A13F2805B4BEAAF79020CC1105EE8A8B7B4AF665A117EEE607195A6F30607

Origin signature

30460221008A3E55CBB3C15627C8C1EA1ABC55E619EF8324653F2E7E1BCBF0740CE06EF9CE022100DD0AA8DDF72D863C429B872DA99CD9FEC89A3A036F58C1D03563EA7490D2350C

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00EC20DF78FB35A2E635D12B10C35B63EC2FA116EE02A792600BE77CB1A10F4642

Coordinator signature

0EC3288DBC04C698D9590A33D286B78D6C0C826AFCBBBB0B9299C53331FBDFCA300A439A183C350FD061D73A5C6DEA6C41C7683C7D6CC09866AF0B8D4866DD00

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

93656E8C6A76478C047804FBC17286DAAF7BD298AA5C45223CC8BD9B897476EA379A54C76760B26CC1F15EC35FFF00F51710108DE235E17E4415D8D8905C920D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

86E9C1A044C35498AF7319656FF52C8DDAE8CD9122E85D684C2E3FB02F5650EEC6C05EE36A42CC23EB1662BA0E7C3948C9A9E5D2F9EB9DE504C6BC9BA9A32401