@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701450300 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000441D57E9196125B36F616319EFF98CDA5B116482A9F57F5D1C9F6805B5C2E17A, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701450300
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000441D57E9196125B36F616319EFF98CDA5B116482A9F57F5D1C9F6805B5C2E17A, amount: 100
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 < 1701450300,
content: Crypto.hash(String.to_hex(secret)) == 0xE839BE38D67CA79E2677CBF6038B630814BA5AA49DC712CBC028323CDAB24D75
]
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: 99.7
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 99.7,
end_time: 1701450300,
secret_hash: 0xE839BE38D67CA79E2677CBF6038B630814BA5AA49DC712CBC028323CDAB24D75,
secret_hash_signature: [
r: 0xFFA5BBBF3B252CA092BAB942BEB1625163D9F8F828807115147D5FF9E23853E5,
s: 0x564F89193B6ACE47F5AD3367B56170EBA6E95B4DCEF7586E6D780FD38081B2E3,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
271FAA0FB239DF1AA58479FA4FE13E8AF93439D5A48A42CDBE873A5C94CD28389FE3D7736623EC7B1921D9869B69FE5AE240A5194F0564CFD451E74E
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00004BD7...D738At 2023-12-01 15:05:35 UTCAmount 100.42832544 UCO
Previous public key
0001755178FC41184652A299F422189C8694111CB143C5B36EB50723C9FD5B6ADE9D
Previous signature
1A9FDEEDA022840EEE4DD5CB40A85570870DFA984FA2AB06AD01C0B2170E0C4716420A4C0DA11538FBE0F4F72B94D90F65F6EC3E5F94186B2810D66E5B98A50B
Origin signature
304502210098F6804E0ED67401F30F1F16FCE2CE29404BB47BBCB63C0EADEBA3876C0F7AB502200AF33C930B95B53AF316C7BF511408477D3E769ED22A478847B47B1741C994D3
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
0090F0FD533CC44A52182FBA020402B2C9B51D265FFF5A0271C2E7FDB911DCA5AD
Coordinator signature
39A50D3BA8BF959C6BFB90BC564FAD7C021F4313D448125E872AE66EE234E676068D88B4B7C4E318DF5CC29988E82625A6CBD71598844BDBDBA9704939624303
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
35A87875D97722E8A1CD03B30F2F674518AA065D2C44CC533967BEC83A922400EC1653F2FBDB08E42ADF86C7BF05D47F5E902C434B1A497C9640F2B2169FA207
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
769A233F5E7E5145A2EB11237916D1B7755CB497C58A832159A6A044F4F2ABA0470C2A86E513CBC52197D136873C62898EAA6F47315CC984A1C32C485A09C900