forked from TrueCloudLab/frostfs-contract
[#151] container: require additional fee for nice-name
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
e1ee1c203c
commit
c957b9ca69
2 changed files with 22 additions and 3 deletions
|
@ -53,6 +53,8 @@ const (
|
|||
|
||||
// RegistrationFeeKey is a key in netmap config which contains fee for container registration.
|
||||
RegistrationFeeKey = "ContainerFee"
|
||||
// AliasFeeKey is a key in netmap config which contains fee for nice-name registration.
|
||||
AliasFeeKey = "ContainerAliasFee"
|
||||
|
||||
containerIDSize = 32 // SHA256 size
|
||||
|
||||
|
@ -180,6 +182,10 @@ func PutNamed(container []byte, signature interop.Signature,
|
|||
balanceContractAddr := storage.Get(ctx, balanceContractKey).(interop.Hash160)
|
||||
containerFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, RegistrationFeeKey).(int)
|
||||
balance := contract.Call(balanceContractAddr, "balanceOf", contract.ReadOnly, from).(int)
|
||||
if name != "" {
|
||||
aliasFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, AliasFeeKey).(int)
|
||||
containerFee += aliasFee
|
||||
}
|
||||
|
||||
if balance < containerFee*len(alphabet) {
|
||||
panic("insufficient balance to create container")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue