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

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1701364260,
    secret_hash: 0x0629F7BBB517E35DC16323C1115F2E4ED7275F7A4F443707C0E1D0220D7D2C6F,
    secret_hash_signature: [
      r: 0xAAF65D65FD38A85147375AB462A57745AC491F64748ABB1C9C23598CF677A659,
      s: 0x61B39D43F7A2FD2375C919B5DE54A44464687DFE1969EAD53E237FD3F3049D93,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    07522C07E9726EA40048338C2F3099CF6075237D284D1CC92E6BB1C5B9ED523E241306CAD2E8ACD4C18711D1C0FE887B54340B1EF26381F511A61807

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D34E70D1DD340577B2A1308782E2DC4C38903DA8246FBB86D111D8CA05FF9D5A

Previous signature

7ECCBD81D2FB376C655DBB414269B1F9E32A31FB402681FABC3E33F75D00D8881753888E145D2E38DAFA0A7C14685A43598DBAD29F4F286DB55913F1300EE40B

Origin signature

30450221009DA1A96E0897B6C4C1920A81D7078ADCCA884431C4F1B259189E7F9092921FF9022049B52826C788A2F25466CFEBA6AEA26F234E589F89B92BE93CCD44D921DCBA2A

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00CB79C7E9B1C191FA01DE38EFF560691D20ED7F4C946C62AEAB0B60551C777EE1

Coordinator signature

29367376F3B4AC90FBF0B382EDCC969F51011248647808D6731BD63EB2F7A84AAF149017911E64BE21B428014B76B95CCB63FB1917503DD4BE836FF7A2BE9205

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

1F5293733BD0E5F9AE0FC04C7676F311FAF563A4837C9CC510CADC47A1A405F8D134683D0190CE11CD0EF4D06336B9EDC6BEB3F2D122E6903E170835B4144607

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

EBF616742F6DD82BC5B77FBDB59B3A12F27D0D2550E4389502248F8F9787453BA1DDA1C15792B83A075D504A2276DC503BE64283F3C43B10CA4FC54C98E88906