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
|
CirculationKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account structure stores metadata of each NeoFS balance account.
|
// Account structure stores metadata of each FrostFS balance account.
|
||||||
Account struct {
|
Account struct {
|
||||||
// Active balance
|
// Active balance
|
||||||
Balance int
|
Balance int
|
||||||
|
@ -35,7 +35,7 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
symbol = "NEOFS"
|
symbol = "FROSTFS"
|
||||||
decimals = 12
|
decimals = 12
|
||||||
circulation = "MainnetGAS"
|
circulation = "MainnetGAS"
|
||||||
|
|
||||||
|
@ -101,32 +101,32 @@ func Update(script []byte, manifest []byte, data interface{}) {
|
||||||
runtime.Log("balance contract updated")
|
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 {
|
func Symbol() string {
|
||||||
return token.Symbol
|
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.
|
// balances.
|
||||||
func Decimals() int {
|
func Decimals() int {
|
||||||
return token.Decimals
|
return token.Decimals
|
||||||
}
|
}
|
||||||
|
|
||||||
// TotalSupply is a NEP-17 standard method that returns total amount of main
|
// 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 {
|
func TotalSupply() int {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
return token.getSupply(ctx)
|
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.
|
// account.
|
||||||
func BalanceOf(account interop.Hash160) int {
|
func BalanceOf(account interop.Hash160) int {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
return token.balanceOf(ctx, account)
|
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.
|
// account to another. It can be invoked only by the account owner.
|
||||||
//
|
//
|
||||||
// It produces Transfer and TransferX notifications. TransferX notification
|
// 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)
|
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.
|
// another. It can be invoked by the account owner or by Alphabet nodes.
|
||||||
//
|
//
|
||||||
// It produces Transfer and TransferX notifications.
|
// 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.
|
// It produces Lock, Transfer and TransferX notifications.
|
||||||
//
|
//
|
||||||
// Lock method is invoked by Alphabet nodes of the Inner Ring when they process
|
// 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.
|
// 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) {
|
func Lock(txDetails []byte, from, to interop.Hash160, amount, until int) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
@ -300,9 +300,9 @@ func NewEpoch(epochNum int) {
|
||||||
// It produces Mint, Transfer and TransferX notifications.
|
// It produces Mint, Transfer and TransferX notifications.
|
||||||
//
|
//
|
||||||
// Mint method is invoked by Alphabet nodes of the Inner Ring when they process
|
// 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.
|
// 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) {
|
func Mint(to interop.Hash160, amount int, txDetails []byte) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool)
|
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.
|
// It produces Burn, Transfer and TransferX notifications.
|
||||||
//
|
//
|
||||||
// Burn method is invoked by Alphabet nodes of the Inner Ring when they process
|
// 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.
|
// transferred to the user in the mainchain, therefore the lock account should be destroyed.
|
||||||
// Before that, Alphabet nodes should synchronize precision of mainchain GAS
|
// Before that, Alphabet nodes should synchronize precision of mainchain GAS
|
||||||
// contract and Balance contract. Burn decreases total supply of NEP-17
|
// 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) {
|
func Burn(from interop.Hash160, amount int, txDetails []byte) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool)
|
notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: "NeoFS Balance"
|
name: "FrostFS Balance"
|
||||||
supportedstandards: ["NEP-17"]
|
supportedstandards: ["NEP-17"]
|
||||||
safemethods: ["balanceOf", "decimals", "symbol", "totalSupply", "version"]
|
safemethods: ["balanceOf", "decimals", "symbol", "totalSupply", "version"]
|
||||||
permissions:
|
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
|
contract, so it can be tracked and controlled by N3 compatible network
|
||||||
monitors and wallet software.
|
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
|
small payment transactions in the mainchain. To process small transfers, balance
|
||||||
contract has higher (12) decimal precision than native GAS contract.
|
contract has higher (12) decimal precision than native GAS contract.
|
||||||
|
|
||||||
NeoFS balances are synchronized with mainchain operations. Deposit produces
|
FrostFS balances are synchronized with mainchain operations. Deposit produces
|
||||||
minting of NEOFS tokens in Balance contract. Withdraw locks some NEOFS tokens
|
minting of FROSTFS tokens in Balance contract. Withdraw locks some FROSTFS tokens
|
||||||
in a special lock account. When NeoFS contract transfers GAS assets back to the
|
in a special lock account. When FrostFS contract transfers GAS assets back to the
|
||||||
user, the lock account is destroyed with burn operation.
|
user, the lock account is destroyed with burn operation.
|
||||||
|
|
||||||
# Contract notifications
|
# 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
|
Lock notification. This notification is produced when a lock account is
|
||||||
created. It contains information about the mainchain transaction that has produced
|
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
|
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:
|
Lock:
|
||||||
- name: txID
|
- name: txID
|
||||||
|
@ -67,7 +67,7 @@ replenished from deposit in the mainchain.
|
||||||
type: Integer
|
type: Integer
|
||||||
|
|
||||||
Burn notification. This notification is produced after user balance is reduced
|
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:
|
Burn:
|
||||||
- name: from
|
- name: from
|
||||||
|
|
Loading…
Reference in a new issue