-
Notifications
You must be signed in to change notification settings - Fork 14
Review project #2
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
Conversation
kalamkhan114
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull request
| from common import get_key_address | ||
|
|
||
| ############################# | ||
| # Core Deployment Variables # | ||
| ############################# | ||
|
|
||
| # Deployment | ||
| OWNER_KEY_NAME = "rwa" | ||
| OWNER_KEY_ADDRESS = get_key_address(OWNER_KEY_NAME) | ||
| CONTRACTS = { | ||
| "owner_roles_address": "kii1hez8n9mnljtca28xrg4a54p4cdharlsg0vku0008ng64ldgfapdqsqctag", | ||
| "agent_roles_address": "kii14tzdqsgsdfcgxy0zu2vqcaj347lv5xpelpadusrspnkxddc53fhq9vc0h8", | ||
| "trusted_issuers_address": "kii17xsl3q2p3elhh747r3ttn08j2p95jsd3c7rfmuc5rws5a20u9kqqrrx0nd", | ||
| "claim_topics_address": "kii17k6uthn6ymd3ta25glx6qpa2sfz2hkt5a22lynzdm7xgk7kklckqc4gytm", | ||
| "on_chain_id_address": "kii1y8s38zn7ry7xc95ej2z08eq520y4v9qdsysfgkfwelhh635e4t2qq8xxp5", | ||
| "compliance_registry_address": "kii1dpws8lmu2l4awdau6zhezxm97tshu427aulr2xwp7uarpd8jqu7srjz2gm", | ||
| "compliance_claims_address": "kii12n3frtnx8mh2vpvzk7mqkr6yqkfe77339c7uakzqqa4pv46zdr9qt020h3", | ||
| "compliance_country_restriction_address": "kii1k4j6gr75k23tvqjdw9zvtrdxh7pxtexy5pdk7xjmwf385msx75fsz470kz", | ||
| "cw20_base_address": "kii1zvjy36ysunq56dhgyxggp5gwrymxjs95twj5lgcpqujftppn739s83aym4", | ||
| } | ||
|
|
||
| # Management | ||
| TRUSTED_ISSUER_KEY_NAME = "trusted_issuer" | ||
| TRUSTED_ISSUER_KEY_ADDRESS = get_key_address(TRUSTED_ISSUER_KEY_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that it would be a real config file xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x)
| # CW20 base for test token | ||
| print("Deploying CW20 Base contract...") | ||
| cw20_base = store_contract("artifacts/cw20_base.wasm", KEY_NAME) | ||
| print(f"CW20 Base stored with code ID {cw20_base}") | ||
| cw20_base_init_msg = { | ||
| "token_info": { | ||
| "name": "Test Token", | ||
| "symbol": "TEST", | ||
| "decimals": 6, | ||
| "initial_balances": [{"address": KEY_ADDRESS, "amount": "1000000"}], | ||
| }, | ||
| "registries": { | ||
| "compliance_address": compliance_registry_address, | ||
| }, | ||
| } | ||
| cw20_base_address = instantiate_contract( | ||
| cw20_base, cw20_base_init_msg, "CW20Base", KEY_NAME | ||
| ) | ||
| print(f"CW20 Base contract instantiated at {cw20_base_address}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a RWA token configurator to prepare new tokens we want to release.
We can probably pass a json as argument where we fill all the information and then python applies the heavy lifting
| # Query contract queries a contract with the given query message | ||
| def query_contract(contract_address, query_msg): | ||
| # Build the command to query the contract | ||
| cmd = [ | ||
| KIICHAIN, | ||
| "query", | ||
| "wasm", | ||
| "contract-state", | ||
| "smart", | ||
| contract_address, | ||
| json.dumps(query_msg), | ||
| "--node", RPC_URL, | ||
| "-o", "json" | ||
| ] | ||
|
|
||
| # Run the command | ||
| result, err = run_cmd(cmd) | ||
| if err: | ||
| raise Exception(f"Failed to query contract: {err}") | ||
|
|
||
| # Parse and return the result | ||
| return json.loads(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not expecting queries to error out, but your suggestion on applying the expected error is nice. I ways like to have a good control on errors. So we can probably match the if error is really the expected error by checking for a substring that could be raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a query that tries to match error
Description
Reviews contract and checks utilities so we can better understand it. Document discoveries.