Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add provider for token address + staking instructions #40

Merged
merged 4 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ COINBASE_MASS_PAYMENTS_PAYMENT_ENABLED= # Enable this to run the mass payments p
COINBASE_TRADE_PLUGIN_ENABLED= # Enable this to run the trade plugin
COINBASE_TOKEN_CONTRACT_PLUGIN_ENABLED= # Enable this to run the token contract plugin
COINBASE_ADVANCED_TRADE_PLUGIN_ENABLED= # Enable this to run the advanced trade plugin
COINBASE_TOKEN_ADDRESS_BASE= # Base token address
COINBASE_TOKEN_ADDRESS_SOL= # Sol token address
MORALIS_API_KEY= # Moralis API key

# Github
GITHUB_CLIENT_DISABLED=false # Enable this to disable the GitHub client
Expand Down
2 changes: 1 addition & 1 deletion characters/prosper.character.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Prosper",
"clients": ["coinbase", "twitter", "telegram"],
"username": "The Financial Strategist and Community Influencer",
"username": "Prosper",
"modelProvider": "openai",
"imageModelProvider": "openai",
"knowledge": [
Expand Down
42 changes: 42 additions & 0 deletions clients/client-coinbase/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
blockExplorerBaseTxUrl,
supportedTickers,
} from "./types";
import { calculateAPR, fetchTokenPrice } from "./utils";

export type { WebhookEvent };

Expand All @@ -57,6 +58,10 @@ export class CoinbaseClient implements Client {
this.runtime.providers.push(balanceProvider);
this.runtime.providers.push(addressProvider);
this.runtime.providers.push(tradingSignalBackTestProvider);
this.runtime.providers.push(baseTokenAddressProvider);
this.runtime.providers.push(solTokenAddressProvider);
this.runtime.providers.push(stakingLiquidityPoolingProvider);
this.runtime.providers.push(currentPriceProvider);
this.server = express();
this.port = Number(runtime.getSetting("COINBASE_WEBHOOK_PORT")) || 3001;
this.wallets = [];
Expand Down Expand Up @@ -781,4 +786,41 @@ export const tradingSignalBackTestProvider: Provider = {
},
};

const baseTokenAddressProvider = {
get: async (runtime: IAgentRuntime, _message: Memory) => {
return `BASE Token Address: ${runtime.getSetting("COINBASE_TOKEN_ADDRESS_BASE")}`;
},
};

const solTokenAddressProvider = {
get: async (runtime: IAgentRuntime, _message: Memory) => {
return `SOL Token Address: ${runtime.getSetting("COINBASE_TOKEN_ADDRESS_SOL")}`;
},
};

const stakingLiquidityPoolingProvider = {
get: async (runtime: IAgentRuntime, _message: Memory) => {
return `How to stake on BASE:
1. Go to uniswap v2 (https://app.uniswap.org/positions/create/v2) and add liquidity to ${runtime.character.username.toUpperCase()} / ETH and receive the LP token
2. Go to staking website (https://stakeprosper.com/) and stake your LP tokens and receive rewards
Notes you can claim rewards whenever and there is a 7 day lockup period for unstaking.

How to pool on SOL: Go to raydium (https://raydium.io/liquidity-pools/?token=${runtime.getSetting("COINBASE_TOKEN_ADDRESS_SOL")}) and add liquidity to ${runtime.character.username.toUpperCase()} / ETH and receive rewards you can withdraw anytime`;
},
};

const currentPriceProvider = {
get: async (_runtime: IAgentRuntime, _message: Memory) => {
// const priceOnBase = await fetchTokenPrice(
// runtime,
// runtime.getSetting("COINBASE_TOKEN_ADDRESS_BASE"),
// );
// const aprOnBase = await calculateAPR(
// runtime.getSetting("COINBASE_TOKEN_ADDRESS_BASE"),
// );
// return `Current price of ${runtime.character.name.toUpperCase} on Base is ${priceOnBase.current} and APR is ${aprOnBase}.
// `;
},
};

export default CoinbaseClientInterface;
Loading
Loading