@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701813180 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000097688DB84846A56AA7BD1AE0514CCB8F0FABD922D347F7447ED5F6714B074FBC, amount: 1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701813180
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000097688DB84846A56AA7BD1AE0514CCB8F0FABD922D347F7447ED5F6714B074FBC, amount: 1
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 < 1701813180,
content: Crypto.hash(String.to_hex(secret)) == 0xDEA166EA2D3E906B9AF00F2E4A836F352019292B8773205F0EDECBB14983FECB
]
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: 0.997
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.997,
end_time: 1701813180,
secret_hash: 0xDEA166EA2D3E906B9AF00F2E4A836F352019292B8773205F0EDECBB14983FECB,
secret_hash_signature: [
r: 0xF5B07A20858813EA803EDFDFDE4AF58DB4B0FA00CACFE56020430BA43939709E,
s: 0x57A9F5528FE99472914342832CE57B0A1E2791AEA4E6C29C0F1EDA1D6A792B08,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
6CFAC398A23AD523AB254F5FA7EC3ADF716592E9C8B46011D83AC39D8B206564783B331944EE6F841C73FEFED48712A3D76DA09E728E3346A7EE7A07
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000D7C8...80B0At 2023-12-05 19:53:24 UTCAmount 1.4268213 UCO
Previous public key
00012394BCF4C4FB677166DB4AF9DEFD69D790E60F0A04C5E9D68CFFED4E104006B5
Previous signature
200CB0854A1300E82F89997A54456515647C6196EEC0B113D4B0975FF0FAD9D1ACB962590C1DF7E024EF49F38C340D8ECF9383291CB9BF5C46F893B767B7CB01
Origin signature
304502200F9ABAD9A65795B08DB39362422428BBD8249F5C0D6FECA3066C08B967E236310221008CDCB506E114B0D1A689171A4CD01B3CD8E4C6BB179F937801B9D1D7DE10244E
Proof of work
010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39
Proof of integrity
0020CB085EB3B9DBA00BD5C610997E96EFAB2243B77436908B120C21E724E0ECF5
Coordinator signature
163D9A99FD756294A495A119B4EF6970B6276900AE16E7D7CE5BC267EC00F82DF158607FB5AB088E30177D72C68F5427559972EC7579A40E2ED37AB7B8BA9A0A
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
7698894C3403E1017DFB7C8B55C16DA8BD05CA7E1FAE376112CBB78544FF73A1BE43C2C52ABC703F11F49541B507AD833CCD3C6219BB16027F676B33D43C5F06
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
D4C69C53EDADE0147AF1663863E258B8F05A0C355040DD766BFBFE979E114FD17D98C54EB56ECCDFC527E9632CA7A984BEA8A11D3231B30E4FC941004383B70C