Type
CONTRACT
Validation date
2023-11-15 10:17:18 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1700050620,
    secret_hash: 0x1DC775B833805AF53D3FD2ECB3942AAD4C5CD0696A530E768662F1638CA61CB1,
    secret_hash_signature: [
      r: 0x7FDF031DFF075F4B6D8B02DDAD7C2D7693205F542239ED6A92BA3E5517769E71,
      s: 0x4283481C012E6FEC6D42F4265BB01DB5EFA2CB1FF0260ABE4ED5C4285F04C991,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    38E3E1F787DA9A3710413AB2E56D8E22DF60D94F82E32D4FD67B9F99D5E9955A577E2DBEE5BD6392F60DD01ADADAF67EB244279BF62C75EE1FFD6698

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000176564EE0E5285A4FC98802792CAA90C788A91B4D8831C56FCB0BDAAD2F10A9FF

Previous signature

04A1A86A16030E1DACF65BB05EE841519F9D8B0D0E3CB0F45CFD48B20DBA441176340713429FDD5627FF850E77CA09283C334A769C9220523F004AA4308BBC0E

Origin signature

3046022100D0AB648799AF8E504C499765A87A18052291321CE8204A9BC454FE484AFBCDC9022100FC022832F0575B78B551DD12FE008BB637363360E20D90BCDBA1EDA5B6A17CE2

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00B7378D5A7F64E4239FAC6D8C8370005211DD6A38555721AB50DD905B875BE614

Coordinator signature

79ECB4C606AD912E693A76ADBCD9AF61BAA20544939F087C7898DAEBC009DA39FE5EEB1BCB3B351BBB21CF536CC80B2BB6FD6E638F26027B9873D23E8F55940C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

95C1FC1DD3719592A97FDA67506FC0BAD40A39B1670432C344C24977FE8B64ABA65E0F8C768FC4CA558173759110182658DA016C80652585441D51D4BEC07804

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

848226268938CF155B43AD0BB23C1C043CEE71A38E07870A762AE4D68AE6A519B00786DBFF99ACE5449421EDA5D9AD03FCAF8C8699E93BEFDC1EA14D3C83AB01