Type
CONTRACT
Validation date
2023-10-23 15:20:36 UTC
Fee
0 UCO

Code (954 B)

  @version 1

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

  Contract.set_code ""
end

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

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: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf75cafc43a36826f7797088fd92a2f85d900637b", 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://polygon-mumbai.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: 0x0000CB30ACA5320066B4413E9D4190EA13562F3225BB5F49A975ABD91CFFDAFED88D, amount: 0.0198403, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6AE3AAE74F8DAFD295E315623978D0166EF48E02C74B0C5C6AF5916D609C55D239A58E92AD2C5804B008E0DAC789D7D8F000375A3A6C975E6938E491

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017C7AC93D52AD7A3AE486EFF77945335B9FCDAF1B188314C3165D954FA46D63FC

Previous signature

2BA335D1A22EF6B6C3DD05D583F56ACEC099EBB930590B69CEC3797F7582F451A39F2E66412DA1898E2C7161D229054D3BABE495D69357CCA69B0C878D15BF0A

Origin signature

30460221008759F3B234EBB17A08EB8AC2C7CB281E76398A87CDC252C5B211C88CD279319A022100D703DF21B198A04B82BA4D964E9D0C8474AE4A8AA87D489D9A1C90AB305ACB39

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0063F565C8293F12692B21A1A14E43C92761F4814EFB08B5D9EE5A96F11CADAB3A

Coordinator signature

29078BCD73AD08C93C524CAD453AB07F43C556EA10E42FF1F36978672856B390B2A041B920F6DCB9D59960416860F97A7AE5198343C0183404D0F2C21AC03406

Validator #1 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #1 signature

2EC7382789A76207D1B7E25CAE10AAC0641792AE01E8C92FCB605DE26188577DE89BF4C415172CA2FF12BEA05B602AF7C2CA9DDD5F1AFA5A2DF39C5204967908

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

1989E5DFE3D1CAC09BCDC58AA0D4333D2423FDC578C04C0650AAAE902E8DDB8EFCD71971850FA416181118CA5095989F37F1F88F1A889F724F6533E0BF9BB802