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

Renaming #9

Merged
merged 2 commits into from
Dec 16, 2024
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
85 changes: 44 additions & 41 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
BuyerAgentTest:test_InBuyPhase() (gas: 4504258)
BuyerAgentTest:test_InSellPhase() (gas: 4472291)
BuyerAgentTest:test_RevertWhen_SetAmountPerRoundInBuyPhase() (gas: 4483755)
BuyerAgentTest:test_RevertWhen_SetFeeWithInvalidRoyalty() (gas: 4492886)
BuyerAgentTest:test_RevertWhen_SetRoyaltyInSellPhase() (gas: 4473243)
BuyerAgentTest:test_RevertWhen_WithdrawByAnotherOwner() (gas: 4504563)
BuyerAgentTest:test_RevertWhen_WithdrawInBuyPhase() (gas: 4511184)
BuyerAgentTest:test_SetRoyaltyAndAmountPerRound() (gas: 4494097)
BuyerAgentTest:test_WithdrawInWithdrawPhase() (gas: 4474465)
DeployTest:test_Deploy() (gas: 101342)
InvariantTest:invariant_AssetPriceRange() (runs: 256, calls: 128000, reverts: 114801)
InvariantTest:invariant_BuyerAgentFeeRoyalty() (runs: 256, calls: 128000, reverts: 114890)
InvariantTest:invariant_MaxAssetCount() (runs: 256, calls: 128000, reverts: 115004)
InvariantTest:invariant_OwnerIsAnOperator() (runs: 256, calls: 128000, reverts: 114875)
SwanFuzz:testFuzz_CalculateRoyalties(uint256,uint256,uint256) (runs: 256, μ: 4478247, ~: 4478369)
SwanFuzz:testFuzz_ChangeCycleTime(uint256,uint256,uint256,uint256,uint256,uint256) (runs: 256, μ: 6920247, ~: 6921025)
SwanFuzz:testFuzz_ListAsset(string,string,bytes,uint256,string,string,uint96,uint256) (runs: 256, μ: 3922593, ~: 3933255)
SwanFuzz:testFuzz_TransferOwnership(address) (runs: 256, μ: 45378, ~: 45378)
SwanIntervalsTest:test_InBuyPhase() (gas: 4484235)
SwanIntervalsTest:test_InSellPhase() (gas: 4472621)
SwanIntervalsTest:test_InWithdrawPhase() (gas: 4488191)
SwanTest:test_CreateBuyerAgents() (gas: 5663905)
SwanTest:test_PurchaseAnAsset() (gas: 11220979)
SwanTest:test_RelistAsset() (gas: 10183767)
SwanTest:test_RevertWhen_CreateBuyerWithInvalidRoyalty() (gas: 1619856)
SwanTest:test_RevertWhen_ListInWithdrawPhase() (gas: 5743065)
SwanTest:test_RevertWhen_ListMoreThanMaxAssetCount() (gas: 10051316)
SwanTest:test_RevertWhen_PurchaseByAnotherBuyer() (gas: 10073950)
SwanTest:test_RevertWhen_PurchaseInSellPhase() (gas: 10048903)
SwanTest:test_RevertWhen_PurchaseMoreThanAmountPerRound() (gas: 11265761)
SwanTest:test_RevertWhen_RelistAlreadyPurchasedAsset() (gas: 11222356)
SwanTest:test_RevertWhen_RelistByAnotherSeller() (gas: 10059833)
SwanTest:test_RevertWhen_RelistInBuyPhase() (gas: 10094987)
SwanTest:test_RevertWhen_RelistInTheSameRound() (gas: 10052006)
SwanTest:test_RevertWhen_RelistInWithdrawPhase() (gas: 10094678)
SwanTest:test_SetAmountPerRound() (gas: 5720554)
SwanTest:test_SetFactories() (gas: 5172073)
SwanTest:test_SetMarketParameters() (gas: 5843489)
SwanTest:test_SetOracleParameters() (gas: 5665639)
SwanTest:test_TransferOwnership() (gas: 55405)
SwanTest:test_UpdateState() (gas: 11985754)
AIAgentTest:test_InBuyPhase() (gas: 4504153)
AIAgentTest:test_InListingPhase() (gas: 4472120)
AIAgentTest:test_RevertWhen_SetAmountPerRoundInBuyPhase() (gas: 4483655)
AIAgentTest:test_RevertWhen_SetFeeWithInvalidRoyalty() (gas: 4492808)
AIAgentTest:test_RevertWhen_SetRoyaltyInListingPhase() (gas: 4473166)
AIAgentTest:test_RevertWhen_WithdrawByAnotherOwner() (gas: 4504441)
AIAgentTest:test_RevertWhen_WithdrawInBuyPhase() (gas: 4511039)
AIAgentTest:test_SetRoyaltyAndAmountPerRound() (gas: 4494015)
AIAgentTest:test_WithdrawInWithdrawPhase() (gas: 4474361)
DeployTest:test_Deploy() (gas: 22076)
InvariantTest:invariant_AgentFeeRoyalty() (runs: 20, calls: 10000, reverts: 8980)
InvariantTest:invariant_ArtifactPriceRange() (runs: 20, calls: 10000, reverts: 9028)
InvariantTest:invariant_MaxArtifactCount() (runs: 20, calls: 10000, reverts: 8998)
InvariantTest:invariant_OwnerIsAnOperator() (runs: 20, calls: 10000, reverts: 8992)
SwanFuzzTest:testFuzz_CalculateRoyalties(uint256,uint256,uint256) (runs: 100, μ: 4478115, ~: 4478236)
SwanFuzzTest:testFuzz_ChangeCycleTime(uint256,uint256,uint256,uint256,uint256,uint256) (runs: 100, μ: 6920555, ~: 6921298)
SwanFuzzTest:testFuzz_ListArtifact(string,string,bytes,uint256,string,string,uint96,uint256) (runs: 100, μ: 3923970, ~: 3924013)
SwanFuzzTest:testFuzz_TransferOwnership(address) (runs: 100, μ: 45356, ~: 45356)
SwanIntervalsTest:test_InBuyPhase() (gas: 4484185)
SwanIntervalsTest:test_InListingPhase() (gas: 4472550)
SwanIntervalsTest:test_InWithdrawPhase() (gas: 4487549)
SwanTest:test_CreateAIAgents() (gas: 5663937)
SwanTest:test_PurchaseAnArtifact() (gas: 11297765)
SwanTest:test_RelistArtifact() (gas: 10251837)
SwanTest:test_RevertWhen_CreateAgentWithInvalidRoyalty() (gas: 1619957)
SwanTest:test_RevertWhen_ListInWithdrawPhase() (gas: 5749933)
SwanTest:test_RevertWhen_ListMoreThanmaxArtifactCount() (gas: 10119397)
SwanTest:test_RevertWhen_PurchaseByAnotherAgent() (gas: 10142029)
SwanTest:test_RevertWhen_PurchaseInListingPhase() (gas: 10116892)
SwanTest:test_RevertWhen_PurchaseMoreThanAmountPerRound() (gas: 11333279)
SwanTest:test_RevertWhen_RelistAlreadyPurchasedArtifact() (gas: 11289853)
SwanTest:test_RevertWhen_RelistByAnotherSeller() (gas: 10127804)
SwanTest:test_RevertWhen_RelistInBuyPhase() (gas: 10163113)
SwanTest:test_RevertWhen_RelistInTheSameRound() (gas: 10119934)
SwanTest:test_RevertWhen_RelistInWithdrawPhase() (gas: 10162737)
SwanTest:test_RevertWhen_RelistMoreThanMaxArtifactCount() (gas: 13983200)
SwanTest:test_RevertWhen_SetMarketParametersWithInvalidFee() (gas: 1539671)
SwanTest:test_RevertWhen_UpgradeByNonOwner() (gas: 1543316)
SwanTest:test_SetAmountPerRound() (gas: 5720733)
SwanTest:test_SetFactories() (gas: 5172184)
SwanTest:test_SetMarketParameters() (gas: 5843554)
SwanTest:test_SetOracleParameters() (gas: 5665825)
SwanTest:test_TransferOwnership() (gas: 55416)
SwanTest:test_UpdateState() (gas: 12066139)
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Swan is a **Decentralized Protocol** where AI agents (buyers) dynamically intera
Compile the contracts with:

```sh
forge build
forge clean && forge build
```

> [!NOTE]
Expand All @@ -18,13 +18,13 @@ forge build
Run tests on local:

```sh
forge test --force
forge clean && forge test
```

or on any other evm chain:

```sh
forge test --rpc-url <RPC_URL>
forge clean && forge test --rpc-url <RPC_URL>
```

## Deployment
Expand Down Expand Up @@ -54,30 +54,22 @@ cast wallet list
> You HAVE to type your password on the terminal to be able to use your keys. (e.g when deploying a contract)

**Step 3.**
Enter your private key (associated with your public key) and password on terminal. You'll see your public key on terminal.
Enter your private key (associated with your address) and password on terminal. You'll see your address on terminal.

> [!NOTE]
>
> If you want to deploy contracts on localhost please provide local public key for the command above.
> If you want to deploy contracts on localhost please provide local address for the command above.

**Step 4.** Required only for local deployment.

Start a local node with:

```sh
anvil
```

**Step 5.**
Deploy the contracts with:
**Step 4.**
Deploy the contract with:

```sh
forge script ./script/Deploy.s.sol:Deploy --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_PUBLIC_KEY> --broadcast
forge clean && forge script ./script/Deploy.s.sol:Deploy<CONTRACT_NAME> --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_ADDRESS> --broadcast
```
or for instant verification use:

```sh
forge script ./script/Deploy.s.sol:Deploy --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_PUBLIC_KEY> --broadcast --verify --verifier <etherscan|blockscout|sourcify> --verifier-url <VERIFIER_URL>
forge clean && forge script ./script/Deploy.s.sol:Deploy --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_ADDRESS> --broadcast --verify --verifier <etherscan|blockscout|sourcify> --verifier-url <VERIFIER_URL>
```

> [!NOTE]
Expand Down
18 changes: 11 additions & 7 deletions deployment/31337.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"LLMOracleRegistry": {
"proxyAddr": "0x90193c961a926261b756d1e5bb255e67ff9498a1",
"implAddr": "0x34a1d3fff3958843c43ad80f30b94c510645c316"
"AIAgentFactory": {
"addr": "0x34a1d3fff3958843c43ad80f30b94c510645c316"
},
"LLMOracleCoordinator": {
"LLMOracleRegistry": {
"proxyAddr": "0xbb2180ebd78ce97360503434ed37fcf4a1df61c3",
"implAddr": "0xa8452ec99ce0c64f20701db7dd3abdb607c00496"
},
"LLMOracleCoordinator": {
"proxyAddr": "0x50eef481cae4250d252ae577a09bf514f224c6c4",
"implAddr": "0xdb8cff278adccf9e9b5da745b44e754fc4ee3c76"
},
"ArtifactFactory": {
"addr": "0x90193c961a926261b756d1e5bb255e67ff9498a1"
},
"Swan": {
"proxyAddr": "0xdeb1e9a6be7baf84208bb6e10ac9f9bbe1d70809",
"implAddr": "0x62c20aa1e0272312bc100b4e23b4dc1ed96dd7d1"
},
"BuyerAgentFactory": "0xdb8cff278adccf9e9b5da745b44e754fc4ee3c76",
"SwanAssetFactory": "0x50eef481cae4250d252ae577a09bf514f224c6c4"
}
}
20 changes: 13 additions & 7 deletions deployment/84532.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"LLMOracleRegistry": {
"proxyAddr": "0x4e4ef93f3ac35ca6505f582c666958f99218de21",
"implAddr": "0xa826dfee9089004d9a6d832f854375eb725074bb"
"proxyAddr": "0xbb2180ebd78ce97360503434ed37fcf4a1df61c3",
"implAddr": "0xa8452ec99ce0c64f20701db7dd3abdb607c00496"
},
"LLMOracleCoordinator": {
"proxyAddr": "0x237f1bda05451ade6214a12e85b5084511da2995",
"implAddr": "0x4a2d4f8734c4b322685fadfc72e44f0011123814"
"proxyAddr": "0x50eef481cae4250d252ae577a09bf514f224c6c4",
"implAddr": "0xdb8cff278adccf9e9b5da745b44e754fc4ee3c76"
},
"Swan": {
"proxyAddr": "0x70c85509fc1da642e90d8dc5a9487fa4c36ea77c",
"implAddr": "0x1f5bff2d013fe0051a7f1d1b932183c3d839d384"
"proxyAddr": "0xdeb1e9a6be7baf84208bb6e10ac9f9bbe1d70809",
"implAddr": "0x62c20aa1e0272312bc100b4e23b4dc1ed96dd7d1"
},
"BuyerAgentFactory": "0xc48af3ef03d91af34b891688ade004ad36c8c39a",
"SwanAssetFactory": "0xebb2c54b2a20e0e25b2fb168c8a657e1c966911f"
"SwanAssetFactory": "0xebb2c54b2a20e0e25b2fb168c8a657e1c966911f",
"AIAgentFactory": {
"addr": "0x34a1d3fff3958843c43ad80f30b94c510645c316"
},
"ArtifactFactory": {
"addr": "0x90193c961a926261b756d1e5bb255e67ff9498a1"
}
}
26 changes: 9 additions & 17 deletions docs/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Swan is a **Decentralized Protocol** where AI agents (buyers) dynamically intera
Compile the contracts with:

```sh
forge build
forge clean && forge build
```

> [!NOTE]
Expand All @@ -18,13 +18,13 @@ forge build
Run tests on local:

```sh
forge test --force
forge clean && forge test
```

or on any other evm chain:

```sh
forge test --rpc-url <RPC_URL>
forge clean && forge test --rpc-url <RPC_URL>
```

## Deployment
Expand Down Expand Up @@ -54,30 +54,22 @@ cast wallet list
> You HAVE to type your password on the terminal to be able to use your keys. (e.g when deploying a contract)

**Step 3.**
Enter your private key (associated with your public key) and password on terminal. You'll see your public key on terminal.
Enter your private key (associated with your address) and password on terminal. You'll see your address on terminal.

> [!NOTE]
>
> If you want to deploy contracts on localhost please provide local public key for the command above.
> If you want to deploy contracts on localhost please provide local address for the command above.

**Step 4.** Required only for local deployment.

Start a local node with:

```sh
anvil
```

**Step 5.**
Deploy the contracts with:
**Step 4.**
Deploy the contract with:

```sh
forge script ./script/Deploy.s.sol:Deploy --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_PUBLIC_KEY> --broadcast
forge clean && forge script ./script/Deploy.s.sol:Deploy<CONTRACT_NAME> --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_ADDRESS> --broadcast
```
or for instant verification use:

```sh
forge script ./script/Deploy.s.sol:Deploy --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_PUBLIC_KEY> --broadcast --verify --verifier <etherscan|blockscout|sourcify> --verifier-url <VERIFIER_URL>
forge clean && forge script ./script/Deploy.s.sol:Deploy --rpc-url <RPC_URL> --account <FILE_NAME_OF_YOUR_KEYSTORE> --sender <DEPLOYER_ADDRESS> --broadcast --verify --verifier <etherscan|blockscout|sourcify> --verifier-url <VERIFIER_URL>
```

> [!NOTE]
Expand Down
8 changes: 4 additions & 4 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# src
- [❱ mock](src/mock/README.md)
- [SwanV2](src/mock/SvanV2.sol/contract.SwanV2.md)
- [BuyerAgentFactory](src/BuyerAgent.sol/contract.BuyerAgentFactory.md)
- [BuyerAgent](src/BuyerAgent.sol/contract.BuyerAgent.md)
- [AIAgentFactory](src/AIAgent.sol/contract.AIAgentFactory.md)
- [AIAgent](src/AIAgent.sol/contract.AIAgent.md)
- [ArtifactFactory](src/Artifact.sol/contract.ArtifactFactory.md)
- [Artifact](src/Artifact.sol/contract.Artifact.md)
- [Swan](src/Swan.sol/contract.Swan.md)
- [Swan constants](src/Swan.sol/constants.Swan.md)
- [SwanAssetFactory](src/SwanAsset.sol/contract.SwanAssetFactory.md)
- [SwanAsset](src/SwanAsset.sol/contract.SwanAsset.md)
- [SwanMarketParameters](src/SwanManager.sol/struct.SwanMarketParameters.md)
- [SwanManager](src/SwanManager.sol/abstract.SwanManager.md)
Loading
Loading