Type
CONTRACT
Validation date
2023-12-06 06:03:46 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 44.865,
    end_time: 1701849780,
    secret_hash: 0x0E21A0F8D29C44A19ADE29F8112EE23D1AE0C8EC2C1FE5DC4AC1DEE5FBD2A78C,
    secret_hash_signature: [
      r: 0xC4362E855791FD87231489B9B82A23C3217ED03ED421110FC855B6CEC0819BF6,
      s: 0x371CABA32CF3A92B625C5BFBEC7F32AC8B195CE89E54C0B9F30600CC4D688332,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B0559BF1BCFFA67B189349B4D2165DED774B315D193F9315EAAE53E9F16F889E8D9D3E9C2927EB67916D14AB30B0A4863108AEF34A45F8F508A58797

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A2FF1A444B4867B3674735CABB9EA8A87335849DBEE21A6E2C60DED9ED9766D5

Previous signature

C316F706F96755AD4F78AC73C3B52A9C5A1E9B901A5113CA0056BF1F5475E7880E9955C33D7EA2679CA1F717BC8641AA07B1C54A03F8A29FFB0D07F4A465280D

Origin signature

304502204AC3F1CBC89B0728304A65DC4DE1B013DF56D60B0DB0F59EF7043DB1D161484802210090973F6655CA928313F83AA7F802AE2989DCC01FD4DEDF4466CB8B7E129E8679

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

007E36F2D62418A979571203CA51C7926C039A696CEABFF9E918CD83CD1FCAB433

Coordinator signature

8CBF388ECEFA5EA66731D0B8C015829B1470A7984E84FE7FCB689C68417BB11777622C8F33E555FDBC28636F56A1B50E1D24A53DE68FAAD1244D60404021EB0C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

FFD0015EA76D34D8A60386280B400200F52A169D32B864C80B3223404DA5F4626B3EF9311BF4596DA88A764E2A8724F128E40FD69481675D8AEA32AF5E69870C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

A6FC3BA569A28A892BF335F7FA6AE3BBE1CD6FAE11EBD56C2727F92D47F2C0A20FFFDD746AFD0790938CBB26DBE1254C62E1D30F53F2FDD2F782B302DB1EA908