Beispiel #1
0
    def _specific_process_functions_specs(self, abi, functions_specs, constructor: Optional[Constructor]=None):
        new_functions_specs = deepcopy(functions_specs)
        if constructor is None or constructor.version > 0:
            new_functions_specs = eth_contracts.merge_function_titles2specs(
                eth_contracts.make_generic_function_spec(abi), new_functions_specs
            )

        return new_functions_specs
Beispiel #2
0
 def post_construct(self, fields, abi_array):
     function_titles = {
         'addQuestion': {
             'title': 'Add Question',
             'description': 'Add question',
             'inputs': [{
                 'title': 'your new question',
             }]
         },
         'readQuestion': {
             'title': 'Read question',
             'description': '',
             'inputs': [{
                 'title': 'question number',
             }]
         },
         'userVoting': {
             'title': 'Make your vote',
             'description': '',
             'inputs': [{
                 'title': 'true'
             }, {
                 'title': 'question number'
             }]
         },
         'closeVote': {
             'title': 'Close vote',
             'description': '',
             'inputs': [{
                 'title': 'question number',
             }]
         },
         'voteResult': {
             'title': 'Get vote result for closed question',
             'description': '',
             'inputs': [{
                 'title': 'question number',
             }]
         },
     }
     return {
         "result":
         "success",
         'function_specs':
         merge_function_titles2specs(make_generic_function_spec(abi_array),
                                     function_titles),
         'dashboard_functions': ['voteResult']
     }
Beispiel #3
0
 def post_construct(self, fields, abi_array):
     function_titles = {
         'voteResult': {
             'title': 'Vote result',
             'description': 'Vote of dictator'
         },
         'dictatorVoting': {
             'title': 'Vote',
             'description':
             'You are dictator make your vote (true of false)',
             'inputs': [{
                 'title': 'vote',
             }]
         }
     }
     return {
         "result":
         "success",
         'function_specs':
         merge_function_titles2specs(make_generic_function_spec(abi_array),
                                     function_titles),
         'dashboard_functions': ['voteResult']
     }
Beispiel #4
0
    def post_construct(self, fields, abi_array):

        function_titles = {
            'transferOwnership': {
                'title': 'Transfer ownership',
                'description': 'Transfers ownership of the token to another address. Ownership rights are required to perform some administrative operations.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Address which\'ll receive ownership rights.',
                }]
            },

            'createNewSubtoken': {
                'title': 'Create new subtoken',
                'description': 'Create new subtoken and send subtokens to address',
                'inputs': [
                    {'title': 'Token ID', },
                    {
                        'title': 'Address of owner',
                        'description': 'Address which receive all subtokens',
                    }, {
                        'title': 'Tokens count',
                        'description': 'Count of tokens will be created',
                    }
                ]
            },

            'totalSupply': {
                'title': 'Total supply',
                'description': 'Current total amount of the token. Specified in the smallest units of the token.',
                'inputs': [{
                    'title': 'Token ID',
                }]
            },

            'balanceOf': {
                'title': 'Get balance',
                'description': 'Gets the token balance of any address. Return value is specified in the smallest units of the token.',
                'inputs': [
                    {'title': 'Token ID',},
                    {'title': 'Address',}
                ]
            },

            'allowance': {
                'title': 'View allowance',
                'description': 'View amount of tokens which some token holder allowed to spend by another address.',
                'inputs': [
                    {'title': 'Token ID', },
                    {
                        'title': 'Address of owner',
                        'description': 'Address which allowed to spend his tokens.',
                    }, {
                        'title': 'Address of spender',
                        'description': 'Address which was allowed to spend tokens.',
                    }
                ]
            },

            'transfer': {
                'title': 'Transfer tokens',
                'description': 'Transfers some amount of your tokens to another address.',
                'inputs': [
                    {'title': 'Token ID', },
                    {
                        'title': 'To',
                        'description': 'Recipient address.',
                    }, {
                        'title': 'Amount',
                        'description': 'Amount must be specified in the smallest units of the token.',
                    }
                ]
            },

            'transferFrom': {
                'title': 'Transfer from',
                'description': 'Transfers from one account to another. Account which tokens are transferred has to approve this spending.',
                'inputs': [
                    {'title': 'Token ID', },
                    {
                        'title': 'From',
                        'description': 'Subtract tokens from this account.',
                    }, {
                        'title': 'To',
                        'description': 'Transfer tokens to this account.',
                    }, {
                        'title': 'Amount',
                        'description': 'Amount must be specified in the smallest units of the token.',
                    }
                ]
            },

            'approve': {
                'title': 'Approve spending',
                'description': 'Allow some amount of your tokens to be spent by specified address.',
                'inputs': [
                    {'title': 'Token ID', },
                    {
                        'title': 'Address',
                        'description': 'Address to allow to spend tokens.',
                    }, {
                        'title': 'Amount',
                        'description': 'Amount must be specified in the smallest units of the token.',
                    }
                ]
            },

        }

        return {
            "result": "success",
            'function_specs': merge_function_titles2specs(make_generic_function_spec(abi_array), function_titles),
            'dashboard_functions': []
        }
Beispiel #5
0
    def post_construct(self, fields, abi_array):

        function_titles = {
            'm_numOwners': {
                'title': 'Number of owners',
                'description': 'How many owners are added to the contract',
            },
            'changeRequirement': {
                'title':
                'Change quorum requirement',
                'description':
                'Change number of signatures required to perform actions on this wallet '
                '(withdraw money, change owners, etc). Quorum of wallet owners must call this function with the same parameters for this action to happen.',
                'inputs': [{
                    'title':
                    'new requirement',
                    'description':
                    'new number of signatures required to perform actions on this wallet'
                }]
            },
            'sendEther': {
                'title':
                'Send Ether',
                'description':
                'Send some amount of Ether from this wallet to specified address. Quorum of wallet owners must call this function with the same parameters for this action to happen.',
                'inputs': [{
                    'title': 'Destination address',
                }, {
                    'title':
                    'Amount in wei',
                    'description':
                    'Amount must be specified in the smallest units: wei (1 Ether is 1000000000000000000 wei).'
                }]
            },
            'm_multiOwnedRequired': {
                'title':
                'Quorum requirement',
                'description':
                'Number of signatures required to perform actions on this wallet',
            },
            'hasConfirmed': {
                'title': 'Is operation confirmed?',
                'description': 'Checks if operation confirmed by an owner.',
            },
            'revoke': {
                'title':
                'Revoke confirmation',
                'description':
                'Revoke confirmation of current owner (current account) from operation.',
            },
            'amIOwner': {
                'title':
                'Am I owner?',
                'description':
                'Checks if current account is one of the wallet owners.',
            },
            'isOwner': {
                'title': 'Check owner',
                'description':
                'Checks if specified account is one of the wallet owners.',
                'inputs': [{
                    'title': 'Address to check',
                }]
            },
            'getOwners': {
                'title': 'Owners',
                'description':
                'Returns list of all current owners of the wallet.',
            },
            'getOwner': {
                'title':
                'Get n-th owner',
                'description':
                'Returns n-th owner',
                'inputs': [{
                    'title':
                    'Owner\'s number',
                    'description':
                    'Owner\'s number, starting from zero.',
                }]
            },
            'removeOwner': {
                'title':
                'Remove owner',
                'description':
                'Removes specified owner. Quorum of wallet owners must call this function with the same parameters for this action to happen.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Address of the owner to remove.',
                }]
            },
            'addOwner': {
                'title':
                'Add owner',
                'description':
                'Adds a new owner. Quorum of wallet owners must call this function with the same parameters for this action to happen.',
                'inputs': [{
                    'title':
                    'Address',
                    'description':
                    'Address of the new (additional) owner.',
                }]
            },
            'changeOwner': {
                'title': 'Change owner',
                'description':
                'Changes address of existing owner from one to another. Quorum of wallet owners must call this function with the same parameters for this action to happen.',
                'inputs': [{
                    'title': 'Old address',
                }, {
                    'title': 'New address',
                }]
            },
        }

        return {
            "result":
            "success",
            'function_specs':
            merge_function_titles2specs(make_generic_function_spec(abi_array),
                                        function_titles),
            'dashboard_functions': ['m_numOwners', 'm_multiOwnedRequired']
        }
Beispiel #6
0
    def post_construct(self, fields, abi_array):

        if fields['participant2']['swap_type'] == self._SWAP_TYPE_ETHER:
            part2_type = 'ether'
        else:
            part2_type = 'tokens'

        function_titles = {
            'isFinished': {
                'title': 'Is finished?',
                'description': 'is swap finished',
                'sorting_order': 10
            },
            'participant1': {
                'title': 'Participant #1',
                'description': 'Address of participant #1',
                'sorting_order': 20
            },
            "participant1Token": {
                "title": "Token address of participant #1",
                "description":
                "Address of ERC20 token smart contract, which participant #1 will swap",
                'sorting_order': 30
            },
            "participant1TokensCount": {
                "title": "Tokens count of participant #1 (in token wei)",
                "description":
                "Tokens count, which participant #1 will swap for participant #2 tokens/ether (in token wei)",
                'sorting_order': 40
            },
            "participant1SentTokensCount": {
                "title": "Tokens count sent by participant #1 (in token wei)",
                "description":
                "Tokens count, which participant #1 has already sent (in token wei)",
                'sorting_order': 50
            },
            'participant2': {
                'title': 'Participant #2',
                'description': 'Address of participant #2',
                'sorting_order': 60
            },
            'swap': {
                'title':
                'Swap',
                'description':
                'Swap tokens of participant #1 to {} of participant #2'.format(
                    part2_type),
                'sorting_order':
                100
            },
            'refund': {
                'title': 'Refund',
                'description': 'Refund tokens/ether to participants',
                'sorting_order': 110
            },
        }

        if fields['participant2']['swap_type'] == self._SWAP_TYPE_ETHER:
            function_titles["participant2EtherCount"] = {
                "title": "Ether count of participant #2 (in wei)",
                "description":
                "Ether count, which participant #1 will swap for participant #2 tokens (in wei)",
                'sorting_order': 70
            }
            function_titles["participant2SentEtherCount"] = {
                "title": "Ether count sent by participant #2 (in wei)",
                "description":
                "Ether count, which participant #2 has already sent (in wei)",
                'sorting_order': 80
            }
        else:
            function_titles["participant2Token"] = {
                "title": "Token address of participant #2",
                "description":
                "Address of ERC20 token smart contract, which participant #2 will swap",
                'sorting_order': 70
            }
            function_titles["participant2TokensCount"] = {
                "title": "Tokens count of participant #2 (in token wei)",
                "description":
                "Tokens count, which participant #2 will swap for participant #1 tokens (in token wei)",
                'sorting_order': 80
            }
            function_titles["participant2SentTokensCount"] = {
                "title": "Tokens count sent by participant #2 (in token wei)",
                "description":
                "Tokens count, which participant #2 has already sent (in token wei)",
                'sorting_order': 90
            }

        return {
            "result":
            "success",
            'function_specs':
            merge_function_titles2specs(make_generic_function_spec(abi_array),
                                        function_titles),
            'dashboard_functions':
            ['isFinished', 'participant1', 'participant2']
        }
    def post_construct(self, fields, abi_array):

        function_titles = {
            'pause': {
                'title': 'Pause circulation',
                'description': 'Disable any token transfers. Callable only by token owner.',
            },

            'unpause': {
                'title': 'Enable circulation',
                'description': 'Enables token transfers in case they were paused. Callable only by token owner.',
            },

            'burn': {
                'title': 'Burn tokens',
                'description': 'Burns specified amount of tokens owned by current account.',
                'inputs': [{
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.'
                }]
            },

            'mint': {
                'title': 'Mint new tokens',
                'description': 'Creates new tokens out-of-thin-air and gives them to specified address. Callable only by token owner.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Transfer tokens to this address.',
                }, {
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.',
                }]
            },

            'finishMinting': {
                'title': 'Finish minting',
                'description': 'Disables any further token creation via minting. Callable only by token owner.',
            },

            'decreaseApproval': {
                'title': 'Decrease approval',
                'description': 'Decreases amount of your tokens which are allowed to be spent by specified address.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Address which was allowed to spend tokens.',
                }, {
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.',
                }]
            },

            'increaseApproval': {
                'title': 'Increase approval',
                'description': 'Increases amount of your tokens which are allowed to be spent by specified address.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Address which was allowed to spend tokens.',
                }, {
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.',
                }]
            },

            'allowance': {
                'title': 'View allowance',
                'description': 'View amount of tokens which some token holder allowed to spend by another address.',
                'inputs': [{
                    'title': 'Address of owner',
                    'description': 'Address which allowed to spend his tokens.',
                }, {
                    'title': 'Address of spender',
                    'description': 'Address which was allowed to spend tokens.',
                }]
            },

            'approve': {
                'title': 'Approve spending',
                'description': 'Allow some amount of your tokens to be spent by specified address.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Address to allow to spend tokens.',
                }, {
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.',
                }]
            },

            'transferFrom': {
                'title': 'Transfer from',
                'description': 'Transfers from one account to another. Account which tokens are transferred has to approve this spending.',
                'inputs': [{
                    'title': 'From',
                    'description': 'Subtract tokens from this account.',
                }, {
                    'title': 'To',
                    'description': 'Transfer tokens to this account.',
                }, {
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.',
                }]
            },

            'name': {
                'title': 'Token name',
                'description': 'Human-friendly name of the token.',
            },

            'symbol': {
                'title': 'Token ticker',
                'description': 'Abbreviated name of the token used on exchanges etc.',
            },

            'decimals': {
                'title': 'Decimal places',
                'description': 'Allowed digits in fractional part of the token. E.g. decimal places of US dollar is 2.',
            },

            'balanceOf': {
                'title': 'Get balance',
                'description': 'Gets the token balance of any address. Return value is specified in the smallest units of the token.',
                'inputs': [{
                    'title': 'Address',
                }]
            },

            'transfer': {
                'title': 'Transfer tokens',
                'description': 'Transfers some amount of your tokens to another address.',
                'inputs': [{
                    'title': 'To',
                    'description': 'Recipient address.',
                }, {
                    'title': 'Amount',
                    'description': 'Amount must be specified in the smallest units of the token.',
                }]
            },

            'totalSupply': {
                'title': 'Total supply',
                'description': 'Current total amount of the token. Specified in the smallest units of the token.',
            },

            'transferOwnership': {
                'title': 'Transfer ownership',
                'description': 'Transfers ownership of the token to another address. Ownership rights are required to perform some administrative operations.',
                'inputs': [{
                    'title': 'Address',
                    'description': 'Address which\'ll receive ownership rights.',
                }]
            },

            'mintingFinished': {
                'title': 'Minting finished',
                'description': 'If true no more tokens could be created.',
            },

            'cap': {
                'title': 'Maximum tokens',
                'description': 'Maximum number of tokens which could be created. Return value is specified in the smallest units of the token.',
            },

            'paused': {
                'title': 'Paused',
                'description': 'If true any token transfers are disabled.',
            },

            'owner': {
                'title': 'Owner',
                'description': 'Address of the token owner.',
            }
        }

        return {
            "result": "success",
            'function_specs': merge_function_titles2specs(make_generic_function_spec(abi_array), function_titles),
            'dashboard_functions': ['symbol', 'totalSupply']
        }
    def post_construct(self, fields, abi_array):

        function_titles = {
            'ballotName': {
                'title': 'Ballot topic',
                'description': 'Name or description of the vote'
            },

            'variants': {
                'title': 'View variant',
                'description': 'Get variant name by ID',
                'inputs': [{
                    'title': 'Variant ID',
                }]
            },

            'isVoted': {
                'title': 'Has address voted?',
                'description': 'Check if given address has voted',
                'inputs': [{
                    'title': 'Address to check',
                }]
            },

            'vote': {
                'title': 'Vote by ID',
                'description': 'Vote by variant ID',
                'inputs': [{
                    'title': 'Variant ID',
                }]
            },

            'voteByName': {
                'title': 'Vote by name',
                'description': 'Vote by variant name',
                'inputs': [{
                    'title': 'Variant name',
                }]
            },

            'getVotesCount': {
                'title': 'Get votes count',
                'description': 'Get votes count by variant ID',
                'inputs': [{
                    'title': 'Variant ID',
                }]
            },

            'getVotesCountByName': {
                'title': 'Get votes count',
                'description': 'Get votes count by variant name',
                'inputs': [{
                    'title': 'Variant name',
                }]
            },


            'getWinningVariantId': {
                'title': 'Winning variant ID',
                'description': 'ID of the variant with the most votes'
            },

            'getWinningVariantName': {
                'title': 'Winning variant name',
                'description': 'The name of the variant with the most votes'
            },

            'getWinningVariantVotesCount': {
                'title': 'Winning variant votes count',
                'description': 'Count of votes of the variant with the most votes'
            },
        }

        return {
            "result": "success",
            'function_specs': merge_function_titles2specs(make_generic_function_spec(abi_array), function_titles),
            'dashboard_functions': ['ballotName', 'getWinningVariantId', 'getWinningVariantName', 'getWinningVariantVotesCount']
        }
Beispiel #9
0
    def post_construct(self, fields, abi_array):

        function_titles = {
            'daysRemaining': {
                'title': 'Days remaining',
                'description': 'Days before end of the ICO.',
            },
            'totalTokens': {
                'title':
                'Total tokens',
                'description':
                'Current total amount of the token. Specified in the smallest units of the token.',
            },
            'funds_address': {
                'title':
                'Funds address',
                'description':
                'Address to which the ICO forwards collected Ether.',
            },
            'rate': {
                'title': 'Token rate',
                'description': 'Token per Ether rate.',
            },
            'hard_cap': {
                'title':
                'Hard cap',
                'description':
                'Maximum Ether to be accepted by the ICO. Specified in the smallest units of Ether - wei.',
            },
            'collected': {
                'title':
                'Collected wei',
                'description':
                'Currently collected amount of Ether. Specified in the smallest units of Ether - wei.',
            },
            'collectedEther': {
                'title': 'Collected Ether',
                'description': 'Currently collected amount of Ether.',
            },
            'token': {
                'title':
                'Token address',
                'description':
                'Address of the ICO token. This address should be added to the wallets to see your tokens balance and manage them.',
            },
            'date_start': {
                'title': 'Start timestamp',
                'description': 'Unix timestamp of the start of ICO',
            },
            'date_end': {
                'title': 'End timestamp',
                'description': 'Unix timestamp of the end of ICO',
            }
        }

        return {
            "result":
            "success",
            'function_specs':
            merge_function_titles2specs(make_generic_function_spec(abi_array),
                                        function_titles),
            'dashboard_functions':
            ['collectedEther', 'totalTokens', 'daysRemaining']
        }