Type
CONTRACT
Validation date
2023-10-24 14:26:12 UTC
Fee
0 UCO

Code (950 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    68ABD6856D9E2336FE2393B9BFA002C00F638CAD86CC8E1D60D14E1FDB127068E08D8734AF3DD3E7E424029C3E3998795478AAEEC55581F9DAA73B86

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C8F0A577C6D92F6FE6C7BCE6B444656ECEB62769782C8F4DC7934983A7454DB2

Previous signature

36AF33F93F0372A3719548E5F0A3402953FCDE1D736D0D01648A03E673B23F72E1556007F6A96E71E6EC17F73B379F0B8FFED5A7031588F3EEECDF17677EA600

Origin signature

3046022100BAF473430FF3620C0DEAA33BBF9613866D2E4EA5A66083500579F59568D07E4A022100A03BD75AB7872A9914233251B36B476EFCA769927B6A1F357A84F850D7F4B1F4

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

002FDE9D4ED9BCBD452A1DC19E505138DE33DD8EC3C16222662BC173B7B2978370

Coordinator signature

53C762C1D0F98823C5767823D1BE2989BE9630E8A2289932DD6B81717C3694A5584DF4964C82B33E6341965825C1D7CAE4C3BE0B0A6B4241711E831D92842E09

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

6DD884A94EC39685FADAE46467E2ECAA1654E2389D26DBF8B35607E66D4183E7844C7020F92E9AB906187E0173A1FFA26F8E9C50A6D9BF53A313DCD460867D02

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

B0D01D517E11BC2C45081D92A8340B216340BC23707A34FCD5DA0D0060DC659CF37760BA4677C361D993D9628E86267CA6B5F3C00068E5D2F925BB45DDAF1E08