Skip to content

Commit

Permalink
add whitelisted update to publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
cfcfs committed Nov 7, 2024
1 parent 697341e commit 3e862b9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configs/dev/p2p.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"p2p_controller": "0xF860aFfDc6F4983C33d29446d795BB61c2f44BAD",
"payment_token": "0xE33b26CA786cC720DD11289D36bAE3Af051839fb"
},
"token_symbol": "WETH",
"version": "1"
},
"usdc_nfts": {
Expand All @@ -138,6 +139,7 @@
"p2p_controller": "0xF860aFfDc6F4983C33d29446d795BB61c2f44BAD",
"payment_token": "0xa72aC03c2f446ab8a648651735c7dB9dCE5809Ab"
},
"token_symbol": "USDC",
"version": "1"
}
}
Expand Down
2 changes: 2 additions & 0 deletions configs/int/p2p.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"p2p_controller": "0x4a8900CB9566EC2a8967B534Cb5044e63DF34691",
"payment_token": "0xB7603602860a4816154F2A3bA4d6aBDDd8937b84"
},
"token_symbol": "WETH",
"version": "1"
},
"usdc_nfts": {
Expand All @@ -89,6 +90,7 @@
"p2p_controller": "0x4a8900CB9566EC2a8967B534Cb5044e63DF34691",
"payment_token": "0x74540605Dc99f9cd65A3eA89231fFA727B1049E2"
},
"token_symbol": "USDC",
"version": "1"
}
}
Expand Down
14 changes: 14 additions & 0 deletions scripts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
COLLECTIONS = DYNAMODB.Table(f"collections-{ENV.name}")
ABI = DYNAMODB.Table(f"abis-{ENV.name}")
KEY_ATTRIBUTES = ["p2p_config_key"]
EMPTY_BYTES32 = "00" * 32


def abi_key(abi: list) -> str:
Expand Down Expand Up @@ -84,6 +85,14 @@ def update_collection_trait_root(collection_key: str, root: str):
)


def update_collection_p2p_whitelisted(collection_key: str, *, whitelisted: bool):
COLLECTIONS.update_item(
Key={"collection_key": collection_key},
UpdateExpression="SET p2p_whitelisted=:v",
ExpressionAttributeValues={":v": whitelisted},
)


def update_abi(abi_key: str, abi: list[dict]):
ABI.update_item(Key={"abi_key": abi_key}, UpdateExpression="SET abi=:v", ExpressionAttributeValues={":v": abi})

Expand Down Expand Up @@ -118,4 +127,9 @@ def cli():
print(f"updating trait root {collection=} {root=}")
update_collection_trait_root(collection, root)

for collection, root in trait_roots.items():
whitelisted = root != EMPTY_BYTES32
print(f"updating whitelisted root {collection=} {whitelisted=}")
update_collection_p2p_whitelisted(collection, whitelisted=whitelisted)

print(f"P2P configs updated in {ENV.name}")

0 comments on commit 3e862b9

Please # to comment.