Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ These instructions are for the development and use of the SingularityNET SDK for

### Usage

To call a service on a SingularityNET platform, the user must be able to deposit funds (AGIX tokens) to the
To call a service on a SingularityNET platform, the user must be able to deposit funds (FET tokens) to the
[Multi-Party Escrow](https://dev.singularitynet.io/docs/products/DecentralizedAIPlatform/CoreConcepts/SmartContracts/mpe) Smart Contract.
To deposit these tokens or do any other transaction on the Ethereum blockchain.

Expand Down Expand Up @@ -196,7 +196,7 @@ managed by the SDK. But anyway you can use them if you want.

#### Open channel with the specified amount of funds and expiration

`open_channel()`[[1]](#1-this-method-uses-a-call-to-a-paid-smart-contract-function) opens a payment channel with the specified amount of AGIX tokens in cogs and expiration time.
`open_channel()`[[1]](#1-this-method-uses-a-call-to-a-paid-smart-contract-function) opens a payment channel with the specified amount of FET tokens in cogs and expiration time.
Expiration is payment channel's TTL in blocks. When opening a channel, funds are taken from MPE. So they must be
pre-deposited on it. For this, you can use the `deposit_to_escrow_account()`[[1]](#1-this-method-uses-a-call-to-a-paid-smart-contract-function)
method.
Expand All @@ -207,7 +207,7 @@ service_client.open_channel(amount=123456, expiration=33333)
```

You can also use the `deposit_and_open_channel()`[[1]](#1-this-method-uses-a-call-to-a-paid-smart-contract-function)
method instead. It does the same as the previous one, but first deposits the specified amount of AGIX tokens in cogs
method instead. It does the same as the previous one, but first deposits the specified amount of FET tokens in cogs
into an MPE.

```python
Expand Down Expand Up @@ -264,7 +264,7 @@ This model is especially useful for batch inference or rapid sequential calls wi
### Train call

Some of the training methods, namely `upload_and_validate` and `train_model`, are paid as well as the regular service call.
Accordingly, you need to pay some AGIX to take advantage of the training. For this, as for a regular service call,
Accordingly, you need to pay some FET to take advantage of the training. For this, as for a regular service call,
you need a payment channel with the required amount of funds on it and expiration (in Python SDK, the selection,
opening or adding funds to the channel is done automatically).

Expand Down Expand Up @@ -445,7 +445,7 @@ For more detailed description please refer to Developer Portal guides:

#### Prerequisites

* [Python 3.10](https://www.python.org/downloads/release/python-31012/)
* [Python 3.10+](https://www.python.org/downloads/release/python-31012/)

---

Expand All @@ -469,3 +469,4 @@ $ pip install -e .

This project is licensed under the MIT License - see the
[LICENSE](https://github.com/singnet/snet-sdk-python/blob/master/LICENSE) file for details.

10 changes: 5 additions & 5 deletions docs/main/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ from `SnetSDK`.
- `mpe_contract` (MPEContract): An instance of the `MPEContract` class for interacting with
the MultiPartyEscrow contract.
- `token_contract` (Contract): An instance of the `Contract` class from the `web3` library for interacting
with the SingularityNET AGIX Token contract.
with the SingularityNET FET Token contract.
- `private_key` (str): The private key associated with the account.
- `signer_private_key` (str): The private key used for signing transactions.
- `address` (str): The Ethereum address associated with the account.
Expand Down Expand Up @@ -176,23 +176,23 @@ Retrieves the escrow balance for the current account.

#### `deposit_to_escrow_account`

Deposit the specified amount of AGIX tokens in cogs into the MPE account.
Deposit the specified amount of FET tokens in cogs into the MPE account.

###### args:

- `amount_in_cogs` (int): The amount of AGIX tokens in cogs to deposit.
- `amount_in_cogs` (int): The amount of FET tokens in cogs to deposit.

###### returns:

- The transaction receipt of the transaction. (TxReceipt)

#### `approve_transfer`

Approves a transfer of a specified amount of AGIX tokens in cogs to the MPE contract.
Approves a transfer of a specified amount of FET tokens in cogs to the MPE contract.

###### args:

- `amount_in_cogs` (int): The amount of AGIX tokens in cogs to approve for transfer.
- `amount_in_cogs` (int): The amount of FET tokens in cogs to approve for transfer.

###### returns:

Expand Down
8 changes: 4 additions & 4 deletions docs/main/service_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ is the client for the payment channel state service.

#### `open_channel`

Opens a payment channel with the specified amount of AGIX tokens in cogs and expiration time.
Opens a payment channel with the specified amount of FET tokens in cogs and expiration time.

###### args:

- `amount` (int): The amount of AGIX tokens in cogs to deposit into the channel.
- `amount` (int): The amount of FET tokens in cogs to deposit into the channel.
- `expiration` (int): The expiration time of the payment channel in blocks.

###### returns:
Expand All @@ -245,11 +245,11 @@ Opens a payment channel with the specified amount of AGIX tokens in cogs and exp
#### `deposit_and_open_channel`

Deposits the specified amount of tokens into the MPE smart contract and opens a payment channel
with its amount of AGIX tokens in cogs and expiration time.
with its amount of FET tokens in cogs and expiration time.

###### args:

- `amount` (int): The amount of AGIX tokens in cogs to deposit into the channel.
- `amount` (int): The amount of FET tokens in cogs to deposit into the channel.
- `expiration` (int): The expiration time of the payment channel in blocks.

###### returns:
Expand Down
12 changes: 6 additions & 6 deletions docs/mpe/mpe_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ Returns the balance of the given address in the MPE contract in cogs.

#### `deposit`

Deposit the specified amount of AGIX tokens in cogs into the MultiPartyEscrow contract.
Deposit the specified amount of FET tokens in cogs into the MultiPartyEscrow contract.

###### args:

- `account` (Account): The account instance used to send the transaction.
- `amount_in_cogs` (int): The amount of AGIX tokens in cogs to deposit.
- `amount_in_cogs` (int): The amount of FET tokens in cogs to deposit.


###### returns:
Expand All @@ -76,14 +76,14 @@ Deposit the specified amount of AGIX tokens in cogs into the MultiPartyEscrow co

#### `open_channel`

Opens a payment channel with the specified amount of AGIX tokens in cogs (taken from MPE) and expiration time.
Opens a payment channel with the specified amount of FET tokens in cogs (taken from MPE) and expiration time.

###### args:

- `account` (Account): The account object used to send the transaction.
- `payment_address` (str): The address of the payment recipient.
- `group_id` (str): The ID of the payment group.
- `amount` (int): The amount of AGIX tokens in cogs to deposit into the channel.
- `amount` (int): The amount of FET tokens in cogs to deposit into the channel.
- `expiration` (int): The expiration time of the payment channel in blocks.

###### returns:
Expand All @@ -92,7 +92,7 @@ Opens a payment channel with the specified amount of AGIX tokens in cogs (taken

#### `deposit_and_open_channel`

Opens a payment channel with the specified amount of AGIX tokens in cogs (which are previously deposited on MPE)
Opens a payment channel with the specified amount of FET tokens in cogs (which are previously deposited on MPE)
and expiration time. The account must have sufficient allowance to perform the deposit, otherwise the account
first approves the transfer.

Expand All @@ -101,7 +101,7 @@ first approves the transfer.
- `account` (Account): The account object used to send the transaction.
- `payment_address` (str): The address of the payment recipient.
- `group_id` (str): The ID of the payment group.
- `amount` (int): The amount of AGIX tokens in cogs first for deposit on MPE, then for deposit on the channel.
- `amount` (int): The amount of FET tokens in cogs first for deposit on MPE, then for deposit on the channel.
- `expiration` (int): The expiration time of the payment channel in blocks.

###### returns:
Expand Down
8 changes: 4 additions & 4 deletions docs/mpe/payment_channel_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ pass it to PaymentChannel instances.

#### `open_channel`

Opens a payment channel with the specified amount of AGIX tokens in cogs (taken from MPE) and expiration time.
Opens a payment channel with the specified amount of FET tokens in cogs (taken from MPE) and expiration time.
And then returns it.

###### args:

- `account` (Account): The account object used to send the transaction.
- `amount` (int): The amount of AGIX tokens in cogs to deposit into the channel.
- `amount` (int): The amount of FET tokens in cogs to deposit into the channel.
- `expiration` (int): The expiration time of the payment channel in blocks.
- `payment_address` (str): The address of the payment recipient.
- `group_id` (str): The ID of the payment group.
Expand All @@ -133,13 +133,13 @@ pass it to PaymentChannel instances.

#### `deposit_and_open_channel`

Opens a payment channel with the specified amount of AGIX tokens in cogs (which are previously deposited on MPE)
Opens a payment channel with the specified amount of FET tokens in cogs (which are previously deposited on MPE)
and expiration time. And then returns it.

###### args:

- `account` (Account): The account object used to send the transaction.
- `amount` (int): The amount of AGIX tokens in cogs to deposit into the channel.
- `amount` (int): The amount of FET tokens in cogs to deposit into the channel.
- `expiration` (int): The expiration time of the payment channel in blocks.
- `payment_address` (str): The address of the payment recipient.
- `group_id` (str): The ID of the payment group.
Expand Down
22 changes: 11 additions & 11 deletions examples/console_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,21 @@ def print_service_info():
def balance():
"""
The function, which is called when the user enters the command 'balance' in the main menu.
Prints the balances of AGIX and MPE. It gets the balances using 'balance_of' and 'escrow_balance'.
Prints the balances of FET and MPE. It gets the balances using 'balance_of' and 'escrow_balance'.
"""
account_balance = snet_sdk.account.token_contract.functions.balanceOf(snet_sdk.account.address).call()
escrow_balance = snet_sdk.account.escrow_balance()

print(f"AGIX balance: {account_balance}")
print(f"FET balance: {account_balance}")
print(f"MPE balance: {escrow_balance}")


def deposit():
"""
The function, which is called when the user enters the command 'deposit' in the main menu.
Deposits the user-specified amount of AGIX tokens in cogs into MPE contract using 'deposit_to_escrow_account'.
Deposits the user-specified amount of FET tokens in cogs into MPE contract using 'deposit_to_escrow_account'.
"""
amount = int(input("Enter amount of AGIX tokens in cogs to deposit into an MPE account: "))
amount = int(input("Enter amount of FET tokens in cogs to deposit into an MPE account: "))
snet_sdk.account.deposit_to_escrow_account(amount)


Expand Down Expand Up @@ -209,8 +209,8 @@ def open_channel():
"""
The function, which is called when the user enters the command 'open' in the channel menu.
Opens a new channel for the active service. Checks the balance of the MPE contract and asks the user
if they want to deposit AGIX tokens into it if there isn't enough funds. Opens the channel using 'open_channel'
or 'deposit_and_open_channel' with the user-specified amount of AGIX tokens in cogs and expiration time.
if they want to deposit FET tokens into it if there isn't enough funds. Opens the channel using 'open_channel'
or 'deposit_and_open_channel' with the user-specified amount of FET tokens in cogs and expiration time.
"""
global active_service
global channels
Expand All @@ -224,13 +224,13 @@ def open_channel():
if not is_continue:
return None

amount = int(input("Enter amount of AGIX tokens in cogs to put into the channel: ").strip())
amount = int(input("Enter amount of FET tokens in cogs to put into the channel: ").strip())

balance = snet_sdk.account.escrow_balance()
is_deposit = False
if balance < amount:
print(f"Insufficient balance!\n\tCurrent MPE balance: {balance}\n\tAmount to put: {amount}")
is_deposit = input("Would you like to deposit needed amount of AGIX tokens in advance? (y/n): ").strip() == 'y'
is_deposit = input("Would you like to deposit needed amount of FET tokens in advance? (y/n): ").strip() == 'y'
if not is_deposit:
print("Channel is not opened!")
return None
Expand Down Expand Up @@ -265,13 +265,13 @@ def add_funds():
"""
The function, which is called when the user enters the command 'add-funds' in the channel menu.
Adds funds to the channel. Finds the channel by its id specified by the user and adds the user-specified amount
of AGIX tokens in cogs to it using 'add_funds'.
of FET tokens in cogs to it using 'add_funds'.
"""
channel_id = int(input("Enter channel id: ").strip())
exists = False
for channel in channels:
if channel[0].channel_id == channel_id:
amount = int(input("Enter amount of AGIX tokens in cogs to add to the channel: ").strip())
amount = int(input("Enter amount of FET tokens in cogs to add to the channel: ").strip())
channel[0].add_funds(amount)
exists = True
if not exists:
Expand Down Expand Up @@ -322,7 +322,7 @@ def extend_expiration():
"organizations": (list_organizations, "print a list of organization ids from Registry"),
"services": (list_services_for_org, "print a list of service ids for an organization from Registry"),
"balance": (balance, "print the account balance and the escrow balance"),
"deposit": (deposit, "deposit AGIX tokens into MPE"),
"deposit": (deposit, "deposit FET tokens into MPE"),
"block": (block_number, "print the current block number"),
"service": (lambda: None, "go to the services menu"),
"channel": (lambda: None, "go to the channels menu"),
Expand Down
14 changes: 7 additions & 7 deletions examples/examples_docs/console_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Available commands:
organizations - print a list of organization ids from Registry
services - print a list of service ids for an organization from Registry
balance - print the account balance and the escrow balance
deposit - deposit AGIX tokens into MPE
deposit - deposit FET tokens into MPE
block - print the current block number
service - go to the services menu
channel - go to the channels menu
Expand All @@ -42,7 +42,7 @@ Available commands:
organizations - print a list of organization ids from Registry
services - print a list of service ids for an organization from Registry
balance - print the account balance and the escrow balance
deposit - deposit AGIX tokens into MPE
deposit - deposit FET tokens into MPE
block - print the current block number
service - go to the services menu
channel - go to the channels menu
Expand Down Expand Up @@ -112,7 +112,7 @@ commands = {
"organizations": (list_organizations, "print a list of organization ids from Registry"),
"services": (list_services_for_org, "print a list of service ids for an organization from Registry"),
"balance": (balance, "print the account balance and the escrow balance"),
"deposit": (deposit, "deposit AGIX tokens into MPE"),
"deposit": (deposit, "deposit FET tokens into MPE"),
"block": (block_number, "print the current block number"),
"service": (lambda: None, "go to the services menu"),
"channel": (lambda: None, "go to the channels menu"),
Expand Down Expand Up @@ -338,8 +338,8 @@ Continue? (y/n): """).strip() == 'y'

The function, which is called when the user enters the command 'open' in the channel menu.
Opens a new channel for the active service. Checks the balance of the MPE contract and asks the user
if they want to deposit AGIX tokens into it if there isn't enough funds. Opens the channel using 'open_channel'
or 'deposit_and_open_channel' with the user-specified amount of AGIX tokens in cogs and expiration time.
if they want to deposit FET tokens into it if there isn't enough funds. Opens the channel using 'open_channel'
or 'deposit_and_open_channel' with the user-specified amount of FET tokens in cogs and expiration time.

```python
def open_channel():
Expand All @@ -355,13 +355,13 @@ def open_channel():
if not is_continue:
return None

amount = int(input("Enter amount of AGIX tokens in cogs to put into the channel: ").strip())
amount = int(input("Enter amount of FET tokens in cogs to put into the channel: ").strip())

balance = snet_sdk.account.escrow_balance()
is_deposit = False
if balance < amount:
print(f"Insufficient balance!\n\tCurrent MPE balance: {balance}\n\tAmount to put: {amount}")
is_deposit = input("Would you like to deposit needed amount of AGIX tokens in advance? (y/n): ").strip() == 'y'
is_deposit = input("Would you like to deposit needed amount of FET tokens in advance? (y/n): ").strip() == 'y'
if not is_deposit:
print("Channel is not opened!")
return None
Expand Down
2 changes: 1 addition & 1 deletion snet/sdk/storage_provider/service_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Possible pricing models:
1. Fixed price
price_model - "fixed_price"
price_in_cogs - unique fixed price in cogs for all method (1 AGIX = 10^8 cogs)
price_in_cogs - unique fixed price in cogs for all method (1 FET = 10^18 cogs)
(other pricing models can be easily supported)
groups [] - group is the number of endpoints which shares same payment channel;
grouping strategy is defined by service provider;
Expand Down
Loading