@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: 1706382120 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0199, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1706382120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0199, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x62946A935C7A1D78843A0F2262B7BD010C8236D31C9B48CAFE8566F4F72C41FB,
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: 0x0000C182FB6506E0E7B62490B17538B6BD873C2C76413C29B2D1F24A47349FB518D3, amount: 0.0198403, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-5, 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
65E109FD4E2D051A5A71F5973546709F5D00A37DD3C006CDB96BFBEAEC863037CD648E38C31DF191D095BB4CB1D6F7D69CB5A8A2B6958514C7FDD65F
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000FD04...2FFFrequest_funds
[ 1706382120, 0.0199, "0000c182fb6506e0e7b62490b17538b6bd873c2c76413c29b2d1f24a47349fb518d3", "62946a935c7a1d78843a0f2262b7bd010c8236d31c9b48cafe8566f4f72c41fb", "0x9ce336082a387c7e81c62f4f581351c1f4e9e66671efd9be2e0b63f7a3a0622c", "0x49f9e3de6356c7115e82065f0e7c8e147343d70f", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009469...1218At 2024-01-27 17:10:01 UTCAmount 0.35570249 UCO
Previous public key
00017567F9BFBCE72DD12190380F0B0C20D716C9FCA8EA5ED483C917AC082F99EF47
Previous signature
CB4AF87AB45AA8ADFB040DDFD4D85AF2E822444D92E6B3620B03682E45878007B07DB5C32E028B6AA990825FB06E2787F49763706BC78E5F0B2148AE03A79608
Origin signature
30450221009BEC043D7DA4852CBAFEEDACBC3B717126F7CAF0F05773057205E69B6D591572022009A3E92A450A32CBF53A8886EC8005ADDE453B61042C5A01DE146F504DA05DCB
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
008807FE6912591C727B7701F1D4129BBD56DB90AF0BCABF66BED9B8F80A3EBC60
Coordinator signature
FC46DBFE529E242C5AB58A2E7F8D5E3597CD6FB91607865BED66C3FECD4C7B8DF15ACDACFA4A47D8DBF1B8758D0BA539480565B7A570ADF326191AF7F66B4A0B
Validator #1 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #1 signature
B2E1B8EFB0A64A9BA53705B295FD550CC82553B2298073E818CA472F74B6E6DE533288BC1A205B3DDE628CB5515986046F52814C0B2E5E34062E90CF7F7B9F0F
Validator #2 public key
000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0
Validator #2 signature
4E62D2406C1DEE6770402F80AA2C3B149198D2FD6BACBA8D155CCC14648BCAF18E37F53328D829BB1AD10D34326EDE272F2175A63CE63A4B4068D4BC1135D30B