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

Update uploader task to work with release v0.1.0 #134

Merged
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
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,55 @@ Read Story Block
npx hardhat sp:read-ip-asset--network <network> <franchiseId> <IPAssetId>
```

Upload Story Blocks and Relationships

This section requires more detail to establish how to format an input JSON data file. In the file, the data should be separated under "ip-assets" and "relationships".

The IP Assets are stored in arrays and represented as JSON objects. For each story block, the following fields are required:
```
// example:
stories: [
// this is an individual story to be uploaded.
{
"id": null,
"ipAssetType": "STORY",
"name": "The Full Grain World Bible",
"description": "Lorem Ipsum",
"mediaURL": "https://www.youtube.com/watch?v=9bZkp7q19f0"
}
]
```

The ID is initially set to null to identify an IPAsset that is yet to be uploaded; the file will be rewritten once blocks are successfully uploaded. This means, once the script finished if some batch txs failed, running the script again will only try to upload the failed IP Assets (since it skips ids that are not null)

To upload relationships, the following fields are needed:

```
"relationships": [
{
"sourceContract": "same", // Address of the source contract, or "same" if it's the franchise passed as parameter
"sourceAssetType": "stories", // key for the source IPA data array in the JSON
"sourceAssetIndex": 0, // Index of the source IPA in the array correspondent to the key above
"destContract": "same", // Address of the destination contract, or "same" if it's the franchise passed as parameter
"destAssetType": "characters", // key for the destination IPA data array in the JSON
"destAssetIndex": 0, // Index of the destination IPA in the array correspondent to the key above
"data": "0x", // Hook params, if any
"name": "TEST_RELATIONSHIP", // Name of the relationship, as per SPIP
"ttl": 1, // Int, duration in seconds of the relationship, in case it can be time limited. Ignored otherwise
"sourceId": null, //null in the beginning since the IPAs are not uploaded, will be set by the script
"destId": null, //null in the beginning since the IPAs are not uploaded, will be set by the script
"relationshipId": null //null in the beginning since relationship is unset, it will be the hash of name.
}
]
```

[The full example JSON is in script/data/data_example.json](/script/data/data_example.json)

To call the task, use the following:
```
npx hardhat --network <network> -sp:uploader <franchiseId> <address that receives the IPAs> <pathname of JSON data> --batchSize <optional number of entried batched per tx>
```

### Working with a local network

Foundry comes with local network [anvil](https://book.getfoundry.sh/anvil/index.html) baked in, and allows us to deploy to our local network for quick testing locally.
Expand Down
39 changes: 39 additions & 0 deletions broadcast/SetupFranchiseLicensing.s.sol/5/run-1697499962.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"transactions": [
{
"hash": "0xd489222a56f1e29887a4d0507d9470e7c4b11f5ae2e71f6d16ed382d20cd13fa",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x08341162Ea337B086dCa69E13ECf76F868F7025A",
"function": "configureFranchiseLicensing(uint256,((bool,uint256),(address,bytes),(bool,uint256),(address,bytes),bool,address,string))",
"arguments": [
"250",
"((true, 0), (0x0000000000000000000000000000000000000000, 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000), (true, 0), (0x0000000000000000000000000000000000000000, 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000), false, 0xB6288e57bf7406B35ab4F70Fd1135E907107e386, https://commercial.license)"
],
"rpc": "https://eth-goerli.g.alchemy.com/v2/7WyRjkZW0XJmt7tb4OqO9YTp5z_iVl-o",
"transaction": {
"type": "0x02",
"from": "0xb6288e57bf7406b35ab4f70fd1135e907107e386",
"to": "0x08341162ea337b086dca69e13ecf76f868f7025a",
"gas": "0x52377",
"value": "0x0",
"data": "0x4f0bf5b600000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e38600000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a68747470733a2f2f636f6d6d65726369616c2e6c6963656e7365000000000000",
"nonce": "0x7b",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [],
"libraries": [],
"pending": [
"0xd489222a56f1e29887a4d0507d9470e7c4b11f5ae2e71f6d16ed382d20cd13fa"
],
"path": "/Users/drmanhattan/Workspace/StoryProtocol/protocol-contracts/broadcast/SetupFranchiseLicensing.s.sol/5/run-latest.json",
"returns": {},
"timestamp": 1697499962,
"chain": 5,
"multi": false,
"commit": "4d5657c"
}
68 changes: 68 additions & 0 deletions broadcast/SetupFranchiseLicensing.s.sol/5/run-1697499975.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"transactions": [
{
"hash": "0xd489222a56f1e29887a4d0507d9470e7c4b11f5ae2e71f6d16ed382d20cd13fa",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x08341162Ea337B086dCa69E13ECf76F868F7025A",
"function": "configureFranchiseLicensing(uint256,((bool,uint256),(address,bytes),(bool,uint256),(address,bytes),bool,address,string))",
"arguments": [
"250",
"((true, 0), (0x0000000000000000000000000000000000000000, 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000), (true, 0), (0x0000000000000000000000000000000000000000, 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000), false, 0xB6288e57bf7406B35ab4F70Fd1135E907107e386, https://commercial.license)"
],
"rpc": "https://eth-goerli.g.alchemy.com/v2/7WyRjkZW0XJmt7tb4OqO9YTp5z_iVl-o",
"transaction": {
"type": "0x02",
"from": "0xb6288e57bf7406b35ab4f70fd1135e907107e386",
"to": "0x08341162ea337b086dca69e13ecf76f868f7025a",
"gas": "0x52377",
"value": "0x0",
"data": "0x4f0bf5b600000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e38600000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a68747470733a2f2f636f6d6d65726369616c2e6c6963656e7365000000000000",
"nonce": "0x7b",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0xd489222a56f1e29887a4d0507d9470e7c4b11f5ae2e71f6d16ed382d20cd13fa",
"transactionIndex": "0x1",
"blockHash": "0x172e87500b70c741f972f48644b58c753d80377ea24f3c8867890de073770fc7",
"blockNumber": "0x96becb",
"from": "0xB6288e57bf7406B35ab4F70Fd1135E907107e386",
"to": "0x08341162Ea337B086dCa69E13ECf76F868F7025A",
"cumulativeGasUsed": "0x40a68",
"gasUsed": "0x3b860",
"contractAddress": null,
"logs": [
{
"address": "0x08341162Ea337B086dCa69E13ECf76F868F7025A",
"topics": [
"0xe6fbfbfdd71227edcd5ffab5dbc0fac8662dffc1be715c591efb2214665b9de5"
],
"data": "0x00000000000000000000000000000000000000000000000000000000000000fa00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e38600000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a68747470733a2f2f636f6d6d65726369616c2e6c6963656e7365000000000000",
"blockHash": "0x172e87500b70c741f972f48644b58c753d80377ea24f3c8867890de073770fc7",
"blockNumber": "0x96becb",
"transactionHash": "0xd489222a56f1e29887a4d0507d9470e7c4b11f5ae2e71f6d16ed382d20cd13fa",
"transactionIndex": "0x1",
"logIndex": "0x0",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x02000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb2d05e08"
}
],
"libraries": [],
"pending": [],
"path": "/Users/drmanhattan/Workspace/StoryProtocol/protocol-contracts/broadcast/SetupFranchiseLicensing.s.sol/5/run-latest.json",
"returns": {},
"timestamp": 1697499975,
"chain": 5,
"multi": false,
"commit": "4d5657c"
}
Loading