Type
CONTRACT
Validation date
2023-12-29 08:26:30 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1703845560,
    secret_hash: 0x41C15C82DAB07537E3E5C55DE6D7605D7C52D460D5A236F40CAB3235662050B8,
    secret_hash_signature: [
      r: 0x068F5263ACD2ADFE24CAC13A9DC26A0BA877D29E3FCB7BEC8625EBB30B9E0711,
      s: 0x36280691060979639DDD1ECDAB1356CD46CFFEF9E199416BA22C6CEBA097DF0C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    92AEDA445390FA192D646F3AD0F03A5742CDAF7E95399BCA1A4A0B7912F5302B43CEE4793F9183412287A52249EBA39EF0B7E6CD8CF8D3F4713116F1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001FA8B7C27EEDC344E1107BEE2F12EE75B882C2999C86F0C1EA763CE218326C2C0

Previous signature

34CA927DD4E497F30FD305B6D674A360E347B8B714476827E8BC701C6E3E424DCFD427750CCB2F44AEAE8AACD1F9DD81E2378B2FC9D982FFF3FBEFF5D8D08D01

Origin signature

3045022071CC4A42BBEA60D9077F5E320FCC9F5F7FC9022FBDBA0B1EEB18521B7DEE3554022100AC0C120A6568DE139ADB581FE2231EBD59C90AFDE8246C5075B597C9E6CBCDD9

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0083314DE5AE802120519031A230A1169C34BB7D221386BEB87F149A26DC873309

Coordinator signature

CE04A81F32EF9B4956D22EE8BFB56C3779D47096E3E048B67A4FB57C36094C7AAA44C9674D7AED94810765EB44C2EAA4F901FB4DF8AB8BF3E4D5420DD528ED02

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

C67C7D22AE7CF5EE1E6E5A6566539D6CF43DCC71CEDE914BDCD82742CAF9EA9B4E0C41B524C34CBD6D116AABD2C6BB8675B9DF81BCF69A10B2387D6660643709

Validator #2 public key

000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D

Validator #2 signature

5716D76A7E2890ADE30656916F4FB6384A8E754E0CD78C916819F5C44D19CCA35DDEBA279A7250CCE61485D031C5E47CFD2A2E720CDC45560CD22B6B71EC5706