Type
CONTRACT
Validation date
2023-11-15 08:34:07 UTC
Fee
0 UCO

Code (872 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1700044380,
    secret_hash: 0xF56397619ED1E5E03D793D6CE6292CE090E81343C97D75BD330F5F54306945CD,
    secret_hash_signature: [
      r: 0x04119DA679E205BAA52FA42EE339FEC189CBA5851A605BE2CBF00AB96AA2BCDC,
      s: 0x61569CB2F9A1B58CF5E0F6196911CC4E49E4A8DA2F12C24827FF2C7E41493187,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    32F2D93155E2F86CECCB821DA0D704D5B16A2CCEED380DD7E9328E44A344B339DCB5CA2D6DE857619F341CE212C5F4E6EC7A3A76C65F777F9908A2F8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013311E5C678432CB4404E77C7303C858C8BA6EEB22D4B7265C47B2DDDAD9A8710

Previous signature

6A6A7F9AA41E525B1754CA39336150C7E0B138C56C6A259AE83D5D1B5E61983691AD59EFC04B82E7657449323A08C6035725C2AE3F652002A65A055D8E666204

Origin signature

30450221008B3DD1DB054A00B2C67EFE63B5A965B198C9D2303730F1E1B76B8F561273BB58022071DE36DE6B26BF65028108DCD8161B0D31541FF091FDD2724D46976B85C4B391

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0089A5DCE878CE62540470ADDC14AE4D703105688003B36DDF15723FD04268C275

Coordinator signature

55FFCC5D9FE709DF929FD6B82CBFE0E94B29BBEE1B92E2298DC24BF999F0BF6FACEE397A5B7EE0D40F5FAE53433C75BDFAA93619D70380F8B9EC03DC5ABC4D01

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

9CBFD8765A4B8396003F6ACB004866CF74551A76DAAC4C50C684FDAFB42F383B5BFBBF348F58DA3532DF706375A49F49CEB32D818B5BF86ADEAB2543CA59A905

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

237CA4E9CE19F5908376C759B84923D3E8FC451D4B2BAF8EFC3AF05767B74311B207053AFFAB109342B965E5BEE2665B53FDA2BF9E32C82EDD0DC6A4622A4D0E