@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702237500 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FE7C0037D8E66009E288E9F36B199B5C298B77FE607E8A7DD618B13AC007C34B, amount: 250
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702237500
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FE7C0037D8E66009E288E9F36B199B5C298B77FE607E8A7DD618B13AC007C34B, amount: 250
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 < 1702237500,
content: Crypto.hash(String.to_hex(secret)) == 0x21CE0E0F6BCE0042D5EBF87D3891A0873A6AECEFC5FF3E888F84BF7C581E41AE
]
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: 249.25
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.75
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 249.25,
end_time: 1702237500,
secret_hash: 0x21CE0E0F6BCE0042D5EBF87D3891A0873A6AECEFC5FF3E888F84BF7C581E41AE,
secret_hash_signature: [
r: 0x6DFB937F3E4DC2DCA4D2CE7ABB058ABF8E1F41BC26E63F803D56E77ADA4C2A8F,
s: 0x5853AA6BAD81B8C9258B948D73B13F9FEFE8B9ABF96470BB9570909A1DB9D412,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F33F160EB15110F9C01486258BE858A64F7B8AE4A2A06340ADD1FBE956196B1551A6A5EA49312F9A6C4C2004CF197D076675094C1AF99162E9F2599B
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00002F3D...6E5BAt 2023-12-10 17:45:20 UTCAmount 250.42817073 UCO
Previous public key
0001567FE6F9AC3572D404319CFA5E93C9A46AEB1ABE1A01BAA5C941BDACB480FF22
Previous signature
F37D6C2CBF5EF301D41DC4FDA885BAD6031A41996522F1CC152E6DD796AB2F11E8F77D862B31180BA9A532C0F02B7E774DACF189D058387771FD7A63EBB1940F
Origin signature
3046022100C1E1A065431FCB1FF5569DA0C29A13B0F84CAAF34FD3AD4C795D03097A019D62022100A80900D32BB04706483A3AAD6C746C3548502D050A38BF02D5A8B57642175B7C
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
0071258DF59CF3D91AF570D3347C901E4A492D22F9E9987C4C7ED6BCCC819AB6E1
Coordinator signature
07FDFAF86E4D394B95760F124FCB63C71B3809BEDC42AF948BE841D9A1FD07EB2B12FE7963EBB9F0927005EF0DD9AF94FDDB48B27590EEE0B3999610A977D902
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
BBB1CA22A2BB0A355C1B5864CE363BA154178076094D2439BF013B291DDABEDFD91EB2ADCD5B553EC872F73573C94BB9E7764CD92E36C89F069DCA7C29BD5603
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
0ACFF69FD75B82102B5B44732C275041474B5B5AB908E45E3713159D03E6179E241F82591D9FAD922B195C42E3B73D55480CBAA2CFF94C5845397B9A291BC80C