Type
CONTRACT
Validation date
2023-12-01 12:51:14 UTC
Fee
0 UCO

Code (951 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x465b7fd05c1d673ae1d446caf4abc0c5d5ec1e70", 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: 0x00004D0AC7C11BC49690EEB0A16B3051A7BCD0E20A0ECE056852B59435CEBA359AEC, amount: 9.9202e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D3C84795FF7CEF7324B806B7E492416C2DB57D379B06F3047B20F3A394912A5C493251EE551F2BFCB57A7FBEE84A8C133C97B80972CD2F96B6325DD1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000172734AD0117B9826AA04EC68321099F3A4A32DD02A7CAE43EF1A423F0D810C34

Previous signature

FCF9F59A04920AAE18E254F44BFE58CA2804343857C5ED8889B9748D9C763AA4F307F619E3F86924DE8B4D24C3172419EFBA8DB8B6A302BB8F3AB0984BCAE204

Origin signature

3045022018379BE08DA861FDB98390B737272663FFB567E45241DE7263C61186826D4D63022100E1898B190E4A0F8768A03DE805808556448AA2E17BB0A9AD79F4889BEC953D93

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

000A56EBACACF110124823CD4B87549BA0EA7D6AF605623C6FBF3B99061146E502

Coordinator signature

E3888715482ABED7BCEFF242FE30EC414C647D4F74ABF8F35479CEFBFBB3EE7D5B46AA8EF15F6FD847639F517BE28CD38602DC298416FA8760A91B7035F6FB05

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

C61A52C2D41D6BF35181C05D426358481C52EB247C42D865B95C6A9D00137C5C3CE1745F9E0004228B96635848460F40C978C6BCA9C5DB5777340A6FBD0D860D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4DFCD20B63E53A9CBD24D5B8581968FC3B377D583791BC5417BF925D142B8736B2F621481AA68BB02FB437B5E9931AC64F3F16930DF42DD243D7CDFEF26ACC05