Type
CONTRACT
Validation date
2023-11-22 02:45:42 UTC
Fee
0 UCO

Code (954 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9A6329AAE31E2FCC5CE275B0D134D27C9B7EF963F6E39D21B7CB458638838A4F0F00B9F5B34DC8D4C59CFB7223D8193259F5058EDA9973DFC2AC03D8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000173CCFBD36F4119062F8F41BD0D71E286E60E180F9D02BAAF8295776CA67DF723

Previous signature

250F89AE3EA66689F1C5E2409FAB662D588233160C5B1C39CF719A7E109679600704B3D1E5006182C0EB24A8BE256E68F5A59CC00C7F0FA5C6D76895CFC71D02

Origin signature

3045022100D046560328268A11F560027D784D1C099ED3C36F267BF9AA616D05D7B886E273022036492E7F3390D693FB67047B30C0C0C4D12642421CE948EAD66B8EE576D731E0

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

008548FEA1D0EC588C1231747FD0F63B10AA0971DA15D229ECCBD31DDE5EEAAFBF

Coordinator signature

71F49D02C04BC47D4E5122110F1F3201169326A61AF535C6CE7C9D5DD962C76AD5771BEDDD387128765A83B21E29629E78A8EAAC3650B265E6732BD1F1F1D90E

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

9E9E24705DE3BAB175C4AFF52468E37325A736EF3432AAE94E55E906FE0DAB031FA4D489D30E6BAA75C53C9181ECF56116E0495C5A19805D66AFA3456649BA01

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

92825A4867F9B9E561D05745E9AEF4CF79CA2BBBF2F19DC868C65785BC8DF035BE1EEDB3E65E0D69F076F8ABA6D75B06EFF25D05C64C8B71008B79757F918D0B