Type
CONTRACT
Validation date
2023-11-30 22:25:58 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 221.334,
    end_time: 1701390300,
    secret_hash: 0x560AF274354AF8F8CEFFACAC0EB58EF77C4B447070A20A4148B5AF81C5A34189,
    secret_hash_signature: [
      r: 0xD5C994D33D308962B40AF8E3A037C004B4A294961437FC9E9E29CA2A30E0DCA4,
      s: 0x06642197AB49F23CCFE32D569DFC7172C15E5BE1018E273B1D57AE635A9E8AF3,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C0E64A13C0F0536AB7934995B9A8E2C87390FB5C43D77D48175AD361B30AC3DFBA53F96178F3D0EE8BF76F6AFDA24573000EC4F7BD58603C62EA6BE3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001FC13F365562716C5FE98B21200B0350E11B08B53CB352886DEC645AB09DC4871

Previous signature

E247C2AABE77E55179876B229036F9E4A5AEE2653982FE70573E8455A582199D9225BCC356138D96D25CB02D80E3F197CAAB39DE1D60F50C7372519700314205

Origin signature

304502205279D22CD81035DD8AD1D8D75FACD7B2E930AFC00B1D3232868880CFC941A69D022100E5067A0566AB62A024475FD8BCABBB1ADAE096238A05A89ED783FF7690734111

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00686B820A2617AC6B68AE54055B9B5D6B37322AF4C1BD0636788E6BAECB71EB9D

Coordinator signature

C61A92D73676597A2E46F9C54FA439D8EA1B92B47FF3F3710039AAD47D44CB19A5E885AECCDBE9952AC3B68F26CAC941EAAE6FF15858180FD85FE5A132C8CB0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B2192B62E42C0DF6E4B19BE4EB619122BAE2FA26AA03CB461131111C62A22E8571CE35DAB06986C06224589C7BD019AAE0B724839EDE28F47FE0577E603B1906

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

DA16F3BE39FBB3EAC04CE8BD9058BADE7520D821CCDC6F884A6DB885B88DFC31E892E517245E8DB07F1F86C65F7B069A46E01A16707E5B338FE7CB9CAA491708