Type
CONTRACT
Validation date
2023-12-10 17:14:54 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 19.94,
    end_time: 1702235640,
    secret_hash: 0x39728E3155A6705867D84DAEC91C218989B17D4BE4DB9447BD7237819AE905F9,
    secret_hash_signature: [
      r: 0xCD2FA1D609BE1C3B18B15FBB152A039BA9410F8F8B281D286FCB4E564D780469,
      s: 0x393DD07DEF3E90BF23DAD8218B0EA8B0D9E3527B7DE0FB6294DE3653D5FBD2B0,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    29E0BF1CA699E97B66E500E0C1A1E3EC4388E5FDFA96DD263EDEE5225D788C7F757873DD05400B5744EF1802F7C47906EFE2B0B382EF4452CC424ED1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00015FC53615E52CFB5CA2959FF4E6643B485194647C7668B72645236E93AE3B11EA

Previous signature

6A34BFCA394EE9EF14DCA04ED63B15E002E1D12DB4FFE904B7614E86D4F4FEB494C3BE0903CD3D361C9D8CA6F580B8E447F5FCE028AC62B6E05758AF06E7EE0D

Origin signature

3044022067F4831A4C13E2936E5567AB4B180489CA5CA3B544E785EA73418C6A96B1BEDC02201489A33AEE7868CF8F63E10E276C3228FDB4C18D09139B860923FE9C98EEFD26

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00D978FE289870A684B4829CB3EA29C041A7D0F08780AC0C63FDF2B914E0DF3134

Coordinator signature

A4681B34F2B0380968D0B72AD23F01705610B57FAC8989EAD2DF5D16065C167F12D0A0F0EE48D5F1C420FBF3A0999CB56A19A6C124D93179080ABB0B38DB6A09

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

DC9DFA9AA29DA054891DD40E15B3C913C6C38AFF0956CA52B2365BE0264BBD067E56228B7810F05DB56CA1F050CB25A150314EF6AF75A1DE85B3D2B5596FB901

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

E6C0FA448C3877F771B1AB5869E22EAA63939DCDE3C68B46215732D2D175C918F750E48CF44C1A978DF5DB9EC53AC2F3A9176ECD86A316E2D6A8AC267CDE0201