Type
CONTRACT
Validation date
2023-11-21 09:00:31 UTC
Fee
0 UCO

Code (946 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700564400 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 9.95e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1700564400
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 9.95e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

condition triggered_by: transaction, on: reveal_secret(secret), as: [
  content: Crypto.hash(String.to_hex(secret)) == 0xA0756758F6509AB24CC6A6D4B3EB4E83830B201D63E655C97A9A33A8B18C7313,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x8c538f273d87f74354d98e6c77ffff9506ae37df", 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("https://sepolia.infura.io/v3/3a7a2dbdbec046a4961550ddf8c7d78a", "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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 9.9202e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5160728A4806C17D06AB89FC9C9A24E9E02BDB3599C66865C19894518E15247BD91BA4306A3FBF3182835E9B8920766B99F7732436349B9911AF5C6E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001094BEE81AD7BF829ED83AAF50B992CA29FA5EB79EB8CF9469F1F02DD21DF3A71

Previous signature

FB82D770D3CB32D36CC908624A364F7A6AA854AA69903FBC1971789E2F1B80EDAC7C21A36B7EA6ECB0066815B034249A9FD8C07D3A061BE6B7F6AA83C1802502

Origin signature

3046022100DA51842F8455E7876F629894D46C3FF2CCA49472F33ED42A393669402DE5A901022100F6D313958DD07924D64394577EA0FCFCA57A13A2A3FD13A494D85BDA22DF2529

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00C34D43F4A413DEFB060557FECBD682DA40A45BB8DA0FE083ED24D8C000BE552E

Coordinator signature

B3D94967BF3C3DCFCC61B32439E1F204EA958F42503DC540971286FE0E629D2D0D70698C5FA63C54BFEFDAC684F8F38B0251480A13D331EDA5C3488B983A530B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

2C47625411AFB9389A009A5393D6DE98FD561F7D850A834C08642760505F5391B43F8F7590EB4892F647D3468CF23A730020C6AFFBB7EED793322D3D5434A101

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

6F5D7CB3831A0FA1B99D2A6CE4989AC13582ECBC148AC903BBA1671AA767F83F70946D556391E33FD5764A6CD4DA617A6A68CA5D7C0249720616C84F55F9DB01