Type
CONTRACT
Validation date
2023-10-20 08:18:43 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.2991,
    end_time: 1697797080,
    secret_hash: 0x2DFFE9A63635C298E05F26678818FCD12296E53E228CAF1BA5A99F1BB055EE9D,
    secret_hash_signature: [
      r: 0xE223680F7A04CC5C6242E533D2FDE935CA86F4CBD5700DC94726F7418851B87A,
      s: 0x08E134CE775D0200A412C529A9E9B2FF44F5EBADE3F48CE538FE69C62E0E854C,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B7196712D1B6CDA78D1FA8309B25429FA9CFDA12F6710FC8D1C81C9ED1E5DF5673A173318A8505AE1D7DCA2BDBF5636A34AEA658F06935A64353ACE0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CAA98769A9810C2F172A3658EE38C9E786C9D14E0045D339EE517643D4465BDE

Previous signature

1DC86E2AA60C3A8DFD02B329696E506F184D25D094124B63FC65EF4214B135147EC68A12B2CF9B05B210D027B8FE01231B0C7D24FDC8FD8D7C69C0143AB30202

Origin signature

3045022100AD78E287AF6DF294688BFC942C938C3E6761B9CBF958EDE34D7D17DEE12EFA9A0220306893E1D943A6662D5C1D3646DD5F9198328874284946D0A617D39883211BEF

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

008DDFF2E0E4711F0D745C40995A6E299BCA512B2D959DC11F60A55F4DC3B13B9A

Coordinator signature

8E6DEA83E6BB3D36111F2C6C225638C97CFA7E83A1FFD6B0EC032DC192F6956AFC49D3C234BFD0F15C89EA6D8C12E732ABDD8E07DCFEC10D9A2B903EF656B50C

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

EB7E40DA20B9A7E05268955562C2619473396D912A522B36CFB13585A5EEC8B3E68A4F60E0C2B444A529499827877DFF1C239DD250B21E52B4F102E6A470080E

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

FEE5A21FCD477425CE6A532E4815E72ABCE4FDF91A76F63DA0163283D2A5DF6C7D9D4BB8C6E1138DA2E5292F43F3BB9307CB44CD51E578EBA03FFFF659E0A206