@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: 1704517500 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.006965, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1704517500
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.006965, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x8C53603701AC339AA927CC2B365930886461EF805D37B3AFF01DCE32A296ACEF,
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: 0x0000ABB47BE0785EFE3FBFB1328C6F7669B1F2060A52290AFF709DDFA53ABB28087E, amount: 0.00694411, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.089e-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
7BD15026A901C8A8661161167C2F490A3074923BD296876A4ED7E26299B0DE1151F2879B01B6CCB6C91005BCD1CAFEE0FD25BB51EEA31382CAFFC5D6
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
-
Resolved 0000D565...E541request_funds
[ 1704517500, 0.006965, "0000abb47be0785efe3fbfb1328c6f7669b1f2060a52290aff709ddfa53abb28087e", "8c53603701ac339aa927cc2b365930886461ef805d37b3aff01dce32a296acef", "0x1f28fff9ceba3f16a2a268dd4b9d3ae9a8934a2966db0318db8c7b34e3f59d71", "0x0181e2269600ae12b5dbc32ebf723b1288100036", 11155111 ]
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000056B7...1AACAt 2024-01-06 03:05:37 UTCAmount 0.3610306 UCO
Previous public key
0001E32A2A1408AC4D64A804380AFEE70F0EB43473CFBC2DAE71FD90B7944F42FBC4
Previous signature
ACB74ECE73D7DDC4B42ACD37131F7D5122EA73A1EFDC2E544C66FAB315334C55DCB605A130C38CFB5BACB8B351C96913A49F977F9F0DD135F83500025D1ED106
Origin signature
3044022042786D93E0D2CE72231E686A663CD17F5537665C835DFCA7EDC562A8F01C7CA7022004CC16E715C26CDD9DE912D389F8C72DA10E8F416A5673DC6A04E654718F5B2D
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00B9538FD91E188235B263DC98F8DFB520987C2A6DD05697839AEDAA02B9ECFF00
Coordinator signature
164B3031E83C45CA60A9738B96FBA41B6B7FCB3FB93E0E411BBCA41261943DA77CD260A705615D9C1219B10B0F3D108DCAF86FAD3819730A3F66490C80FF1E05
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
F0CDDABE12FB46A2B849E83FF5A42A77885350B24FE66BE75F5C0B78FA4ED455AB6DDC3B4546158F6CD86CCE0567CBF4C3E7E2D573D258AFFB9CA061CE0BC009
Validator #2 public key
0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0
Validator #2 signature
2E3C2ECBF79BEA22D710718BFC4DB402DB759C02C4F54DCC2C5C631D22A863938A5A48CA66238230902D8D70412E3A11D0E02673FF709F9376D7E1AFAA9C2207