Type
CONTRACT
Validation date
2023-11-15 16:42:28 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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.1
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 < 1700073720,
  content: Crypto.hash(String.to_hex(secret)) == 0x00F355E48BF2C93EA18817E5813E5D3CF52807E66F7511E442580713E1019954
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1700073720,
    secret_hash: 0x00F355E48BF2C93EA18817E5813E5D3CF52807E66F7511E442580713E1019954,
    secret_hash_signature: [
      r: 0x142754BC5CF0C5F95D1B1E8AF19AC936D53EC41076CD604A5BE6093010B36AC9,
      s: 0x2F847CEAA3D3656FF7E0ECD9B2DFFDC5CB586A3246B5B6014B76CBD277D0BEE0,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7C3F742263BF1BCCA9138CEB448506DF8E9EFB7ACF7BE6350B9C8FD976963922201720A5F0D5F6B1ACBF525983EC0679D94EF3CE588A8905BB16F6BC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001FE9A586C918E436BCC04461A29A4E660EED64FABED5BC7C619A2DD0DD3866D90

Previous signature

681E45C49A26BDCEEA06AA0973763DB62F5E4D45E7F76846468013B3B4364821ADEF3C0C660E97685BE6A93FADC3B21551395D9C442DDFBBBDB52045E6B98802

Origin signature

304402202FA13E909F67EAA727EA37D90D21BC65A07D069D49580BD26B4BEDF2629F3A71022045AE32A4AAE2899DEE733FF078C60567A6C941E7701FC0194A90BFE4584E3505

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00DA9A5B6C4F0D5ED49AA6676B65198E0785F902D50B0C2806537C5544A1808049

Coordinator signature

0CDE0DFB5919B882FE8A7E862A2D4D02A3213CB61636B47EF0D6FFAD59DC25DD42C5CA9A81133CC8258D94921B2218255C8F8AAD6AA8173C42F5117CC31B8A0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

10D978DDEAAE0FA21BA91123C7A154982378E9C7644BF3D17725020D71C58E32703A42E8C4C12774BAF0A1C45C54385F163440B159D68815BF8A44CFF5C4C404

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

103B5B2B7706F174E219E72D17B2586AFA093BD2FF9E9D1E2AD65F8DFCC648BF8AC11E3D237DDB08D0E2F35125DC29130CB918FAF59EDBDE7A7262103FEE260A