Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-agarwal-coinbase committed Nov 7, 2024
1 parent fae9162 commit b71b59b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions cdp-agentkit-core/cdp_agentkit_core/actions/wow/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,6 @@ def get_factory_address(network: str) -> str:
f"Invalid network: {network}. Valid networks are: {', '.join(WOW_FACTORY_CONTRACT_ADDRESSES.keys())}"
)
return WOW_FACTORY_CONTRACT_ADDRESSES[network]


GENERIC_TOKEN_METADATA_URI = "ipfs://QmY1GqprFYvojCcUEKgqHeDj9uhZD9jmYGrQTfA9vAE78J"
11 changes: 6 additions & 5 deletions cdp-agentkit-core/cdp_agentkit_core/actions/wow/create_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from pydantic import BaseModel, Field

from cdp_agentkit_core.actions import CdpAction
from cdp_agentkit_core.actions.wow.constants import WOW_FACTORY_ABI, get_factory_address
from cdp_agentkit_core.actions.wow.constants import (
GENERIC_TOKEN_METADATA_URI,
WOW_FACTORY_ABI,
get_factory_address,
)

WOW_CREATE_TOKEN_PROMPT = """
This tool will create a Zora Wow ERC20 memecoin using the WoW factory. This tool takes the token name and token symbol. It is only supported on Base Sepolia and Base Mainnet.
Expand Down Expand Up @@ -38,17 +42,14 @@ def wow_create_token(wallet: Wallet, name: str, symbol: str) -> str:
"""
factory_address = get_factory_address(wallet.network_id)

# Generic JSON metadata for all tokens
token_uri = "ipfs://QmY1GqprFYvojCcUEKgqHeDj9uhZD9jmYGrQTfA9vAE78J"

invocation = wallet.invoke_contract(
contract_address=factory_address,
method="deploy",
abi=WOW_FACTORY_ABI,
args={
"_tokenCreator": wallet.default_address.address_id,
"_platformReferrer": "0x0000000000000000000000000000000000000000",
"_tokenURI": token_uri,
"_tokenURI": GENERIC_TOKEN_METADATA_URI,
"_name": name,
"_symbol": symbol,
},
Expand Down
11 changes: 7 additions & 4 deletions cdp-agentkit-core/tests/actions/wow/test_create_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import pytest

from cdp_agentkit_core.actions.wow.constants import WOW_FACTORY_ABI, get_factory_address
from cdp_agentkit_core.actions.wow.constants import (
GENERIC_TOKEN_METADATA_URI,
WOW_FACTORY_ABI,
get_factory_address,
)
from cdp_agentkit_core.actions.wow.create_token import (
WowCreateTokenInput,
wow_create_token,
Expand All @@ -12,7 +16,6 @@
MOCK_SYMBOL = "TEST"
MOCK_NETWORK_ID = "base-sepolia"
MOCK_WALLET_ADDRESS = "0x1234567890123456789012345678901234567890"
MOCK_TOKEN_URI = "ipfs://QmY1GqprFYvojCcUEKgqHeDj9uhZD9jmYGrQTfA9vAE78J"


def test_create_token_input_model_valid():
Expand Down Expand Up @@ -63,7 +66,7 @@ def test_create_token_success(wallet_factory, contract_invocation_factory):
args={
"_tokenCreator": MOCK_WALLET_ADDRESS,
"_platformReferrer": "0x0000000000000000000000000000000000000000",
"_tokenURI": MOCK_TOKEN_URI,
"_tokenURI": GENERIC_TOKEN_METADATA_URI,
"_name": MOCK_NAME,
"_symbol": MOCK_SYMBOL,
},
Expand Down Expand Up @@ -94,7 +97,7 @@ def test_create_token_api_error(wallet_factory):
args={
"_tokenCreator": MOCK_WALLET_ADDRESS,
"_platformReferrer": "0x0000000000000000000000000000000000000000",
"_tokenURI": MOCK_TOKEN_URI,
"_tokenURI": GENERIC_TOKEN_METADATA_URI,
"_name": MOCK_NAME,
"_symbol": MOCK_SYMBOL,
},
Expand Down

0 comments on commit b71b59b

Please sign in to comment.