Type
CONTRACT
Validation date
2023-11-12 15:38:22 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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: 1699810680,
    secret_hash: 0x90277A67699B44960DB27674FEC18E7BD826D59BD3A492D6CBDFA31435B8CFD8,
    secret_hash_signature: [
      r: 0xD33AB46351DF235382C4ECE7E4F65D5E204C73D51AE69684A7E9C95AFE44369F,
      s: 0x4791C3C087C35A0253EDD00D2A4FB900F05C383ACA40D256575D4486268AD587,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D6C7BB5620AEFD5329698A1DBC1DE60EF88E4A390FAE4AE64390033EE73D4E60BBF9A14E7AA0E3CF970C14D8BA34EACE36C908B1112F7B17B557752B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001D293D44DBB10B2B5EC07FA068A4C4A9ADE57FE9943137007543A1D0F50620616

Previous signature

B9A5F152538F8C2AFDDD046BD236D75191D1735E596BCE5F168E0BE96BE7F904714B8BE8E565DFCE8BEAE509E86C4ACCB370556AD8B0C81ADB88FEDB6CEA310E

Origin signature

3045022078B055F0E6B614C0507DDC59CD1DE47489872E265C683BD5C33E57BE00055E800221009D1F697C37394961B29858377A694A96E1DD10A54FA95CFBC506182BD775D82B

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00EE449802D0AC971B742E818AEDACB2D02DE172E17A0224A5E59927D072DCDD47

Coordinator signature

36909806213C64A8898FC1FFC1251BC57F8076DDA6C5F9CDF0AC667F42428E1A8E646E94CAA30A8C64AFEA6D16BF67F4E042DC925148BA5A1E36FBF998D7C903

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0D34D9F979FB936C20604764AB2119E2AF65FFCFE7B9CFE810A6020D08E80BA0C7155C2CE1C035319677A9EEA55EF8028F9BDE79C2F0099ABA75C141D0ED7F08

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

308C4B6B599B55297C9370B25867633A00711004A0F08CDB37480E899D557A28AE8E03486B1A3419209B6390539158188AC97CB712A57F701491743CA859F809