Skip to content

Commit

Permalink
fixed L-04 + ref + update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
caglacelik committed Dec 1, 2024
1 parent 9c416af commit 74ef499
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 104 deletions.
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cache/
out/

# coverage
# Coverage
coverage/

# Ignores development broadcast logs
Expand All @@ -14,21 +14,13 @@ coverage/
# Docs
docs/

# Dotenv file
.env

# Forge files
cache/
out/
storage/

# gas snapshot
# Gas snapshot
.gas-snapshot/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Dotenv file
.env
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ endif
install:
forge install foundry-rs/forge-std --no-commit && forge install firstbatchxyz/dria-oracle-contracts --no-commit && forge install OpenZeppelin/openzeppelin-contracts --no-commit && forge install OpenZeppelin/openzeppelin-foundry-upgrades --no-commit && forge install OpenZeppelin/openzeppelin-contracts-upgradeable --no-commit

# Update modules
update:
forge update

# Build the contracts
build:
forge clean && forge build
Expand Down Expand Up @@ -45,6 +49,10 @@ deploy:
doc:
forge doc

# Format code
fmt:
forge fmt

# TODO: forge-verify

# Prevent make from interpreting the network name as a target
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ Run tests on forked base-sepolia:
make test
```

## Format

Format code with:

```sh
make fmt
```

## Update

Update modules with:

```sh
make update
```

## Coverage

Check coverages with:
Expand Down
16 changes: 8 additions & 8 deletions deployment/31337.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"LLMOracleRegistry": {
"proxyAddr": "0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0",
"implAddr": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512"
"proxyAddr": "0x90193c961a926261b756d1e5bb255e67ff9498a1",
"implAddr": "0x34a1d3fff3958843c43ad80f30b94c510645c316"
},
"LLMOracleCoordinator": {
"proxyAddr": "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9",
"implAddr": "0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9"
"proxyAddr": "0xbb2180ebd78ce97360503434ed37fcf4a1df61c3",
"implAddr": "0xa8452ec99ce0c64f20701db7dd3abdb607c00496"
},
"Swan": {
"proxyAddr": "0x2279b7a0a67db372996a5fab50d91eaa73d2ebe6",
"implAddr": "0xa513e6e4b8f2a923d98304ec87f64353c4d5c853"
"proxyAddr": "0xdeb1e9a6be7baf84208bb6e10ac9f9bbe1d70809",
"implAddr": "0x62c20aa1e0272312bc100b4e23b4dc1ed96dd7d1"
},
"BuyerAgentFactory": "0x5fc8d32690cc91d4c39d9d3abcbd16989f875707",
"SwanAssetFactory": "0x0165878a594ca255338adfa4d48449f69242eb8f"
"BuyerAgentFactory": "0xdb8cff278adccf9e9b5da745b44e754fc4ee3c76",
"SwanAssetFactory": "0x50eef481cae4250d252ae577a09bf514f224c6c4"
}
2 changes: 1 addition & 1 deletion lib/forge-std
Submodule forge-std updated 2 files
+99 −64 src/Vm.sol
+2 −2 test/Vm.t.sol
2 changes: 1 addition & 1 deletion lib/openzeppelin-foundry-upgrades
17 changes: 17 additions & 0 deletions src/Swan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@ contract Swan is SwanManager, UUPSUpgradeable {
isOperator[msg.sender] = true;
}

/// @notice Transfer ownership of the contract.
/// @dev Overrides the default `transferOwnership` function to make the new owner an operator.
/// @param newOwner address of the new owner.
function transferOwnership(address newOwner) public override onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
// remove the old owner from the operator list
isOperator[msg.sender] = false;

// transfer ownership
_transferOwnership(newOwner);

// make new owner an operator
isOperator[newOwner] = true;
}

/*//////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
Expand Down
6 changes: 3 additions & 3 deletions test/BuyerAgent.t.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {Upgrades} from "@openzeppelin/foundry-upgrades/Upgrades.sol";
import {Vm} from "forge-std/Vm.sol";
import {Helper} from "./Helper.t.sol";

import {WETH9} from "./WETH9.sol";
import {Upgrades} from "@openzeppelin/foundry-upgrades/Upgrades.sol";
import {BuyerAgent, BuyerAgentFactory} from "../src/BuyerAgent.sol";
import {LLMOracleCoordinator} from "@firstbatch/dria-oracle-contracts/LLMOracleCoordinator.sol";
import {SwanAssetFactory} from "../src/SwanAsset.sol";
import {LLMOracleTaskParameters} from "@firstbatch/dria-oracle-contracts/LLMOracleTask.sol";
import {LLMOracleRegistry} from "@firstbatch/dria-oracle-contracts/LLMOracleRegistry.sol";
import {Swan} from "../src/Swan.sol";
import {console} from "forge-std/Test.sol";

contract BuyerAgentTest is Helper {
address agentOwner;
Expand All @@ -36,7 +36,7 @@ contract BuyerAgentTest is Helper {
"LLMOracleCoordinator.sol",
abi.encodeCall(
LLMOracleCoordinator.initialize,
(address(oracleRegistry), address(token), fees.platformFee, fees.generationFee, fees.validationFee)
(address(oracleRegistry), address(token), fees.platformFee, fees.generatorFee, fees.validatorFee)
)
);
oracleCoordinator = LLMOracleCoordinator(coordinatorProxy);
Expand Down
Loading

0 comments on commit 74ef499

Please sign in to comment.