Type
CONTRACT
Validation date
2023-11-14 20:37:40 UTC
Fee
0 UCO

Code (923 B)

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

end

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

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

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.08973, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.7e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.08973,
    end_time: 1700001420,
    secret_hash: 0x4CD983F2B3A76BA5CE0AC733C7175BD15BEA7126D909A3B607EB8DE0A4DE0816,
    secret_hash_signature: [
      r: 0x4DBD075C3B98D5DD896B284C9D746A97AB47D1E6ED1DDFE557D9501A47BE32C0,
      s: 0x010C9280CE03FF7CAE6878FE1A11B89A3A98D0F64B1C133E514989A0CBB99FAF,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    93AD506DD154E4C0602CF21D093BA86B66BE595D3E3B287053CCB46465E1EA13C4E20884ADC66188DAFC7775CA4DD84D20E9B10EBB630F53706895D6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001DB994E03A0A1CE3D27AE942EC43F8F9318A0E933D0FBA946072CCB8F3D88616D

Previous signature

9CE302A05C74520048EDA8C718165B8B59B02938FE3AF9E1DBC0C8C49A24117EB540599C2EF7394A4F64747B77C31B7EC4FBDA6AE5E0635C408643888429520D

Origin signature

30440220787FF30049EE4DDBF27712F29DEFB4B14D801CC230B7097B15BCCF8F4FC38D9F0220559B89D6ED5D31B5C6F5000B7556E30FB6C789055CE82599F47D670A0975E05B

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00D47387B490408DE0F00AB97D23AE53BC14D0DE513E2FA63DC0455B54A8E81CD2

Coordinator signature

854D0311F2603CD84D7D26108D36359D4BBC2D6D6094AFD1661CFD033D15879F45976D90C29189501535E97BC40196D6C0D28836CB72452BC9DAB1E787D69606

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

4B2B919D5BA4D7323CA112F0A0D11BFB57FE8FDD2E55B75B432DFC995CBA1E8E74603899EF55D12CDA9B638868F4C6DE10DC5C66E6F0FE8ACCE9A4D6DBA53F05

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

BFFA977CC9B92CF712513F92AC5007A53F6B5A302BC9187C4FD1C12203EB9A588D45A67C255439C6B9284A0CE5B3EEE6EB1CAEB90ABC6C248F0013D604260F0B