Skip to content

Commit

Permalink
fix renames
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant committed Dec 18, 2024
1 parent abe44a9 commit 4d960ad
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract DeployLLMOracleCoordinator is Script {
}
}

contract DeployAIAgentFactory is Script {
contract DeploySwanAgentFactory is Script {
HelperConfig public config;

function run() external returns (address addr) {
Expand All @@ -42,7 +42,7 @@ contract DeployAIAgentFactory is Script {
}
}

contract DeployArtifactFactory is Script {
contract DeploySwanArtifactFactory is Script {
HelperConfig public config;

function run() external returns (address addr) {
Expand Down
8 changes: 4 additions & 4 deletions src/Swan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ contract Swan is SwanManager, UUPSUpgradeable {
//////////////////////////////////////////////////////////////*/

/// @notice Creates a new agent.
/// @dev Emits a `AIAgentCreated` event.
/// @dev Emits a `AgentCreated` event.
/// @return address of the new agent.
function createAgent(
string calldata _name,
Expand Down Expand Up @@ -358,10 +358,10 @@ contract Swan is SwanManager, UUPSUpgradeable {
emit ArtifactSold(listing.seller, msg.sender, _artifact, listing.price);
}

/// @notice Set the factories for AI Agents and Artifacts.
/// @notice Set the factories for Agents and Artifacts.
/// @dev Only callable by owner.
/// @param _agentFactory new AIAgentFactory address
/// @param _artifactFactory new ArtifactFactory address
/// @param _agentFactory new SwanAgentFactory address
/// @param _artifactFactory new SwanArtifactFactory address
function setFactories(address _agentFactory, address _artifactFactory) external onlyOwner {
agentFactory = SwanAgentFactory(_agentFactory);
artifactFactory = SwanArtifactFactory(_artifactFactory);
Expand Down
4 changes: 2 additions & 2 deletions src/SwanAgent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract SwanAgentFactory {
}
}

/// @notice AIAgent is responsible for buying the artifacts from Swan.
/// @notice Agent is responsible for buying the artifacts from Swan.
contract SwanAgent is Ownable {
/*//////////////////////////////////////////////////////////////
ERRORS
Expand Down Expand Up @@ -131,7 +131,7 @@ contract SwanAgent is Ownable {
//////////////////////////////////////////////////////////////*/

/// @notice Creates an agent.
/// @dev `_feeRoyalty` should be between 1 and maxAIAgentFee in the swan market parameters.
/// @dev `_feeRoyalty` should be between 1 and max agent fee in the swan market parameters.
/// @dev All tokens are approved to the oracle coordinator of operator.
constructor(
string memory _name,
Expand Down
18 changes: 9 additions & 9 deletions test/Helper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ abstract contract Helper is Test {
for (uint96 i = 0; i < agentOwners.length; i++) {
agentParameters.push(
AgentParameters({
name: string.concat("AIAgent", vm.toString(uint256(i))),
name: string.concat("SwanAgent", vm.toString(uint256(i))),
description: "description of the AI agent",
feeRoyalty: feeRoyalty,
amountPerRound: amountPerRound
Expand Down Expand Up @@ -250,12 +250,12 @@ abstract contract Helper is Test {
Vm.Log[] memory entries = vm.getRecordedLogs();

// 1. OwnershipTransferred (from Ownable)
// 2. Approval (from AIAgent constructor to approve coordinator)
// 3. Approval (from AIAgent constructor to approve swan)
// 4. AIAgentCreated (from Swan)
// 2. Approval (from SwanAgent constructor to approve coordinator)
// 3. Approval (from SwanAgent constructor to approve swan)
// 4. Agent (from Swan)
assertEq(entries.length, 4);

// get the AIAgentCreated event
// get the agent event
Vm.Log memory agentCreatedEvent = entries[entries.length - 1];

// Log is a struct that holds the event info:
Expand All @@ -274,7 +274,7 @@ abstract contract Helper is Test {

// get event sig
bytes32 eventSig = agentCreatedEvent.topics[0];
assertEq(keccak256("AIAgentCreated(address,address)"), eventSig);
assertEq(keccak256("AgentCreated(address,address)"), eventSig);

// decode owner & agent address from topics
address _owner = abi.decode(abi.encode(agentCreatedEvent.topics[1]), (address));
Expand All @@ -287,7 +287,7 @@ abstract contract Helper is Test {
// all guuud
agents.push(SwanAgent(_agent));

vm.label(address(agents[i]), string.concat("AIAgent#", vm.toString(i + 1)));
vm.label(address(agents[i]), string.concat("SwanAgent#", vm.toString(i + 1)));

// transfer token to agent
token.transfer(address(AIagent), amountPerRound);
Expand Down Expand Up @@ -323,13 +323,13 @@ abstract contract Helper is Test {

vm.expectRevert(abi.encodeWithSelector(Swan.InvalidPrice.selector, invalidPrice));
vm.prank(seller);
swan.list("Artifact", "SA", "description or the swan artifact", invalidPrice, _agent);
swan.list("SwanArtifact", "SA", "description or the swan artifact", invalidPrice, _agent);

vm.recordLogs();
for (uint256 i = 0; i < artifactCount; i++) {
vm.prank(seller);
swan.list(
string.concat("Artifact#", vm.toString(i)),
string.concat("SwanArtifact#", vm.toString(i)),
string.concat("SA#", vm.toString(i)),
"description or the swan artifact",
artifactPrice,
Expand Down
4 changes: 2 additions & 2 deletions test/SwanFuzzTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ contract SwanFuzzTest is Helper {
uint256 _currTimestamp = block.timestamp;

// increase time to buy phase of the second round but round comes +1 because of the setMarketParameters call
// AIAgents[0] should be in buy phase of second round
// agents[0] should be in buy phase of second round
increaseTime(
_currTimestamp + (2 * swan.getCurrentMarketParameters().listingInterval)
+ swan.getCurrentMarketParameters().buyInterval + swan.getCurrentMarketParameters().withdrawInterval,
Expand Down Expand Up @@ -164,7 +164,7 @@ contract SwanFuzzTest is Helper {
_allParams = swan.getMarketParameters();
assertEq(_allParams.length, 3);

// AIAgents[0] should be in listing phase of the fourth round (2 more increase time + 2 for setting new params)
// agents[0] should be in listing phase of the fourth round (2 more increase time + 2 for setting new params)
checkRoundAndPhase(agents[0], SwanAgent.Phase.Listing, 3);

// agentAfterFirstSet should be in listing phase of the second round
Expand Down
2 changes: 1 addition & 1 deletion test/SwanTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract SwanTest is Helper {
assertEq(swan.owner(), _newOwner);
}

function test_CreateAIAgents() external createAgents fund {
function test_CreateSwanAgents() external createAgents fund {
assertEq(agents.length, agentOwners.length);

for (uint256 i = 0; i < agents.length; i++) {
Expand Down
12 changes: 6 additions & 6 deletions test/script/Deploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.20;

import {
DeployAIAgentFactory,
DeployArtifactFactory,
DeploySwanAgentFactory,
DeploySwanArtifactFactory,
DeployLLMOracleCoordinator,
DeployLLMOracleRegistry,
DeploySwan
Expand All @@ -17,8 +17,8 @@ import {Swan} from "../../src/Swan.sol";
import {Upgrades} from "@openzeppelin/foundry-upgrades/Upgrades.sol";

contract DeployTest is Test {
DeployAIAgentFactory deployAgentFactory;
DeployArtifactFactory deployArtifactFactory;
DeploySwanAgentFactory deployAgentFactory;
DeploySwanArtifactFactory deployArtifactFactory;
DeployLLMOracleCoordinator deployLLMOracleCoordinator;
DeployLLMOracleRegistry deployLLMOracleRegistry;
DeploySwan deploySwan;
Expand All @@ -36,10 +36,10 @@ contract DeployTest is Test {
address llmOracleRegistryImpl;

function setUp() external {
deployAgentFactory = new DeployAIAgentFactory();
deployAgentFactory = new DeploySwanAgentFactory();
agentFactory = deployAgentFactory.run();

deployArtifactFactory = new DeployArtifactFactory();
deployArtifactFactory = new DeploySwanArtifactFactory();
artifactFactory = deployArtifactFactory.run();

deployLLMOracleRegistry = new DeployLLMOracleRegistry();
Expand Down

0 comments on commit 4d960ad

Please sign in to comment.