forked from TrueCloudLab/frostfs-contract
[TrueCloudLab#3] balance: Rename neofs to frostfs
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
a21630c1d7
commit
4052e4873b
3 changed files with 22 additions and 22 deletions
|
@ -22,7 +22,7 @@ type (
|
|||
CirculationKey string
|
||||
}
|
||||
|
||||
// Account structure stores metadata of each NeoFS balance account.
|
||||
// Account structure stores metadata of each FrostFS balance account.
|
||||
Account struct {
|
||||
// Active balance
|
||||
Balance int
|
||||
|
@ -35,7 +35,7 @@ type (
|
|||
)
|
||||
|
||||
const (
|
||||
symbol = "NEOFS"
|
||||
symbol = "FROSTFS"
|
||||
decimals = 12
|
||||
circulation = "MainnetGAS"
|
||||
|
||||
|
@ -101,32 +101,32 @@ func Update(script []byte, manifest []byte, data interface{}) {
|
|||
runtime.Log("balance contract updated")
|
||||
}
|
||||
|
||||
// Symbol is a NEP-17 standard method that returns NEOFS token symbol.
|
||||
// Symbol is a NEP-17 standard method that returns FROSTFS token symbol.
|
||||
func Symbol() string {
|
||||
return token.Symbol
|
||||
}
|
||||
|
||||
// Decimals is a NEP-17 standard method that returns precision of NeoFS
|
||||
// Decimals is a NEP-17 standard method that returns precision of FrostFS
|
||||
// balances.
|
||||
func Decimals() int {
|
||||
return token.Decimals
|
||||
}
|
||||
|
||||
// TotalSupply is a NEP-17 standard method that returns total amount of main
|
||||
// chain GAS in NeoFS network.
|
||||
// chain GAS in FrostFS network.
|
||||
func TotalSupply() int {
|
||||
ctx := storage.GetReadOnlyContext()
|
||||
return token.getSupply(ctx)
|
||||
}
|
||||
|
||||
// BalanceOf is a NEP-17 standard method that returns NeoFS balance of the specified
|
||||
// BalanceOf is a NEP-17 standard method that returns FrostFS balance of the specified
|
||||
// account.
|
||||
func BalanceOf(account interop.Hash160) int {
|
||||
ctx := storage.GetReadOnlyContext()
|
||||
return token.balanceOf(ctx, account)
|
||||
}
|
||||
|
||||
// Transfer is a NEP-17 standard method that transfers NeoFS balance from one
|
||||
// Transfer is a NEP-17 standard method that transfers FrostFS balance from one
|
||||
// account to another. It can be invoked only by the account owner.
|
||||
//
|
||||
// It produces Transfer and TransferX notifications. TransferX notification
|
||||
|
@ -136,7 +136,7 @@ func Transfer(from, to interop.Hash160, amount int, data interface{}) bool {
|
|||
return token.transfer(ctx, from, to, amount, false, nil)
|
||||
}
|
||||
|
||||
// TransferX is a method for NeoFS balance to be transferred from one account to
|
||||
// TransferX is a method for FrostFS balance to be transferred from one account to
|
||||
// another. It can be invoked by the account owner or by Alphabet nodes.
|
||||
//
|
||||
// It produces Transfer and TransferX notifications.
|
||||
|
@ -197,7 +197,7 @@ func TransferX(from, to interop.Hash160, amount int, details []byte) {
|
|||
// It produces Lock, Transfer and TransferX notifications.
|
||||
//
|
||||
// Lock method is invoked by Alphabet nodes of the Inner Ring when they process
|
||||
// Withdraw notification from NeoFS contract. This should transfer assets
|
||||
// Withdraw notification from FrostFS contract. This should transfer assets
|
||||
// to a new lock account that won't be used for anything beside Unlock and Burn.
|
||||
func Lock(txDetails []byte, from, to interop.Hash160, amount, until int) {
|
||||
ctx := storage.GetContext()
|
||||
|
@ -300,9 +300,9 @@ func NewEpoch(epochNum int) {
|
|||
// It produces Mint, Transfer and TransferX notifications.
|
||||
//
|
||||
// Mint method is invoked by Alphabet nodes of the Inner Ring when they process
|
||||
// Deposit notification from NeoFS contract. Before that, Alphabet nodes should
|
||||
// Deposit notification from FrostFS contract. Before that, Alphabet nodes should
|
||||
// synchronize precision of mainchain GAS contract and Balance contract.
|
||||
// Mint increases total supply of NEP-17 compatible NeoFS token.
|
||||
// Mint increases total supply of NEP-17 compatible FrostFS token.
|
||||
func Mint(to interop.Hash160, amount int, txDetails []byte) {
|
||||
ctx := storage.GetContext()
|
||||
notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool)
|
||||
|
@ -355,11 +355,11 @@ func Mint(to interop.Hash160, amount int, txDetails []byte) {
|
|||
// It produces Burn, Transfer and TransferX notifications.
|
||||
//
|
||||
// Burn method is invoked by Alphabet nodes of the Inner Ring when they process
|
||||
// Cheque notification from NeoFS contract. It means that locked assets have been
|
||||
// Cheque notification from FrostFS contract. It means that locked assets have been
|
||||
// transferred to the user in the mainchain, therefore the lock account should be destroyed.
|
||||
// Before that, Alphabet nodes should synchronize precision of mainchain GAS
|
||||
// contract and Balance contract. Burn decreases total supply of NEP-17
|
||||
// compatible NeoFS token.
|
||||
// compatible FrostFS token.
|
||||
func Burn(from interop.Hash160, amount int, txDetails []byte) {
|
||||
ctx := storage.GetContext()
|
||||
notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name: "NeoFS Balance"
|
||||
name: "FrostFS Balance"
|
||||
supportedstandards: ["NEP-17"]
|
||||
safemethods: ["balanceOf", "decimals", "symbol", "totalSupply", "version"]
|
||||
permissions:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Balance contract is a contract deployed in NeoFS sidechain.
|
||||
Balance contract is a contract deployed in FrostFS sidechain.
|
||||
|
||||
Balance contract stores all NeoFS account balances. It is a NEP-17 compatible
|
||||
Balance contract stores all FrostFS account balances. It is a NEP-17 compatible
|
||||
contract, so it can be tracked and controlled by N3 compatible network
|
||||
monitors and wallet software.
|
||||
|
||||
|
@ -10,9 +10,9 @@ data audit settlements or container fee payments. It is inefficient to make such
|
|||
small payment transactions in the mainchain. To process small transfers, balance
|
||||
contract has higher (12) decimal precision than native GAS contract.
|
||||
|
||||
NeoFS balances are synchronized with mainchain operations. Deposit produces
|
||||
minting of NEOFS tokens in Balance contract. Withdraw locks some NEOFS tokens
|
||||
in a special lock account. When NeoFS contract transfers GAS assets back to the
|
||||
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
|
||||
user, the lock account is destroyed with burn operation.
|
||||
|
||||
# Contract notifications
|
||||
|
@ -41,9 +41,9 @@ TransferX notification. This is an enhanced transfer notification with details.
|
|||
|
||||
Lock notification. This notification is produced when a lock account is
|
||||
created. It contains information about the mainchain transaction that has produced
|
||||
the asset lock, the address of the lock account and the NeoFS epoch number until which the
|
||||
the asset lock, the address of the lock account and the FrostFS epoch number until which the
|
||||
lock account is valid. Alphabet nodes of the Inner Ring catch notification and initialize
|
||||
Cheque method invocation of NeoFS contract.
|
||||
Cheque method invocation of FrostFS contract.
|
||||
|
||||
Lock:
|
||||
- name: txID
|
||||
|
@ -67,7 +67,7 @@ replenished from deposit in the mainchain.
|
|||
type: Integer
|
||||
|
||||
Burn notification. This notification is produced after user balance is reduced
|
||||
when NeoFS contract has transferred GAS assets back to the user.
|
||||
when FrostFS contract has transferred GAS assets back to the user.
|
||||
|
||||
Burn:
|
||||
- name: from
|
||||
|
|
Loading…
Reference in a new issue