Type
CONTRACT
Validation date
2023-11-21 10:00:15 UTC
Fee
0 UCO

Code (931 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.001, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1700568000,
  content: Crypto.hash(String.to_hex(secret)) == 0xBCF06D3A12360E9032C55C4189639A4390A538E03D99DCEC37CB410867CA3734
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 9.97e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700568000,
    secret_hash: 0xBCF06D3A12360E9032C55C4189639A4390A538E03D99DCEC37CB410867CA3734,
    secret_hash_signature: [
      r: 0x27509389F34D910C5B8E479A0371F43D8E82EA16033A38C3539B56F55747E88B,
      s: 0x67639ACABBB1DFCD44A043C68035500D3C30F2FBEE3A758DA0FA6F5C3F824114,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    49F10F600D7148B8444DBDDF03E6078174B93C19533A57A68BA330805D018ABC5C0465A84C65AB85EBA02A3817FE15DBD770C20E765E13C7A40FE73E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001AFCDBFF15949E05AA1B5A65A999DC1E3CCC1FF796AC1CC04A494FFD7C2AC4404

Previous signature

03948CC9CD02DC80198FB30046688CEF697B258D5137DDC457DCF096410929DA933977FA9F1B2B09B0405F8CCA50A7193AB9FBC517102B8EA6BCC21DF2A1E406

Origin signature

3046022100DAF76FE420071FA2C7768AE454BC04AD17A9588FF3AF8AC9EAB7BA2FAE6CF72C0221009870FD283B14B5519210A2A7E7BF3610FD0B2B8FD5117B336A5BD6EE42255EDD

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00134660E13A504F80BFEF008C5551B7AC96F90DF66C29F34A73E941738F679BA7

Coordinator signature

F8B792887BDDBA70C26F3CC3C3FC1D0ED04D39ED94CE9F3657D8EF5CBC7329B3DD74F858DDB3BFAF1C4B3C7D2874ECF5E1B87315C81758F4168C153CB9B9E107

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

1492242BC128F9735E4D20A5155C69094FCC900154B58E57A612191E4044799254517F2F5EAE3E9122DE48819E6F2C2BEB79116DF907F9BCAC769D92AA1B9C0F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

B05E603F7C92188550B50FA70F39FF7805FBDEA6D59DF5CF449529F7BA9CA46F81DB3A6B41A46A5B715CA0B4E890D8DC7DF333543BC0FDD82512FEF0940C8B0C