Type
CONTRACT
Validation date
2024-01-25 17:41:30 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf35e366b5a709277eb886986a54494a07cc5aa1e", 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: 0x0000869E0A51F0357F846FD36618AD57DD2E42A44233E2788B7F1EB543734839F116, amount: 0.00992015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    84635BB7C12A761862146910AF94C2A13E9D383C429F355030AE55043C2225007F83DE6E6B98768C69B58570607F3C5B01B413C7E7930E995DFF94B1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016892B8D39EAA10AF9A770BD08E7FFB418A97F02CD8B385CC315DE3E835C23E76

Previous signature

951A948326F928D837C5A42FA936EACE6C8322D3EB69AE6906AC36CD99BFB22A17AAEDA658A9D5AC4EA5872B554C93B51E6C1E072841953F11829322AB290F05

Origin signature

3045022100936DE79B2947DA08AC1FCB50CCBCE4715DA7CCAE16C2AC983654CAC6E6CA7D2802201810A2C4BB3917CA7F861985FC1A7ED168BB5F883EF00E027ED11F1CC7A86418

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00042CF1F4BBD8BB0C80CCB6E2C47CD5CEA544F2B2EFC6E40AE8D0981CD03842B5

Coordinator signature

6535071F7748026AACD065B52D9F5D9F95EB4F31175FCF3094CF5B4A5FDD7F064403EC3F63ABA0BBC29F198046B7E07717474E1069EBB8552686FC3DCD1CA700

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

DAB4E18D565F3FAC1147F1580B6855AC792872BA33AB696881D2B269D1A18BC624BB8254D62014C85B0E887AF347F8B2CB2CC8CAADA84D31E9898F7B3D87BD05

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

9149BC1894C7CB83729FEFD93BADF59CB2C87C8ECDF9089AAE0F8458DCBBE3E7D2209E8290011A33B336EC37628BEA5D234368C28DFC248492742B036732780C