Merge pull request #3299 from nspcc-dev/autogeneration-linter

smartcontract: fix generation of nns wrapper for follow Go naming
This commit is contained in:
Anna Shaleva 2024-01-26 12:50:35 +03:00 committed by GitHub
commit 36b89215ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 17 deletions

View file

@ -174,8 +174,8 @@ func Sum(first int, second int) int {
return neogointernal.CallWithToken(Hash, "sum", int(contract.All), first, second).(int)
}
// Sum_3 invokes ` + "`sum`" + ` method of contract.
func Sum_3(first int, second int, third int) int {
// Sum2 invokes ` + "`sum`" + ` method of contract.
func Sum2(first int, second int, third int) int {
return neogointernal.CallWithToken(Hash, "sum", int(contract.All), first, second, third).(int)
}

View file

@ -256,25 +256,25 @@ func (c *Contract) RenewUnsigned(name string) (*transaction.Transaction, error)
return c.actor.MakeUnsignedCall(c.hash, "renew", nil, name)
}
// Renew_2 creates a transaction invoking `renew` method of the contract.
// Renew2 creates a transaction invoking `renew` method of the contract.
// This transaction is signed and immediately sent to the network.
// The values returned are its hash, ValidUntilBlock value and error if any.
func (c *Contract) Renew_2(name string, years *big.Int) (util.Uint256, uint32, error) {
func (c *Contract) Renew2(name string, years *big.Int) (util.Uint256, uint32, error) {
return c.actor.SendCall(c.hash, "renew", name, years)
}
// Renew_2Transaction creates a transaction invoking `renew` method of the contract.
// Renew2Transaction creates a transaction invoking `renew` method of the contract.
// This transaction is signed, but not sent to the network, instead it's
// returned to the caller.
func (c *Contract) Renew_2Transaction(name string, years *big.Int) (*transaction.Transaction, error) {
func (c *Contract) Renew2Transaction(name string, years *big.Int) (*transaction.Transaction, error) {
return c.actor.MakeCall(c.hash, "renew", name, years)
}
// Renew_2Unsigned creates a transaction invoking `renew` method of the contract.
// Renew2Unsigned creates a transaction invoking `renew` method of the contract.
// This transaction is not signed, it's simply returned to the caller.
// Any fields of it that do not affect fees can be changed (ValidUntilBlock,
// Nonce), fee values (NetworkFee, SystemFee) can be increased as well.
func (c *Contract) Renew_2Unsigned(name string, years *big.Int) (*transaction.Transaction, error) {
func (c *Contract) Renew2Unsigned(name string, years *big.Int) (*transaction.Transaction, error) {
return c.actor.MakeUnsignedCall(c.hash, "renew", nil, name, years)
}

View file

@ -234,16 +234,11 @@ func TemplateFromManifest(cfg Config, scTypeConverter func(string, smartcontract
// Consider `perform(a)` and `perform(a, b)` methods.
// First, try to export the second method with `Perform2` name.
// If `perform2` is already in the manifest, use `perform_2` with as many underscores
// as needed to eliminate name conflicts. It will produce long names in certain circumstances,
// but if the manifest contains lots of similar names with trailing underscores, delicate naming
// was probably not the goal.
// If `perform2` is already in the manifest, use `perform3` with uprising suffix as many times
// as needed to eliminate name conflicts. If `perform3` is already in the manifest, use `perform4` etc.
name := m.Name
if v, ok := seen[name]; !ok || v {
suffix := strconv.Itoa(len(m.Parameters))
for ; seen[name]; name = m.Name + suffix {
suffix = "_" + suffix
}
for suffix := 2; seen[name]; suffix++ {
name = m.Name + strconv.Itoa(suffix)
}
seen[name] = true