Type
CONTRACT
Validation date
2023-12-01 08:27:55 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1701426420,
    secret_hash: 0xD345B5EBFD8E6A51CE2EB61ED2D804E6CB4CF3C3C134EB1BA019A08163492C25,
    secret_hash_signature: [
      r: 0x06E5560C809B9ABB8B1F90D845B81972DB10716DDDDA784DA4EEFC76521474AB,
      s: 0x3257EBE2519DA2EFA0FF7BC96011D4E03A9DACFC555FB54818F49B1E15A7BD81,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C13955DB7BB002E85E463B3514B343D80FF661DFDA8E4B7F25527551B0E23ACF7C7C81F55D8F69A0AAB896CDAF72528085DCAEEA318372887ED0B288

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013DF34C8BE774DD3703873C2A7D73D16E4016C8F5FBD0AF914A77AA5D58D7A25B

Previous signature

FB2A385E7541276DCF9B2EB99EAFDD58756DA80E7FB7BC2F7641C5DF1535C9954FBA92364D7983576BDDFC4BC83092996CD02A1891D3D9F25202B0D74A1D8E03

Origin signature

3045022059A926504046FCB403A2484B5575FA966F09274D6A3949EAC18EB4DFEF1D23680221008B4F0A009CF9695600B027D65D1E72DACE1A481B801F3BBBD764B657CB9814A6

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

0070BE89A32AF483C0427F75A1B268EE5F0910E5AC1AD4DA6B3984A1CB57EB8DAF

Coordinator signature

BDACDCC0CC330674CC9F8791A4206B3E42C878A0C29F3ADC5E07238EE44B3C1BD9611069524EC402E7543052D5BB028B4F5DD5431E23F20984F2506A14622B01

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

BDE08523A83C0B2C7AF4EBBEF2499E0EC492E87224A6CCE3A7ECC9B490AD0DA3B9F17FC0D8210BCB855C5072E27A3E27589F72E987499FACF2FCFB574601A20E

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

D3869BBA15669620DAE81301BDBF191766F35200F690BFE1EA5F720507E8468329C97A1B652BC30911B5653FDC5AF0B7998C8CE2CB883E384E44AFAA268CF30A