Msg/UpdateCurator

The curator of a basket can be updated:

  • message validations
  • when the basket exists
  • when the curator is the admin of the basket
  • the basket curator is updated

Message Validations

a valid message

Given the message

{
    "curator": "regen1ua97smk5yv26wpqmftgdg0sx0q0d38vky7998g",
    "new_curator": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw",
    "denom": "eco.uC.NCT"
}

When the message is validated

Then expect no error.

an error is returned if curator and new curator are same

Given the message

{
    "curator": "regen1ua97smk5yv26wpqmftgdg0sx0q0d38vky7998g",
    "new_curator": "regen1ua97smk5yv26wpqmftgdg0sx0q0d38vky7998g"
}

When the message is validated

Then expect the error "curator and new curator cannot be the same: invalid address".

an error is returned if basket denom is empty

Given the message

{
    "curator": "regen1ua97smk5yv26wpqmftgdg0sx0q0d38vky7998g",
    "new_curator": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw"
}

When the message is validated

Then expect the error "basket denom: empty string is not allowed: parse error: invalid request".

an error is returned if basket denom is invalid

Given the message

{
    "curator": "regen1ua97smk5yv26wpqmftgdg0sx0q0d38vky7998g",
    "new_curator": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw",
    "denom":"basket1+"
}

When the message is validated

Then expect the error "basket denom: expected format eco.[exponent-prefix][credit-type-abbrev].[name]: parse error: invalid request".

The basket must exist

Background

Given a basket with properties and curator alice

{
  "name":"basket1",
  "basket_denom":"eco.uC.NCT",
  "credit_type_abbrev": "C"
}

the basket exists

When alice attempts to update basket curator with denom "eco.uC.NCT"

Then expect no error.

the basket does not exist

When alice attempts to update basket curator with denom "eco.uC.rNCT"

Then expect the error "basket with denom eco.uC.rNCT: not found".

The curator must be the curator of the basket

Background

Given a basket with properties and curator alice

{
  "name":"basket1",
  "basket_denom":"eco.uC.NCT",
  "credit_type_abbrev": "C"
}

the curator is the curator of the basket

When alice attempts to update basket curator with denom "eco.uC.NCT"

Then expect no error.

the curator is not the curator of the basket

When bob attempts to update basket curator with denom "eco.uC.NCT"

Then expect error contains "unauthorized".

The basket curator is updated

Background

Given a basket with properties and curator alice

{
  "name":"basket1",
  "basket_denom":"eco.uC.NCT",
  "credit_type_abbrev": "C"
}

the basket curator is updated

When alice attempts to update basket curator with denom "eco.uC.NCT" and new curator bob

Then expect basket with denom "eco.uC.NCT" and curator bob.

Event is emitted

Background

Given a basket with properties and curator alice

{
  "name":"basket1",
  "basket_denom":"eco.uC.NCT",
  "credit_type_abbrev": "C"
}

the basket curator is updated

When alice attempts to update basket curator with denom "eco.uC.NCT"

Then expect basket with denom "eco.uC.NCT" and curator bob

And expect event with properties

{
  "denom": "eco.uC.NCT"
}