Type
CONTRACT
Validation date
2023-11-30 16:22:49 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 1701368520,
    secret_hash: 0xAD136C22CBC2BFA4D8767BED4BB29ED94A4AC417314E881154FD75E68DB615FE,
    secret_hash_signature: [
      r: 0x62F0CF56B6F76C44E60097DD697F655EF9B0D9768256EABAD317DDE3FC047DA3,
      s: 0x360D29D306D9D262C1D8105E24A0D8289847760D5BB6A6380CD9788173E0158D,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    13C3DEA9C5BF8E70BF76388CF5188B457FCACE62E1ADB93AC4AE31471B36815677EB579BE45B6961664DE3416D21FE3B8EDDEBA4F325B8375271BAC3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000127C8A8930A09574D64DC3845E2ED1C9C026222267F8FD3E62D6A50135FD9AF51

Previous signature

D5C3349AA309D79B2355B81D6ADD682F22F4F65CE6843D5C0D01DDD6A8C6465D6A9F8571F438E3EB6F039A04B4B4AF29B6B935F67999D3487170113910DF3E09

Origin signature

30440220523263B975060FE9BC723050A69A578D33A09ABFBBB24EBCA495D93EB3DBADE502204E8F0C50FED617C7A9F4E2AAB0298EBEF497F951648FAD1CAADCD089CEF5A6ED

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00DC18C39B48A89106FD7347EF19D7769FB002A65E68FDB83C731DA26375447467

Coordinator signature

590529D7458E630632E13338113FE949C6ECC972807C1704CA92E0961E31E7BC2512186D4D46D42F8C71572A03E77DCB9B3A3FED800407F853D36CE8BCB6BC07

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

BC273914DC440446E3F24CC3CDD00DCBFBFBC6AF2E2DD1DCFA29278478CCA81F6FA8853DDAA4725BB9317E0540208105493F0B6C0EC2354A63A98C90F4576A02

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

451E6C9764E2949CFC63FAC39CA4AAE5B9C0D3FF0F8ACE009CD76917606E4F9204BFC5FC67AA5032585B4F7EB16E362B1168F355927B11BFEEF9C7457CFECC0C