Type
CONTRACT
Validation date
2023-11-22 02:21:23 UTC
Fee
0 UCO

Code (873 B)

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

end

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

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

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.018943
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.7e-5

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.018943,
    end_time: 1700626860,
    secret_hash: 0x01BDF1F49A1CD2283215D11911EC8F276D3BC3BFB389A6B6EBABF71640892DF8,
    secret_hash_signature: [
      r: 0xB4C801A7E86C5066E3143FC423BDFEA74A392FC78C7CF3760C13A588DBC88217,
      s: 0x2D703D76A6F62B5273914F975C1AB9C31F66EBF2C20D2B1B985D4CA5E25AEC16,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    315904D25276C263C8C78EE7909B763E9AF556236FA62CB7D2A5E3FA4839C9135771BB4B3586AD46C060C54DE90CEB93C764941B87C2F89D0DC58C21

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C4AEAA637C4324CE0F26178A4BE455F957C1A67D6197B061E1C8E8249C07DCB0

Previous signature

A27454A98437F1937782F6B13FE4CC0B4F31B2EF49C1EF81E0D382BC5D84423444941D1DA592F95EA5C342A09F8715CD218EAED17C08230D6279E28616EFC10C

Origin signature

3045022100D75E0CE7A5C9DA5B1D68835FB3D1E3629ED108A9A2BF5A946655189D2A611CF80220019823ED0A828BAE0DB93631400D90061003B5BE187A698329506D1C9442DC28

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00A9AD03CDD132ADDA546C22BFC736853E2B01CAD3AC438FFCEE4680426F757F53

Coordinator signature

674630E9BD537D35BC3E2CCF010593116F452707711A52ACB64F7DB62A3B5A3ACC9898FC2090C42C95813A887510F08F6D75AF984DA5A92C6BA6609681B14208

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

F0F985517E332E6B16F3EBBC43B51CC6D87381F81B5CFEE116D97EC5A6212268DC54945390577D3A1F1DAA7EDAF89E41ABC7C8FDE5BDCD8852BE40209EB5EC07

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2AA4B4F45A245DD013C5670480097CDD9555C93BE5165FBAFE20B281885B8975F391D65A45C843603C0DD3B2E470720DE7EF824B2FD0303073D7777901656807