2021-07-06 15:55:04 +00:00
|
|
|
/*
|
2023-01-11 07:48:50 +00:00
|
|
|
Balance contract is a contract deployed in FrostFS sidechain.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2023-01-11 07:48:50 +00:00
|
|
|
Balance contract stores all FrostFS account balances. It is a NEP-17 compatible
|
2022-04-14 11:56:51 +00:00
|
|
|
contract, so it can be tracked and controlled by N3 compatible network
|
2021-07-06 15:55:04 +00:00
|
|
|
monitors and wallet software.
|
|
|
|
|
|
|
|
This contract is used to store all micro transactions in the sidechain, such as
|
|
|
|
data audit settlements or container fee payments. It is inefficient to make such
|
2022-04-14 11:56:51 +00:00
|
|
|
small payment transactions in the mainchain. To process small transfers, balance
|
2021-07-06 15:55:04 +00:00
|
|
|
contract has higher (12) decimal precision than native GAS contract.
|
|
|
|
|
2023-01-11 07:48:50 +00:00
|
|
|
FrostFS balances are synchronized with mainchain operations. Deposit produces
|
|
|
|
minting of FROSTFS tokens in Balance contract. Withdraw locks some FROSTFS tokens
|
|
|
|
in a special lock account. When FrostFS contract transfers GAS assets back to the
|
2022-04-14 11:56:51 +00:00
|
|
|
user, the lock account is destroyed with burn operation.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-12-12 19:59:13 +00:00
|
|
|
# Contract notifications
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-04-14 11:56:51 +00:00
|
|
|
Transfer notification. This is a NEP-17 standard notification.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-12-12 19:59:13 +00:00
|
|
|
Transfer:
|
|
|
|
- name: from
|
|
|
|
type: Hash160
|
|
|
|
- name: to
|
|
|
|
type: Hash160
|
|
|
|
- name: amount
|
|
|
|
type: Integer
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-04-14 11:56:51 +00:00
|
|
|
TransferX notification. This is an enhanced transfer notification with details.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-12-12 19:59:13 +00:00
|
|
|
TransferX:
|
|
|
|
- name: from
|
|
|
|
type: Hash160
|
|
|
|
- name: to
|
|
|
|
type: Hash160
|
|
|
|
- name: amount
|
|
|
|
type: Integer
|
|
|
|
- name: details
|
|
|
|
type: ByteArray
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-04-14 11:56:51 +00:00
|
|
|
Lock notification. This notification is produced when a lock account is
|
|
|
|
created. It contains information about the mainchain transaction that has produced
|
2023-01-11 07:48:50 +00:00
|
|
|
the asset lock, the address of the lock account and the FrostFS epoch number until which the
|
2022-04-14 11:56:51 +00:00
|
|
|
lock account is valid. Alphabet nodes of the Inner Ring catch notification and initialize
|
2023-01-11 07:48:50 +00:00
|
|
|
Cheque method invocation of FrostFS contract.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-12-12 19:59:13 +00:00
|
|
|
Lock:
|
|
|
|
- name: txID
|
|
|
|
type: ByteArray
|
|
|
|
- name: from
|
|
|
|
type: Hash160
|
|
|
|
- name: to
|
|
|
|
type: Hash160
|
|
|
|
- name: amount
|
|
|
|
type: Integer
|
|
|
|
- name: until
|
|
|
|
type: Integer
|
2021-07-06 15:55:04 +00:00
|
|
|
|
|
|
|
Mint notification. This notification is produced when user balance is
|
2022-04-14 11:56:51 +00:00
|
|
|
replenished from deposit in the mainchain.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-12-12 19:59:13 +00:00
|
|
|
Mint:
|
|
|
|
- name: to
|
|
|
|
type: Hash160
|
|
|
|
- name: amount
|
|
|
|
type: Integer
|
2021-07-06 15:55:04 +00:00
|
|
|
|
|
|
|
Burn notification. This notification is produced after user balance is reduced
|
2023-01-11 07:48:50 +00:00
|
|
|
when FrostFS contract has transferred GAS assets back to the user.
|
2021-07-06 15:55:04 +00:00
|
|
|
|
2022-12-12 19:59:13 +00:00
|
|
|
Burn:
|
|
|
|
- name: from
|
|
|
|
type: Hash160
|
|
|
|
- name: amount
|
|
|
|
type: Integer
|
2023-05-10 08:19:19 +00:00
|
|
|
|
|
|
|
# Contract storage scheme
|
|
|
|
|
2023-11-07 12:00:02 +00:00
|
|
|
| Key | Value | Description |
|
|
|
|
|-----------------------|------------|----------------------------------|
|
|
|
|
| `netmapScriptHash` | Hash160 | netmap contract hash |
|
|
|
|
| `containerScriptHash` | Hash160 | container contract hash |
|
|
|
|
| circulationKey | int | the token circulation key value |
|
2021-07-06 15:55:04 +00:00
|
|
|
*/
|
2021-07-04 11:08:37 +00:00
|
|
|
package balance
|