Skip to content

Commit

Permalink
Merge branch 'order-flow-testing' of https://github.com/open-dollar/o…
Browse files Browse the repository at this point in the history
…d-seaport-zone into order-flow-testing
  • Loading branch information
MrDeadCe11 committed Jun 18, 2024
2 parents 8fdf4f8 + df0b8c9 commit ed0b0ea
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 211 deletions.
42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,43 @@
</a>
</p>

Template for projects using `@opendollar/contracts` with Foundry
# Dynamic Traits Enforcement Zone

**Documentation**
A Seaport zone for specifying and enforcing values of ERC-7496 Dynamic Traits

## Documentation
View the SIP-15 standard: https://github.com/open-dollar/SIPs/blob/main/SIPS/sip-15.md

- https://book.getfoundry.sh/
- https://contracts.opendollar.com
- https://docs.opendollar.com
## Setup

1. Copy the `.env.example` and update the following values:

## Attn:
```bash
ARB_SEPOLIA_RPC=

before running these tests, you must cd into the lib/seaport folder and run
ARB_SEPOLIA_OFFERER_PK=
ARB_SEPOLIA_BUYER_PK=
```

`FOUNDRY_PROFILE=optimized forge build`
2. Use the “Offerer” wallet to open a vault on Open Dollar testnet https://app.dev.opendollar.com

2. User the “Buyer” wallet to mint the consideration token "ARB" at https://sepolia.arbiscan.io/address/0x3018EC2AD556f28d2c0665d10b55ebfa469fD749#writeContract


## Create listing

```bash
yarn
yarn build

# Create Listing
yarn create-listing <chainName> <tokenId> <considerationAmountInEther>
yarn create-listing sepolia 313 0.000001

# Execute listing
yarn fulfill <chainName> <orderPath>
yarn fulfill sepolia orders/order-1-1718667016.json
```

Notes:
- Vaults have a 100 second cooldown on testnet before they can be transferred.
- Order `endTime` is 24 hours
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"parameters": {
"offerer": "0xC295763Eed507d4A0f8B77241c03dd3354781a15",
"zone": "0xc5736e1f01fb4f013c152b8315019ca20d30fc50",
"zone": "0xcafc335d2f5bd0e929b4edbf526eb74fa4c49924",
"zoneHash": "0xfd67bb706f1e45b1ac95cb3ba2b364f80af346352b62b4348c1cbf33633b40d0",
"startTime": 1718665374,
"endTime": "1718751774",
"startTime": 1718667016,
"endTime": "1718753416",
"orderType": 2,
"offer": [
{
Expand All @@ -20,15 +20,15 @@
"itemType": 1,
"token": "0x3018EC2AD556f28d2c0665d10b55ebfa469fD749",
"identifierOrCriteria": "0",
"startAmount": "100000000000000000",
"endAmount": "100000000000000000",
"startAmount": "1000000000000000000",
"endAmount": "1000000000000000000",
"recipient": "0xC295763Eed507d4A0f8B77241c03dd3354781a15"
}
],
"totalOriginalConsiderationItems": 1,
"salt": "0x000000000000000000000000000000000000000000000000dfd7adde39e1bb1a",
"salt": "0x0000000000000000000000000000000000000000000000007c75eaa0d516a5c9",
"conduitKey": "0x0000000000000000000000000000000000000000000000000000000000000000",
"counter": "0"
},
"signature": "0x4def5169700431f00c05cede4803fbf830215022bade22aca3aa462fc9a8fce3be2a8ed2c5fd84303ee22b3bf3de2952855562013c243c13aa4f13bacfe8555c"
"signature": "0x7efe32dadfad76f5a3e2e6709667fdb1a0d21047c80592d95e3b9f99868de70f995f07dd9f97d7b1831a2a846b76836699fd5108bb665f4463302c86e9b68791"
}
34 changes: 0 additions & 34 deletions orders/order-128-1718408958.json

This file was deleted.

34 changes: 0 additions & 34 deletions orders/order-137-1718666158.json

This file was deleted.

34 changes: 0 additions & 34 deletions orders/order-15-1718665861.json

This file was deleted.

34 changes: 0 additions & 34 deletions orders/order-15-1718665995.json

This file was deleted.

25 changes: 10 additions & 15 deletions script/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,22 @@ export const ARB_MAINNET_PK = process.env.ARB_MAINNET_PK;
export const ARB_SEPOLIA_RPC = process.env.ARB_SEPOLIA_RPC;
export const ARB_MAINNET_RPC = process.env.ARB_MAINNET_RPC;

// export const SIP15_ZONE_MAINNET_ADDRESS = checkMainnetAddress(mainnetDeployments, 0)
export const SIP15_ZONE_SEPOLIA_ADDRESS = checkSepoliaAddress(
sepoliaDeployments,
0
);
export const SIP15_ZONE_MAINNET_ADDRESS =
process.env.SIP15_ZONE_MAINNET_ADDRESS;
export const SIP15_ZONE_SEPOLIA_ADDRESS =
process.env.SIP15_ZONE_SEPOLIA_ADDRESS;

export const VAULT721_SEPOLIA_ADAPTER_ADDRESS = checkSepoliaAddress(
sepoliaDeployments,
1
);
export const VAULT721_SEPOLIA_ADAPTER_ADDRESS =
process.env.VAULT721_SEPOLIA_ADAPTER_ADDRESS;

// export const VAULT721_MAINNET_ADAPTER_ADDRESS = checkMainnetAddress(mainnetDeployments, 1)
export const VAULT721_MAINNET_ADAPTER_ADDRESS =
process.env.VAULT721_MAINNET_ADAPTER_ADDRESS;
export const VAULT721_SEPOLIA_ADDRESS = sepoliaContracts.Vault721_Address;
export const VAULT721_MAINNET_ADDRESS = mainnetContracts.Vault721_Address;
export const VAULT721_ANVIL_ADDRESS = process.env.VAULT721_ANVIL_ADDRESS;

// export const ENCODING_HELPER_MAINNET = checkMainnetAddress(mainnetDeployments, 2)
export const ENCODING_HELPER_SEPOLIA = checkSepoliaAddress(
sepoliaDeployments,
2
);
export const ENCODING_HELPER_MAINNET = process.env.ENCODING_HELPER_MAINNET;
export const ENCODING_HELPER_SEPOLIA = process.env.ENCODING_HELPER_SEPOLIA;

export const Vault721AdapterABI = require("../../abis/Vault721Adapter.json");
export const EncodeSubstandard5ForEthersABI = require("../../abis/EncodeSubstandard5ForEthers.json");
Expand Down
44 changes: 0 additions & 44 deletions script/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,6 @@ export function stringToObject(str: string): ParsedObjectType {
return trimmedObject;
}

export function checkMainnetAddress(
deployment: any,
index: number
): string | undefined {
return (() => {
try {
return deployment.receipts[index].contractAddress;
} catch (error) {
if (index == 0 && process.env.SIP15_ZONE_MAINNET_ADDRESS) {
return process.env.SIP15_ZONE_MAINNET_ADDRESS;
} else if (index == 1 && process.env.VAULT721_MAINNET_ADAPTER_ADDRESS) {
return process.env.VAULT721_MAINNET_ADAPTER_ADDRESS;
} else if (index == 2 && process.env.ENCODING_HELPER_MAINNET) {
return process.env.ENCODING_HELPER_MAINNET;
} else {
console.error(error);
}
}
})();
}

export function checkSepoliaAddress(
deployment: any,
index: number
): string | undefined {
return (() => {
try {
return deployment.receipts[index].contractAddress;
} catch (error) {
if (index == 0 && process.env.SIP15_ZONE_SEPOLIA_ADDRESS) {
return process.env.SIP15_ZONE_SEPOLIA_ADDRESS;
} else if (index == 1 && process.env.VAULT721_SEPOLIA_ADAPTER_ADDRESS) {
return process.env.VAULT721_SEPOLIA_ADAPTER_ADDRESS;
} else if (index == 2 && process.env.ENCODING_HELPER_SEPOLIA) {
return process.env.ENCODING_HELPER_SEPOLIA;
} else {
// console.error(error);
return null;
// throw new Error("addresses cannot be gotten");
}
}
})();
}

export function convertBigIntsToStrings(
obj: Record<string, any>
): Record<string, any> {
Expand Down

0 comments on commit ed0b0ea

Please sign in to comment.