예제 #1
0
    def setUp(self):
        self.params = {
            "debug": True,
            "probability_func": new_probability_func(seed=None),
            "exponential_func": new_exponential_func(seed=None),
            "gamma_func": new_gamma_func(seed=None),
            "random_number_func": new_random_number_func(seed=None)
        }
        vesting_participants = [
            TokenBatch(1000, 1000, vesting_options=VestingOptions(10, 30))
            for _ in range(2)
        ]
        nonvesting_participants = [
            TokenBatch(0, 1000, vesting_options=VestingOptions(10, 30))
            for _ in range(2)
        ]
        self.network = bootstrap_network(
            vesting_participants + nonvesting_participants, 1, 3000, 4e6, 0.2,
            self.params["probability_func"], self.params["random_number_func"],
            self.params["gamma_func"], self.params["exponential_func"])
        self.commons = Commons(1000, 1000)

        self.network, _ = add_proposal(self.network, Proposal(100, 1),
                                       self.params["random_number_func"])
        self.default_state = {
            "network": self.network,
            "commons": self.commons,
            "funding_pool": 1000,
            "token_supply": 1000
        }
예제 #2
0
    def setUp(self):
        self.params = {
            "debug": False,
            "days_to_80p_of_max_voting_weight": 10,
            "probability_func": new_probability_func(seed=None),
            "exponential_func": new_exponential_func(seed=None),
            "gamma_func": new_gamma_func(seed=None),
            "random_number_func": new_random_number_func(seed=None)
        }
        self.network = bootstrap_network([
            TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2, self.params["probability_func"],
                                         self.params["random_number_func"],
                                         self.params["gamma_func"],
                                         self.params["exponential_func"])

        self.network, _ = add_proposal(self.network, Proposal(100, 1),
                                       self.params["random_number_func"])
        """
        For proper testing, we need to make sure the Proposals are CANDIDATE and
        ensure Proposal-Participant affinities are not some random value
        """
        self.network.nodes[4]["item"].status = ProposalStatus.CANDIDATE
        self.network.nodes[5]["item"].status = ProposalStatus.CANDIDATE
        support_edges = get_edges_by_type(self.network, "support")
        for u, v in support_edges:
            self.network[u][v]["support"] = self.network[u][v][
                "support"]._replace(affinity=0.9)
예제 #3
0
    def setUp(self):
        self.commons = Commons(10000, 1000)
        self.sentiment = 0.5
        self.network = bootstrap_network([
            TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2)

        self.params = {"debug": False}
예제 #4
0
    def setUp(self):
        self.network = bootstrap_network(
            [TokenBatch(1000, VestingOptions(10, 30)) for _ in range(4)], 1,
            3000, 4e6)

        self.network, _ = add_proposal(self.network, Proposal(100, 1))

        self.network.nodes[4]["item"].status = ProposalStatus.ACTIVE
        self.network.nodes[5]["item"].status = ProposalStatus.ACTIVE
예제 #5
0
    def setUp(self):
        self.network = bootstrap_network([
            TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2)

        self.network, _ = add_proposal(self.network, Proposal(100, 1))

        self.network.nodes[4]["item"].status = ProposalStatus.CANDIDATE
        self.network.nodes[5]["item"].status = ProposalStatus.CANDIDATE
        self.params = {
            "max_proposal_request": 0.2,
            "alpha_days_to_80p_of_max_voting_weight": 10
        }
    def test_bootstrap_network(self):
        """
        Tests that the network was created and that the subcomponents work too.
        """
        token_batches = [TokenBatch(1000, VestingOptions(10, 30))
                         for _ in range(4)]
        network = bootstrap_network(token_batches, 1, 3000, 4e6, 0.2)

        edges = list(network.edges(data="type"))
        _, _, edge_types = list(zip(*edges))

        self.assertEqual(edge_types.count('support'), 4)
        self.assertEqual(len(get_participants(network)), 4)
        self.assertEqual(len(get_proposals(network)), 1)
예제 #7
0
    def setUp(self):
        self.network = bootstrap_network([
            TokenBatch(1000, 1000, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2)
        self.commons = Commons(1000, 1000)

        self.network, _ = add_proposal(self.network, Proposal(100, 1))
        self.params = {"debug": True}
        self.default_state = {
            "network": self.network,
            "commons": self.commons,
            "funding_pool": 1000,
            "token_supply": 1000
        }
예제 #8
0
 def setUp(self):
     self.params = {
         "debug": True,
         "probability_func": new_probability_func(seed=None),
         "exponential_func": new_exponential_func(seed=None),
         "gamma_func": new_gamma_func(seed=None),
         "random_number_func": new_random_number_func(seed=None)
     }
     self.network = bootstrap_network([
         TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
         for _ in range(4)
     ], 1, 3000, 4e6, 0.2, self.params["probability_func"],
                                      self.params["random_number_func"],
                                      self.params["gamma_func"],
                                      self.params["exponential_func"])
예제 #9
0
    def setUp(self):
        self.network = bootstrap_network([
            TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2)

        self.network, _ = add_proposal(self.network, Proposal(100, 1))
        self.params = {"debug": False, "days_to_80p_of_max_voting_weight": 10}
        """
        For proper testing, we need to make sure the Proposals are CANDIDATE and
        ensure Proposal-Participant affinities are not some random value
        """
        self.network.nodes[4]["item"].status = ProposalStatus.CANDIDATE
        self.network.nodes[5]["item"].status = ProposalStatus.CANDIDATE
        support_edges = get_edges_by_type(self.network, "support")
        for u, v in support_edges:
            self.network[u][v]["affinity"] = 0.9
예제 #10
0
    def setUp(self):
        self.params = {
            "probability_func": new_probability_func(seed=None),
            "exponential_func": new_exponential_func(seed=None),
            "gamma_func": new_gamma_func(seed=None),
            "random_number_func": new_random_number_func(seed=None)
        }
        self.network = bootstrap_network([
            TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2, self.params["probability_func"],
                                         self.params["random_number_func"],
                                         self.params["gamma_func"],
                                         self.params["exponential_func"])

        self.network, _ = add_proposal(self.network, Proposal(100, 1),
                                       self.params["random_number_func"])

        self.network.nodes[4]["item"].status = ProposalStatus.ACTIVE
        self.network.nodes[5]["item"].status = ProposalStatus.ACTIVE
예제 #11
0
    def setUp(self):
        self.params = {
            "max_proposal_request": 0.2,
            "alpha_days_to_80p_of_max_voting_weight": 10,
            "probability_func": new_probability_func(seed=None),
            "exponential_func": new_exponential_func(seed=None),
            "gamma_func": new_gamma_func(seed=None),
            "random_number_func": new_random_number_func(seed=None)
        }
        self.commons = Commons(1000, 1000)
        self.network = bootstrap_network([
            TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
            for _ in range(4)
        ], 1, 3000, 4e6, 0.2, self.params["probability_func"],
                                         self.params["random_number_func"],
                                         self.params["gamma_func"],
                                         self.params["exponential_func"])

        self.network, _ = add_proposal(self.network, Proposal(100, 1),
                                       self.params["random_number_func"])

        self.network.nodes[4]["item"].status = ProposalStatus.CANDIDATE
        self.network.nodes[5]["item"].status = ProposalStatus.CANDIDATE
예제 #12
0
 def setUp(self):
     self.network = bootstrap_network([
         TokenBatch(1000, 0, vesting_options=VestingOptions(10, 30))
         for _ in range(4)
     ], 1, 3000, 4e6, 0.2)
     self.params = {"max_proposal_request": 0.2}
예제 #13
0
 def setUp(self):
     self.network = bootstrap_network(
         [TokenBatch(1000, VestingOptions(10, 30)) for _ in range(4)], 1,
         3000, 4e6)
예제 #14
0
 def setUp(self):
     self.commons = Commons(10000, 1000)
     self.sentiment = 0.5
     self.network = bootstrap_network(
         [TokenBatch(1000, VestingOptions(10, 30)) for _ in range(4)], 1,
         3000, 4e6)