Skip to content

Commit

Permalink
bringing in the latest from master
Browse files Browse the repository at this point in the history
  • Loading branch information
stat committed Dec 6, 2024
2 parents c722440 + 3d23153 commit 93b5fda
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 20 deletions.
17 changes: 16 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/defi/wow/actions/buy_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ import { getBuyQuote } from "../utils";
import { z } from "zod";

const WOW_BUY_TOKEN_PROMPT = `
This tool will buy a Zora Wow ERC20 memecoin with ETH. This tool takes the WOW token contract address, the address to receive the tokens, and the amount of ETH to spend (in wei, meaning "1" is 1 wei or 0.000000000000000001 of ETH). The amount is a string and cannot have any decimal points, since the unit of measurement is wei. Make sure to use the exact amount provided, and if there's any doubt, check by getting more information before continuing with the action. The minimum to buy is 100000000000000 wei which is 0.0000001 ether. It is only supported on Base Sepolia and Base Mainnet.
This tool can only be used to buy a Zora Wow ERC20 memecoin (also can be referred to as a bonding curve token) with ETH.
Do not use this tool for any other purpose, or trading other assets.
Inputs:
- WOW token contract address
- Address to receive the tokens
- Amount of ETH to spend (in wei)
Important notes:
- The amount is a string and cannot have any decimal points, since the unit of measurement is wei.
- Make sure to use the exact amount provided, and if there's any doubt, check by getting more information before continuing with the action.
- 1 wei = 0.000000000000000001 ETH
- Minimum purchase amount is 100000000000000 wei (0.0000001 ETH)
- Only supported on the following networks:
- Base Sepolia (ie, 'base-sepolia')
- Base Mainnet (ie, 'base', 'base-mainnnet')
`;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ import { WOW_FACTORY_ABI, GENERIC_TOKEN_METADATA_URI, getFactoryAddress } from "
import { z } from "zod";

const WOW_CREATE_TOKEN_PROMPT = `
This tool will create a Zora Wow ERC20 memecoin using the WoW factory. This tool takes the token name, token symbol, and optionally a token URI containing metadata about the token. It uses a bonding curve so there is no need to add liquidity to the pool upfront. It is only supported on Base Sepolia and Base Mainnet.
This tool can only be used to create a Zora Wow ERC20 memecoin (also can be referred to as a bonding curve token) using the WoW factory.
Do not use this tool for any other purpose, or for creating other types of tokens.
Inputs:
- Token name (e.g. WowCoin)
- Token symbol (e.g. WOW)
- Token URI (optional) - Contains metadata about the token
Important notes:
- Uses a bonding curve - no upfront liquidity needed
- Only supported on the following networks:
- Base Sepolia (ie, 'base-sepolia')
- Base Mainnet (ie, 'base', 'base-mainnnet')
`;

/**
Expand Down
16 changes: 15 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/defi/wow/actions/sell_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@ import { getSellQuote } from "../utils";
import { z } from "zod";

const WOW_SELL_TOKEN_PROMPT = `
This tool will sell a Zora Wow ERC20 memecoin for ETH. This tool takes the WOW token contract address, and the amount of tokens to sell (in wei, meaning 1 is 1 wei or 0.000000000000000001 of the token). The minimum to sell is 100000000000000 wei which is 0.0000001 ether. The amount is a string and cannot have any decimal points, since the unit of measurement is wei. Make sure to use the exact amount provided, and if there's any doubt, check by getting more information before continuing with the action. It is only supported on Base Sepolia and Base Mainnet.
This tool can only be used to sell a Zora Wow ERC20 memecoin (also can be referred to as a bonding curve token) for ETH.
Do not use this tool for any other purpose, or trading other assets.
Inputs:
- WOW token contract address
- Amount of tokens to sell (in wei)
Important notes:
- The amount is a string and cannot have any decimal points, since the unit of measurement is wei.
- Make sure to use the exact amount provided, and if there's any doubt, check by getting more information before continuing with the action.
- 1 wei = 0.000000000000000001 ETH
- Minimum purchase amount is 100000000000000 wei (0.0000001 ETH)
- Only supported on the following networks:
- Base Sepolia (ie, 'base-sepolia')
- Base Mainnet (ie, 'base', 'base-mainnnet')
`;

/**
Expand Down
4 changes: 3 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/deploy_nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { Wallet } from "@coinbase/coinbase-sdk";
import { z } from "zod";

const DEPLOY_NFT_PROMPT = `
This tool will deploy an NFT (ERC-721) contract onchain from the wallet. It takes the name of the NFT collection, the symbol of the NFT collection, and the base URI for the token metadata as inputs.`;
This tool will deploy an NFT (ERC-721) contract onchain from the wallet.
It takes the name of the NFT collection, the symbol of the NFT collection, and the base URI for the token metadata as inputs.
`;

/**
* Input schema for deploy NFT action.
Expand Down
4 changes: 3 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/deploy_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { Wallet, Amount } from "@coinbase/coinbase-sdk";
import { z } from "zod";

const DEPLOY_TOKEN_PROMPT = `
This tool will deploy an ERC20 token smart contract. It takes the token name, symbol, and total supply as input. The token will be deployed using the wallet's default address as the owner and initial token holder.`;
This tool will deploy an ERC20 token smart contract. It takes the token name, symbol, and total supply as input.
The token will be deployed using the wallet's default address as the owner and initial token holder.
`;

/**
* Input schema for deploy token action.
Expand Down
4 changes: 3 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/get_balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import Decimal from "decimal.js";
import { z } from "zod";

const GET_BALANCE_PROMPT = `
This tool will get the balance of all the addresses in the wallet for a given asset. It takes the asset ID as input. Always use 'eth' for the native asset ETH and 'usdc' for USDC.`;
This tool will get the balance of all the addresses in the wallet for a given asset.
It takes the asset ID as input. Always use 'eth' for the native asset ETH and 'usdc' for USDC.
`;

/**
* Input schema for get balance action.
Expand Down
5 changes: 4 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/mint_nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { Wallet } from "@coinbase/coinbase-sdk";
import { z } from "zod";

const MINT_NFT_PROMPT = `
This tool will mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation. It takes the contract address of the NFT onchain and the destination address onchain that will receive the NFT as inputs. Do not use the contract address as the destination address. If you are unsure of the destination address, please ask the user before proceeding.`;
This tool will mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation.
It takes the contract address of the NFT onchain and the destination address onchain that will receive the NFT as inputs.
Do not use the contract address as the destination address. If you are unsure of the destination address, please ask the user before proceeding.
`;

/**
* Input schema for mint NFT action.
Expand Down
5 changes: 3 additions & 2 deletions cdp-agentkit-core/src/actions/cdp/register_basename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { Decimal } from "decimal.js";

const REGISTER_BASENAME_PROMPT = `
This tool will register a Basename for the agent. The agent should have a wallet associated to register a Basename.
When your network ID is 'base-mainnet', the name must end with .base.eth and when your network ID is 'base-sepolia', it must ends with .basetest.eth.
When your network ID is 'base-mainnet' (also sometimes known simply as 'base'), the name must end with .base.eth, and when your network ID is 'base-sepolia', it must ends with .basetest.eth.
Do not suggest any alternatives and never try to register a Basename with another postfix. The prefix of the name must be unique so if the registration of the
Basename fails, you should prompt to try again with a more unique name.`;
Basename fails, you should prompt to try again with a more unique name.
`;

// Contract addresses
export const BASENAMES_REGISTRAR_CONTROLLER_ADDRESS_MAINNET =
Expand Down
3 changes: 2 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/request_faucet_funds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const REQUEST_FAUCET_FUNDS_PROMPT = `
This tool will request test tokens from the faucet for the default address in the wallet. It takes the wallet and asset ID as input.
If no asset ID is provided the faucet defaults to ETH. Faucet is only allowed on 'base-sepolia' and can only provide asset ID 'eth' or 'usdc'.
You are not allowed to faucet with any other network or asset ID. If you are on another network, suggest that the user sends you some ETH
from another wallet and provide the user with your wallet details.`;
from another wallet and provide the user with your wallet details.
`;

/**
* Input schema for request faucet funds action.
Expand Down
13 changes: 12 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/trade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@ import { Wallet, Amount } from "@coinbase/coinbase-sdk";
import { z } from "zod";

const TRADE_PROMPT = `
This tool will trade a specified amount of a from asset to a to asset for the wallet. It takes the the amount of the from asset to trade, the from asset ID to trade, and the to asset ID to receive from the trade as inputs. Trades are only supported on Mainnets (e.g. 'base-mainnet', 'ethereum-mainnet'). Never allow trades on any other network.`;
This tool will trade a specified amount of a 'from asset' to a 'to asset' for the wallet.
It takes the following inputs:
- The amount of the 'from asset' to trade
- The from asset ID to trade
- The asset ID to receive from the trade
Important notes:
- Trades are only supported on mainnet networks (ie, 'base-mainnet', 'base', 'ethereum-mainnet', 'ethereum', etc.)
- Never allow trades on any non-mainnet network (ie, 'base-sepolia', 'ethereum-sepolia', etc.)
- When selling a native asset (e.g. 'eth' on base-mainnet), ensure there is sufficient balance to pay for the trade AND the gas cost of this trade
`;

/**
* Input schema for trade action.
Expand Down
16 changes: 15 additions & 1 deletion cdp-agentkit-core/src/actions/cdp/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ import { Wallet, Amount } from "@coinbase/coinbase-sdk";
import { z } from "zod";

const TRANSFER_PROMPT = `
This tool will transfer an asset from the wallet to another onchain address. It takes the amount, the asset ID to transfer, the destination to send the funds (either an onchain address, an ENS 'example.eth', or Basename 'example.base.eth'), and whether to do a gasless transfer as inputs. The gasless option is available on 'base-sepolia' and 'base-mainnet' networks for 'usdc' asset only. Always use the gasless option when it is available. Always use the asset ID 'usdc' when attempting to transfer USDC. Always ensure that you have enough balance of the input asset ID to complete the transfer.`;
This tool will transfer an asset from the wallet to another onchain address.
It takes the following inputs:
- amount: The amount to transfer
- assetId: The asset ID to transfer
- destination: Where to send the funds (can be an onchain address, ENS 'example.eth', or Basename 'example.base.eth')
- gasless: Whether to do a gasless transfer
Important notes:
- Gasless transfers are only available on base-sepolia and base-mainnet (base) networks for 'usdc' asset
- Always use gasless transfers when available
- Always use asset ID 'usdc' when transferring USDC
- Ensure sufficient balance of the input asset before transferring
- When sending native assets (e.g. 'eth' on base-mainnet), ensure there is sufficient balance for the transfer itself AND the gas cost of this transfer
`;

/**
* Input schema for transfer action.
Expand Down
13 changes: 11 additions & 2 deletions cdp-langchain/examples/chatbot/chatbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,17 @@ async function initializeAgent() {
llm,
tools,
checkpointSaver: memory,
messageModifier:
"You are a helpful agent that can interact onchain using the Coinbase Developer Platform AgentKit. You are empowered to interact onchain using your tools. If you ever need funds, you can request them from the faucet if you are on network ID `base-sepolia`. If not, you can provide your wallet details and request funds from the user. If someone asks you to do something you can't do with your currently available tools, you must say so, and encourage them to implement it themselves using the CDP SDK + Agentkit, recommend they go to docs.cdp.coinbase.com for more informaton. Be concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is explicitly requested.",
messageModifier: `
You are a helpful agent that can interact onchain using the Coinbase Developer Platform AgentKit. You are
empowered to interact onchain using your tools. If you ever need funds, you can request them from the
faucet if you are on network ID 'base-sepolia'. If not, you can provide your wallet details and request
funds from the user. Before executing your first action, get the wallet details to see what network
you're on. If there is a 5XX (internal) HTTP error code, ask the user to try again later. If someone
asks you to do something you can't do with your currently available tools, you must say so, and
encourage them to implement it themselves using the CDP SDK + Agentkit, recommend they go to
docs.cdp.coinbase.com for more information. Be concise and helpful with your responses. Refrain from
restating your tools' descriptions unless it is explicitly requested.
`,
});

// Save wallet data
Expand Down
3 changes: 0 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "cdp-agentkit-monorepo",
"private": true,
"workspaces": [
"cdp-agentkit-core",
"cdp-langchain",
Expand Down Expand Up @@ -49,8 +50,5 @@
"turbo": "^2.3.3",
"typedoc": "^0.27.2",
"typescript": "^5.4.5"
},
"dependencies": {
"@coinbase/cdp-agentkit-core": "^0.0.5"
}
}

0 comments on commit 93b5fda

Please sign in to comment.