@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1706384700 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000FEA155AEF688306C66CCDF1B83DB3429E948EB5F57C006128669401B9B906720, amount: 0.027, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1706384700
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000FEA155AEF688306C66CCDF1B83DB3429E948EB5F57C006128669401B9B906720, amount: 0.027, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
timestamp: transaction.timestamp < 1706384700,
content: Crypto.hash(String.to_hex(secret)) == 0x9EF76FED382C62B7BA7B86324338288A45353637EA482117C7DAC97ACC803C65
]
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.026919, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.1e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.026919,
end_time: 1706384700,
secret_hash: 0x9EF76FED382C62B7BA7B86324338288A45353637EA482117C7DAC97ACC803C65,
secret_hash_signature: [
r: 0x2D2511FA23FA00B4778DFC537813DA339041D7A2ED070D6C7EC2820FAB57A99A,
s: 0x29DF7784B11BC74ADC7A871C72BB409FD2514134F909E0C3342FA5C3FA75DEA1,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
99C5DAC3F313EFF9CA4A8C89BA95D5D5DCC43F9F4B21E8B0916A65D0E8E46922C4589D458872FF11C57726788190BDF7CC37928361AB11247883F552
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00005CBC...3224At 2024-01-27 17:45:20 UTCAmount 0.42322208 UCO
-
From 00004A9F...7333At 2024-01-27 17:45:02 UTCAmount 0.027 00003DF6...73B4
Previous public key
0001ACC4FB05EB62F00F9AEBAD3451A2E345A2585E1F649E4569692F492F60FC2A9E
Previous signature
7CFFCEDD0B85AD145E054E41579472D8BE91392467C27BF7AFEB0725A3AD5CF926BEE4A404A85BEB100782A12FFA0764863F9D401B2C3FCD09CCFD4D8743670C
Origin signature
304402201577BB4F7F52D0613F3BB26C83A508659ACA7A15574F54B97189DB2E784FBDB602201D8D0D95DC70A09F23FCCDD04B30C8C62CECDC26A6736672069ACCA83D955142
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
00F38B992193CBC17590E7E3BE64B681AC7F175C617421406936B4FBAA36A0356A
Coordinator signature
98D940A8A23C2B2EEF0AC5CD44C04C442A8F57E7C13815101D81B99DB9A841AB762CA220C0DDD0001E116E40447707BA273231ADAC589810E02CCB0B9EE15008
Validator #1 public key
000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D
Validator #1 signature
0D7EF3D6E203E71FF1E8CA6DD84317DE656B3425C85BAA28D95D46E84E360BF300A3554C3D062C80C2AC767DE4799CB3D8564B711822D83432950A2FE9AF1D04
Validator #2 public key
000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0
Validator #2 signature
C9A81248E8DF17210F15661C3C3817C1E227FCBF9AC8DEECA135A0C1911994599C2943813D7BD40A5EDD2337B974AA0571AD99A2E64B195154E7EA1CBDF2E305