-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from inflector/add-accounting
Add accounting and replace ganache-cli for testrpc
- Loading branch information
Showing
9 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# | ||
# sn_agent/accounting/__init__.py - manages AGI token payment processing, | ||
# | ||
# Copyright (c) 2017 SingularityNET | ||
# | ||
# Distributed under the MIT software license, see LICENSE file. | ||
# | ||
|
||
from abc import ABC | ||
from sn_agent.accounting.settings import AccountingSettings | ||
from sn_agent.job.job_descriptor import JobDescriptor | ||
|
||
class Accounting(ABC): | ||
def __init__(self, app): | ||
self.app = app | ||
self.settings = AccountingSettings() | ||
|
||
def job_is_contracted(self, job: JobDescriptor): | ||
if not job is None: | ||
return True | ||
else: | ||
return False | ||
|
||
def setup_accounting(app): | ||
app['accounting'] = Accounting(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# sn_agent/accounting/accounting.yml - configuration parameters for the accounting module, | ||
# | ||
# Copyright (c) 2017 SingularityNET | ||
# | ||
# Distributed under the MIT software license, see LICENSE file. | ||
# | ||
|
||
accounting: | ||
token_id: AGI | ||
|
||
# One COG is 1 / 10^8 of an AGI | ||
sub_token_id: COG | ||
sub_token_divisor: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from sn_agent import SettingsBase | ||
|
||
THIS_DIR = Path(__file__).parent | ||
|
||
|
||
class AccountingSettings(SettingsBase): | ||
def __init__(self, **custom_settings): | ||
self._ENV_PREFIX = 'SN_ACCOUNTING_' | ||
self.CONFIG_FILE = os.path.join(THIS_DIR, 'accounting.yml') | ||
super().__init__(**custom_settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ services: | |
- "8545:8545" | ||
- "8546:8546" | ||
- "30303:30303" | ||
command: testrpc | ||
command: ganache-cli |