Skip to content

Commit

Permalink
partially edited the basic agent section
Browse files Browse the repository at this point in the history
  • Loading branch information
ijonele committed Dec 24, 2024
1 parent 54ad7b4 commit 9339191
Show file tree
Hide file tree
Showing 9 changed files with 421 additions and 361 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"position": 6,
"label": "Basic Warden Agent",
"label": "Build a Basic Warden Agent",
"collapsible": true,
"collapsed": false,
"link": {
"type": "generated-index",
"title": "Basic Warden Agent"
"title": "Build a Basic Warden Agent"
},
"customProps": {}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
sidebar_position: 5
sidebar_position: 6
---

# Order Factory Contract
# Create the OrderFactory contract

## Implementing the Order Factory Contract
The `OrderFactory` contract manages agent creation and tracking with enhanced security features.

The OrderFactory contract manages agent creation and tracking with enhanced security features:
Create a contract `OrderFactory.sol`.

Create - `src/OrderFactory.sol`:
:::note GitHub
You can find the full code on GitHub: [`/src/OrderFactory.sol`](https://github.com/warden-protocol/wardenprotocol/blob/main/solidity/orders/src/OrderFactory.sol)
:::

```solidity
```solidity title="/src/OrderFactory.sol"
contract OrderFactory is Ownable {
// NEW: Enhanced tracking and security
mapping(address orderAddress => address orderCreator) public orders;
Expand All @@ -37,24 +39,24 @@ contract OrderFactory is Ownable {
}
```

[Code Reference](https://github.com/warden-protocol/wardenprotocol/blob/main/solidity/orders/src/OrderFactory.sol)

**Key Features:**

1.Factory Pattern:

- Creates new order instances
- Tracks order creators
- Supports multiple order types

2.Management:

- Ownable for admin control
- Scheduler management
- Registry integration

3.Order Creation:

- Basic orders supported
- Advanced orders placeholder
- Order registration in Registry
**Key features:**

1. Factory pattern:
- Creates new order instances
- Tracks order creators
- Supports multiple order types
2. Management:
- Ownable for admin control
- Scheduler management
- Registry integration
3. Order creation:
- Basic orders supported
- Advanced orders placeholder
- Order registration in Registry

After creating the Orderfactory contract, you can [implement the deployment scripts](deploy_script).
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
---
sidebar_position: 6
sidebar_position: 7
---

# Deploy Script
# Implement the deployment scripts

## Overview

Let's implement the deployment scripts. We'll need two scripts: one for deployment and one for creating orders.

## Create `script/Deploy.s.sol:`
## 1. Implement a script for deployment

:::note GitHub
You can find the full code on GitHub: [`/script/Deploy.s.sol`](https://github.com/warden-protocol/wardenprotocol/blob/main/solidity/orders/script/Deploy.s.sol)
:::

```solidity
```solidity title="/script/Deploy.s.sol"
contract Deploy is Script {
function run() external {
vm.startBroadcast(broadcaster);
Expand All @@ -29,11 +35,19 @@ contract Deploy is Script {
}
```

[Code Reference](https://github.com/warden-protocol/wardenprotocol/blob/main/solidity/orders/script/Deploy.s.sol)
This script handles the following tasks:

1. Registry deployment
2. Factory deployment
3. Environment configuration

## 2. Implement a script for creating orders

## Create `script/CreateOrder.s.sol:`
:::note GitHub
You can find the full code on GitHub: [`/script/CreateOrder.s.sol`](https://github.com/warden-protocol/wardenprotocol/blob/main/solidity/orders/script/CreateOrder.s.sol)
:::

```solidity
```solidity title="/script/CreateOrder.s.sol"
contract CreateOrder is Script {
function run(
uint256 thresholdPrice,
Expand All @@ -50,18 +64,12 @@ contract CreateOrder is Script {
}
```

[Code Reference](https://github.com/warden-protocol/wardenprotocol/blob/main/solidity/orders/script/CreateOrder.s.sol)

### These scripts handle the following tasks

**Deploy.s.sol:**

1. Registry deployment
2. Factory deployment
3. Environment configuration

**CreateOrder.s.sol:**
This script handles the following tasks:

1. Order creation through factory
2. Mock precompiles setup
3. Parameter configuration

## Next steps

After creating implementing the deployment scripts, you can finally [deploy the trading Agent](deployment).
Loading

0 comments on commit 9339191

Please sign in to comment.