{
  "name": "Automate USDC balance between wallet and Aave with 1Shot API & Telegram",
  "nodes": [
    {
      "id": "33e07d60-e67a-4c12-8410-04478afdcce3",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -176,
        256
      ]
    },
    {
      "id": "04eab5ea-3c7a-4304-8922-eff9b7c8a0a4",
      "name": "Calculate Excess Funds",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        -256
      ]
    },
    {
      "id": "0783f25f-3d7f-4da3-8c51-13c6d4809725",
      "name": "Deposit Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2064,
        -368
      ]
    },
    {
      "id": "4ca79fe8-8113-477e-99a2-a39b2ecc9663",
      "name": "Calculate Insufficient Funds",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        256
      ]
    },
    {
      "id": "de95239f-cd59-4e77-9120-2f2a0ac43ac1",
      "name": "Withdraw from Aave",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        1392,
        160
      ]
    },
    {
      "id": "9bd29b2e-f6a2-4645-80c1-784a6cb7d40d",
      "name": "Withdraw Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2064,
        64
      ]
    },
    {
      "id": "0136bd67-16f3-48a8-a8ce-1911124b4872",
      "name": "Savings Configs",
      "type": "n8n-nodes-base.code",
      "position": [
        48,
        256
      ]
    },
    {
      "id": "1bf93721-2196-4d23-9ff2-1724f900b800",
      "name": "Check User's Aave Savings",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        496,
        256
      ]
    },
    {
      "id": "5d6ffab1-cefb-448a-b386-f5acd50492ec",
      "name": "Check User's USDC Balance",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        272,
        256
      ]
    },
    {
      "id": "5414557b-baa2-41b5-981c-c5df8edb445a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        720,
        240
      ]
    },
    {
      "id": "087c1edd-24ee-4220-bc06-2c395e94e05f",
      "name": "No Change, Send Account Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        944,
        448
      ]
    },
    {
      "id": "37406636-1307-4e61-817d-5b1f26fd155b",
      "name": "Insufficient Savings Warning",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        352
      ]
    },
    {
      "id": "0cb12444-efb1-4941-bb7d-377767f8f37b",
      "name": "Deposit Failure Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1616,
        -160
      ]
    },
    {
      "id": "25de21c3-6983-4c74-9dd1-b62ccf1868b5",
      "name": "Withdraw Failure Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1616,
        256
      ]
    },
    {
      "id": "53d90579-4e6c-4fa6-bba7-f70beb90d0fd",
      "name": "Confirm User's USDC Balance After Withdraw",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1616,
        64
      ]
    },
    {
      "id": "05e23943-4659-4b85-a2e6-afa2966d722d",
      "name": "Confirm User's Aave Savings After Withdraw",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1840,
        64
      ]
    },
    {
      "id": "64d40482-5e9b-415f-90df-e98a6c2170bd",
      "name": "Confirm User's USDC Balance After Deposit",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1616,
        -368
      ]
    },
    {
      "id": "46a48628-53d2-46f1-a225-f56fa559da33",
      "name": "Confirm User's Aave Savings After Deposit",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1840,
        -368
      ]
    },
    {
      "id": "2c822ad6-15e3-48c1-a6c4-257c44b62c0c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        704
      ],
      "parameters": {
        "width": 1888,
        "height": 656,
        "content": "## Set up a 1Shot API Wallet & Import Required Methods:\n\nClick the sub-workflow trigger to setup you 1Shot API account with a server wallet and all required smart contract methods needed for range tra"
      }
    },
    {
      "id": "8c970843-dc30-403e-a180-f0829d843066",
      "name": "List wallets",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        480,
        1008
      ]
    },
    {
      "id": "e8fadb8b-3d55-4e1d-a0c8-3c697216a986",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        256,
        1008
      ]
    },
    {
      "id": "bcdf03f7-750f-43ee-ae81-117be14996a6",
      "name": "Get Wallet ID",
      "type": "n8n-nodes-base.code",
      "position": [
        1152,
        1008
      ]
    },
    {
      "id": "a78f994d-7621-4bb3-a6e2-8c1490d9340f",
      "name": "Assure aBasUSDC",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1376,
        816
      ]
    },
    {
      "id": "8e629117-c43e-4bf9-98c5-6a0c2af8adde",
      "name": "Assure Aave: Pool Proxy (Base)",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1376,
        1008
      ]
    },
    {
      "id": "25eb457b-a210-4acf-9c4e-f7b3098912ff",
      "name": "Assure USDC (Base)",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1376,
        1200
      ]
    },
    {
      "id": "deda5d06-abfe-4637-b47b-5891ff9d0b37",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -32
      ],
      "parameters": {
        "width": 480,
        "height": 448,
        "content": "## Set Your Savings Thresholds\n\nClick on the `Savings Configs` node and set:\n\n1. The threshold where excess funds in your wallet are stored in Aave.\n2. The threshold below where funds are removed from"
      }
    },
    {
      "id": "6c828556-e624-4447-a322-900cebfd77d8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -672
      ],
      "parameters": {
        "width": 816,
        "height": 384,
        "content": "## Setup Instructions\n\nThis workflow will automatically balance your USDC funds on Base network so that you keep funds you aren't using in [Aave](https://aave.com/) to earn interest and automatically "
      }
    },
    {
      "id": "d16d710c-442d-42f7-b070-d4902583c596",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        592
      ],
      "parameters": {
        "width": 768,
        "height": 560,
        "content": "## YouTube Tutorial\n\n@[youtube](Hppd04sM4xE)\n"
      }
    },
    {
      "id": "2ade8ea7-ef80-4420-b2e8-534ce8e1c96a",
      "name": "Check User Has Sufficient Savings",
      "type": "n8n-nodes-base.if",
      "position": [
        1168,
        256
      ]
    },
    {
      "id": "dfc65736-6995-4ad7-a9cc-609d32aa6f4f",
      "name": "Check for Base Wallet",
      "type": "n8n-nodes-base.if",
      "position": [
        704,
        1008
      ]
    },
    {
      "id": "801ee03f-a524-4e4b-a5ea-2e68899ee92b",
      "name": "Create Base wallet",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        928,
        1088
      ]
    },
    {
      "id": "31c7af94-9e1b-4968-9601-7fd8fc3dadf1",
      "name": "USDC Approve",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        1168,
        -256
      ]
    },
    {
      "id": "3bf1a6b0-2da8-4368-8146-71232432ee43",
      "name": "Aave Supply",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        1392,
        -320
      ]
    },
    {
      "id": "20cb778c-6486-426f-9640-957a34f9d1b2",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1600,
        992
      ]
    },
    {
      "id": "43154e4e-4692-4fd4-a96f-c227e7123a31",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        1824,
        1008
      ]
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Calculate Excess Funds",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Calculate Insufficient Funds",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Change, Send Account Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aave Supply": {
      "main": [
        [
          {
            "node": "Confirm User's USDC Balance After Deposit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deposit Failure Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List wallets": {
      "main": [
        [
          {
            "node": "Check for Base Wallet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "USDC Approve": {
      "main": [
        [
          {
            "node": "Aave Supply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deposit Failure Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Wallet ID": {
      "main": [
        [
          {
            "node": "Assure aBasUSDC",
            "type": "main",
            "index": 0
          },
          {
            "node": "Assure Aave: Pool Proxy (Base)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Assure USDC (Base)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assure aBasUSDC": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Savings Configs": {
      "main": [
        [
          {
            "node": "Check User's USDC Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Savings Configs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assure USDC (Base)": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Create Base wallet": {
      "main": [
        [
          {
            "node": "Get Wallet ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Withdraw from Aave": {
      "main": [
        [
          {
            "node": "Confirm User's USDC Balance After Withdraw",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Withdraw Failure Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Base Wallet": {
      "main": [
        [
          {
            "node": "Get Wallet ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Base wallet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Excess Funds": {
      "main": [
        [
          {
            "node": "USDC Approve",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check User's Aave Savings": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check User's USDC Balance": {
      "main": [
        [
          {
            "node": "Check User's Aave Savings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Insufficient Funds": {
      "main": [
        [
          {
            "node": "Check User Has Sufficient Savings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assure Aave: Pool Proxy (Base)": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Check User Has Sufficient Savings": {
      "main": [
        [
          {
            "node": "Withdraw from Aave",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Insufficient Savings Warning",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "List wallets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confirm User's Aave Savings After Deposit": {
      "main": [
        [
          {
            "node": "Deposit Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confirm User's USDC Balance After Deposit": {
      "main": [
        [
          {
            "node": "Confirm User's Aave Savings After Deposit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confirm User's Aave Savings After Withdraw": {
      "main": [
        [
          {
            "node": "Withdraw Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confirm User's USDC Balance After Withdraw": {
      "main": [
        [
          {
            "node": "Confirm User's Aave Savings After Withdraw",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}