@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1704390780 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000041A175F53C2CC456DA2C8198377068A2E3F4F59B9A04B5CAD677EC43F4BFD081, amount: 20
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1704390780
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000041A175F53C2CC456DA2C8198377068A2E3F4F59B9A04B5CAD677EC43F4BFD081, amount: 20
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 < 1704390780,
content: Crypto.hash(String.to_hex(secret)) == 0xD387BA06D34A612B072476BA3C318663DA81334C880D980E45939AF6FA4317F9
]
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: 19.94
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.06
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 19.94,
end_time: 1704390780,
secret_hash: 0xD387BA06D34A612B072476BA3C318663DA81334C880D980E45939AF6FA4317F9,
secret_hash_signature: [
r: 0xC6F8FB14D4CF830605E1AACBD192035BB8F4FBCE1CACF42EEEC9E3B676A0EFDF,
s: 0x57ED728BEBBD1DFF24D34517C2546E063AA9EDF59272EF7B760E41CBECDEC483,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A2487CE719F7A6776405639C4093EEFF56FE3AD73213D359FE8813F1FB44C5640B31AFEBFF34DF095598FAB9743454648F32F79C39785FF6129F1F34
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000EEFA...30EAAt 2024-01-04 15:53:45 UTCAmount 20.40427763 UCO
Previous public key
0001C7DF789B1EAC8EB3AA4A4E47A7AE7F511891AC6F8D0D152A09CCB087A4B0C7B6
Previous signature
977B7AF1F347A66B995F3FD8B4EE57368713329F95FACABB22666253012E6D37F1629469A07AFC56144BFBD734AD8F608A534F12C73E7180B6C73EC9CF87D90E
Origin signature
3045022062322A5498F126CDFC2388DC6C054FF8819CD6121E254EDADF5770C8200275E2022100E8BA7EFDA708E48B1CA95BD7E7470AB20B33CF894CC554720C1B0B4D1194682A
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
0060B135BF8F361724243DCA3A62C287B7F84BACEC1C84BBE421425E52296CDA51
Coordinator signature
B33D02D3A47C8DD2F40F62D10A1E8E4599D782790E8338D529596D14D6B77A6106D9363FDAA2116205E659298061236D25883CBB69E67AB9E35B2842803FDD04
Validator #1 public key
00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A
Validator #1 signature
167DDB2BE80BA71FBC79DF1C5659D1571A57F66F3C742E0EFBE3056F52A31DA961B6859342612393DCA2A08D32A46638E33BBECD0879FA985CB6F1514AB2D607
Validator #2 public key
000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D
Validator #2 signature
F0C942C8824FCED94E35590A316408B45FDF60AC042BF38D77CCF8E369416BA9BC73CE985C621DA61B3B76C82C13A45D70393EC7212A3549675BF1BD33824003