Type
CONTRACT
Validation date
2023-11-30 14:42:19 UTC
Fee
0 UCO

Code (923 B)

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

end

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

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

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: 0.4985, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0015, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.4985,
    end_time: 1701362520,
    secret_hash: 0xFF6B8E36C299E2C05DD0C05E2B00D00F10A8D16A893C5E3EB2D7DE1DC9273844,
    secret_hash_signature: [
      r: 0x1D3BAD39E8619B934B4DD0FEA2AEA84CB18355D884388F9309DD994768BF739B,
      s: 0x349E2F5DA74B99241BB53DF8823AB74B9B2CD2A56337E779703CEACE46AFB3E2,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D8E32A24F18DF3FF0AECB1C9793DF82DBF49D9C9CA1B4E6D887FE189E4425EC14037BA5761A80DE957AD4F390B159F9ABFB9BDEF52E27FA75AF2E4DE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013145082A479B75238D5D6DE784C69ECBB290C8466EA5D72CA0A83853A3918A31

Previous signature

39404D0194583AAC755F92DC931B099111B5CDC37D8410836D72BDC1CC11550F86B2B1223CEBA4E8EE86EECCFA628823491CEB3193FA85500E3A8DF41C05A301

Origin signature

3045022100885F7BE96ED3D3627A201FE8F689C90847810451B18FBC4515A233301D57BFFD02206E122EB79E5C9FD066CB906447F41F781DEA8D411E77A23F9E12F196A01F9037

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

003EDEC5EDE65F067770C9EFA54AD11A98E2FEB4FCFC7DD5FF09AD64522A1C7C1C

Coordinator signature

72F198688B78FE84940733D763E2BE65204A971C6F2CE6ACCDF86EDBCD3D1A2FAC2FD17F318015A6CF4D536E95EAE068869CDB3E1176BC895282B249EEAE0503

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

CFD8D3F94F2E29FB397D7087C4941EF6EDE851A342D283590A24518F2F7449B24483CF7594E43A1BB84E58C37C5BAAD21C1BAF7E9159D36D49CFE3E0724C5B04

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

93139D41B0C09508DD1D3A319BAC8B492D519A4D547067A412B47EE22B1509279560C294E6FD4FCD68D1D1DEBBB81A51CD01C8D61FA71ECF9E01472E2DB5E00F