@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701870780 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001CB542FCAA33F7CD10830C54723B35B81731AD76BDFE41B2FD9BCFE677218A89, amount: 0.0396806, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701870780
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001CB542FCAA33F7CD10830C54723B35B81731AD76BDFE41B2FD9BCFE677218A89, amount: 0.0396806, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
timestamp: transaction.timestamp < 1701870780,
content: Crypto.hash(String.to_hex(secret)) == 0x7216B707E9A8D616AE880824914AE13852C2F66EED28DF841EC416740C966B5D
]
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.03956156, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.1904e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.03956156,
end_time: 1701870780,
secret_hash: 0x7216B707E9A8D616AE880824914AE13852C2F66EED28DF841EC416740C966B5D,
secret_hash_signature: [
r: 0x1D0A466B9F95A06C6C408D50C3AF5EBCEFEF76B81C2C4128EBBECB3BF97C4AB0,
s: 0x4B8B6C4344E119E7189BDBD63D2AB63D947706E9BE97D7FDCBE328B6FE4821A7,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
EF2D50C3C2D67958242A88136B7B70BAC6823B8916397E97D92CC07AFBE8AAE97435099DF095591B064B0B37B1B161CFE7440C5BCBCB56C2C2E80F22
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00000E53...A024At 2023-12-06 11:53:44 UTCAmount 0.44293084 UCO
-
From 000063C9...785DAt 2023-12-06 11:53:24 UTCAmount 0.0396806 0000288B...B827
Previous public key
0001B2CF6973BEC9BA17317418C6FFE2B512E2CE93E3A28058638A9988BCF11B080F
Previous signature
0E7126AA3DB74F019A7FBB8403A5ACAF87FD62C8C29B183918BAF340EC13BA888C60182495FA9246F7F58054AEEC1FF76715810284F20D7617ADE6ECEAF81604
Origin signature
3045022100AF9D390E03ED05FA6CA21C2ECD0C9D44272D66CDA7A047C4AF81044AEC915F0D02203A8E79B66BE7186E32D94A17564EF586979A2D6FA67A172FE4D9B68D3AA5569A
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
002EE8FA5139089C031326C42797EA283A02A48061A7A924A85186378B04B9F9C8
Coordinator signature
793B5BF733D11D52BE0D641F0690A5705919A35AE5397E89B897056C3D3DCD30B56ED6F08FF8278F0D9BCE3F391EA96C3D5081754FE8A14AFDAC0AA06271A60B
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
F197AD0CC69ABF1D4C1234FF4D7B521B9E16341270155DD10A67C83A4522A35C99285C3CFEBEFCF1365F0A059826FBD960EA013BF398755CDBF6B336E1431504
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
075ED835D4C539D9E95ED43843271811B274F05E3C45223100A9F93DAE175467D65E330B43959ED73A24BB3484356171DC69B3B3174115A691FCED32854D7602