@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702047000 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FC5DC578B178F5C4F099B5886BED6EF94D4707245D25AB30CA63514FA4CCBB4C, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702047000
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000FC5DC578B178F5C4F099B5886BED6EF94D4707245D25AB30CA63514FA4CCBB4C, 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 < 1702047000,
content: Crypto.hash(String.to_hex(secret)) == 0x95D834A41B4EF8E7AC749C5E1CD595DA0F13F7A6D6311951FEE14E3F1CA64A65
]
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: 1702047000,
secret_hash: 0x95D834A41B4EF8E7AC749C5E1CD595DA0F13F7A6D6311951FEE14E3F1CA64A65,
secret_hash_signature: [
r: 0xC63821FF01580B1BB0F9D40F10A13DE67ECAC86A65237CAF3265B06D2B5A13FD,
s: 0x30031E06CF891A2234F7F92A0CD08AB1C79BDD1BBDC9447ED0C503140C24C0F3,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B259A02826739A67CA9040F3CBEC0920C645ECFEF3D509375F2FED0EEAE0ACEDFE974C160A7098AB55D016F7BC8A0C8012A57E585C008DC7EBE14F48
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000029F1...E299At 2023-12-08 12:51:01 UTCAmount 100.39568018 UCO
Previous public key
000114FCD1F9BEF7B29D57FE329AD1D54460288DC3607B14B54360CB9B30E47B2E06
Previous signature
7CC86339198410A7F53D459D3203872000342E2CB2E3408C698C7E155DF30274532AE13406855E1D7E90EB64B003E48DA86C04B81F034B89E497F51274396F09
Origin signature
3045022100A0FD7A9BC5F9C7143551DBA83453E5568C5C4E7E47E6738CC0B258C0CEB2C102022004022F9ED071F061B632C1F801F735F649F0BC7AAC0ECA17E339225651444C05
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
002B1A65772BF0755D856192F27430A9B0A0A906B9FC4744609851454A95EB8A82
Coordinator signature
838F5534D639C9840F23D1991975B1DB3671EA6D280F4B4EC86765666A9640499868139769B8210F4C8BEBED6F6F4076A8279D54F833EB2729911BFB5D543E08
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
6243355DB9BFE534B3A9F8B93743610D52D64417E06947B72A598CBA0754FF80AFF99C5C9B8D7B9AD7C31BAC8D3C4E6EDA1F63D902F0456CB92600B9768E7203
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
F391A3CBF3B7957F9B1AFFC61103740400CA73FA29988465B67705F18F56B47DFB8D89C06A5EC7A461B1E14B9772BAA16AF57F1A74E351FA1860FA8943C81B0E