Define helper functions.

Copyright (C) 2021 Gitcoin Core

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.


get_token(token_id, network, address)

Helper to find the kudos.Token primary key, given the contract address and token_id fields. This function was created so that we can find the kudos token pk, only know the contract and token_id from the blockchain. This is useful when linking to gitcoin from outside sites such as Open Sea.

Args: token_id (int): The token_id field in the database (from blockchain) network (str): The ethereum network address (str): Contract address for this token (from blockchain)

Returns: obj or None: Return Django object if found, else None.