Type
CONTRACT
Validation date
2023-10-30 11:15:16 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1698671700,
    secret_hash: 0x4AB1BD7ECA324D9381C0898B0EB5E0B92055EF2A915A096194AF8FCBD1253408,
    secret_hash_signature: [
      r: 0x36FBCB5F004A7B72203E7DE2DE2F8D9188AC1D15823720A61F6045B247D90D35,
      s: 0x1301E62E131255492B4214DF008A921581FC6CAAA7539F8CC2649C5140D24EFB,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B0A73271FA49CCEFA3FDED5E72F0238C45DA09FA1A0AA77A9B19284A39A03D9A7BDA68F1221A014D4ABC9533885F94DF2CD67D17FC0EDB862F1A2F4B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001ED925CCDC0DAB23DF6169BC29DE2CC6EB27D1F9DFC64BA9CBFDC94453AD7E161

Previous signature

FA15C4588A91E4C2424964CEBC9C7A11F30C299E97D4076D5F086C44B90BCF61ED8D6AE0E0A4F692F056792A6BE7CBE3FA27C26FC6A65E24EE3B4866A06A9709

Origin signature

304402204F49041456ECBDC51700C767BF059D1E12DC63036D25DD0CBF1CBBD3241E4D60022046148CF93287A6F6FF63E9C21147CA8BD0241C0E61DEF731F1CB6E7CCA59A49B

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00BA2682B12352C3EE54D7DD6D94F2B00C8B7F475AAF3CEFBE37FA461B1C82FE95

Coordinator signature

734521BF941864481BDC384B0CC5D04A7FA259E50D015B7CF94783AC7D65DAD59100CE75740053A7B78AB0728D763074B50A9514C4D95B2146372D4981E6E50A

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

9785349AAC6CBA53C6CC599EF52858C5D50CD5278E6A96617ECF9C9EF2BB999B7C5F77F7BBFA7BF9DA7DCF4AAD81345A33652266C3FC15EA4DC6EC28104BFA05

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

FB355ACE65E8DDBDCFA0FE5B1EBDB892E7072B1D8873134D9E06A968F2FFAB804271698F1EB5A5940F2F568476F5D14DE4907C32DEC0C95B9C3150EAE8520209