From 3d6d9a07e0593075ea5ce025574bfc30648a8ec9 Mon Sep 17 00:00:00 2001 From: Sai Medury Date: Tue, 8 Mar 2022 22:21:47 -0600 Subject: [PATCH] Cleanup: removed secret tokens and fixed License mention --- .gitignore | 1 + README.md | 11 ++++++++--- contracts/constants.py | 21 +++++++++++++++++++++ contracts/dot_algo_name_record.py | 11 +++++++++++ contracts/dot_algo_registry.py | 11 +++++++++++ unit-tests/TestDotAlgoNameRegistry.py | 11 +++++++++++ unit-tests/ans_helper.py | 17 +++++++++++++++-- 7 files changed, 78 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8c5fcda..27dcc0b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ # TODO: Need to find a better solution to import files in python unit-tests/dot_algo_registry.py unit-tests/dot_algo_name_record.py +unit-tests/mysecrets.py diff --git a/README.md b/README.md index 94c50ce..ba26f7c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,16 @@ -# ANS 1.0 registry smart contracts +# ANS v1.0 registry smart contracts -Smart contract and logic signature code for Algorand Name Service 1.0 +Smart contract and logic signature code for Algorand Name Service v1.0 ## Run unit tests +Add PureStake API key to `unit-tests/mysecrets.py` +```python +# unit-tests/mysecrets.py +MY_PURESTAKE_TOKEN="" +``` Change directory into unit-tests and run python scripts: -``` +```bash cd unit-tests python3 TestDotAlgoNameRegistry.py ``` diff --git a/contracts/constants.py b/contracts/constants.py index 5ffc853..b14c137 100644 --- a/contracts/constants.py +++ b/contracts/constants.py @@ -1,3 +1,24 @@ +''' +Copyright (c) 2022 Algorand Name Service + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +''' COST_FOR_3 = 150000000 COST_FOR_4 = 50000000 COST_FOR_5 = 5000000 diff --git a/contracts/dot_algo_name_record.py b/contracts/dot_algo_name_record.py index 4ba6937..5818486 100644 --- a/contracts/dot_algo_name_record.py +++ b/contracts/dot_algo_name_record.py @@ -7,6 +7,17 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. ''' from pyteal import * diff --git a/contracts/dot_algo_registry.py b/contracts/dot_algo_registry.py index 00e4fce..e68bb9c 100644 --- a/contracts/dot_algo_registry.py +++ b/contracts/dot_algo_registry.py @@ -7,6 +7,17 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. ''' from pyteal import * diff --git a/unit-tests/TestDotAlgoNameRegistry.py b/unit-tests/TestDotAlgoNameRegistry.py index 0d745e7..f182d21 100644 --- a/unit-tests/TestDotAlgoNameRegistry.py +++ b/unit-tests/TestDotAlgoNameRegistry.py @@ -7,6 +7,17 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. ''' import unittest, time diff --git a/unit-tests/ans_helper.py b/unit-tests/ans_helper.py index 9fd0130..f4a3877 100644 --- a/unit-tests/ans_helper.py +++ b/unit-tests/ans_helper.py @@ -7,6 +7,17 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. ''' from algosdk import mnemonic, account, encoding @@ -24,6 +35,8 @@ from contracts.dot_algo_name_record import ValidateRecord import base64 import datetime,time +# Import PureStake API +import mysecrets def SetupClient(network): @@ -36,9 +49,9 @@ def SetupClient(network): elif(network=="purestake"): # Purestake conn algod_address = "https://testnet-algorand.api.purestake.io/ps2" - algod_token = "iG4m46pAcU5ws8WYhgYPu1rywUbfYT2DaAfSs9Tv" + algod_token = mysecrets.MY_PURESTAKE_TOKEN headers = { - "X-API-Key": algod_token, + "X-API-Key": mysecrets.MY_PURESTAKE_TOKEN } else: