@version 1
condition triggered_by: transaction, on: provision(_evm_contract, _url), 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
)
]
actions triggered_by: transaction, on: provision(evm_contract, url) do
next_code = """
@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701886320 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.199, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701886320
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.199, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xD25BF430D2D3C2BC5605CEAD4ED118386706E2630AC85C82BD6C43A9868F0DD4,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "#{evm_contract}", data: "0x\#{abi_data}"]
request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]
headers = ["Content-Type": "application/json"]
body = Json.to_string(request)
res = Http.request("#{url}", "POST", headers, body)
if res.status == 200 && Json.is_valid?(res.body) do
response = Json.parse(res.body)
result = Map.get(response, "result")
if result != nil do
decoded_abi = Evm.abi_decode("(uint)", result)
# Withdrawn status is 1
valid? = List.at(decoded_abi, 0) == 1
end
end
valid?
)
]
actions triggered_by: transaction, on: reveal_secret(secret) do
Contract.set_type "transfer"
Contract.add_token_transfer to: 0x000095C077FC3ED0DA3281CED75EBF1F307C1D9244DFB5348E9013B82381677FA9F6, amount: 0.198403, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F8176F02678BBCBE7E19161FE6D5C1E7839BE1E4C9E759FF5EEEAFD73206D0960B5A6977B1E49DB45E5526FCB8EE23CC7A52D2CB0565BB073F4F05C5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000F2F3...8A43request_funds
[ 1701886320, 0.199, "000095c077fc3ed0da3281ced75ebf1f307c1d9244dfb5348e9013b82381677fa9f6", "d25bf430d2d3c2bc5605cead4ed118386706e2630ac85c82bd6c43a9868f0dd4", "0x9bde1c59614a1cac07a0e32d4f8421ce070bd5982466a03b0b50dec315e118af", "0xe9d8f38301affda9b93469e930d5ac0fc78df748", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000CF0A...9E78At 2023-12-06 16:16:33 UTCAmount 0.35460876 UCO
Previous public key
0001C4AD77FD811917BC6F6815D740BC6CEC723ECB4E4A89C645DFFEFCAA9C7AD468
Previous signature
48701E0B351175325E63EC0DDB532E219326848C7C96F146F22533B2A6BDD445AF10AAB5131A24DE571BD74DAEF2C6764634B458379A74E11AFB48232C316102
Origin signature
30440220634A73EC151C357AE6FCD978F3DDBA0E706204E3FD6D49364E2502A083F200340220633C4C7C741545F39A4AB6BF766459E56B0C8F87D2C8FB51B2E0CAF7F78FA318
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
000BD59D0F8CE2ED644BBC6EDC8D7F2401E87D6E394CD293B499B0AD12FA305F73
Coordinator signature
A1D5249481B901127F11C55C7D1401E57C3087C8EF1A5C382E964676D64FA587DC16C06054727C121ABBF49A98A583D1EB92733669A3DE950C5717FED9735D0E
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
EDAF79904D9EADCA144F32242449801242D767529E167995CF5D5F0091DBF503BD19E00C19ED9857FA620C49612AA2AA5A00F3F4BB2B34A8D1D0DC43E1D76409
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
9AB5FDB6CF1873BB0AB0C1D74B919EAA47AE7D2E0D00493EED708FF4171887E6DF863AE6CD4A03AE8269EB00FDFF4E935FFB3A30F97A1EE45039E30A66C8D10F