Msg/UpdateAdmin

UpdateAdmin is successful when:

  • admin is admin account

UpdateAdmin has the following outcomes:

  • message response returned
  • Admin is updated in state
  • EventUpdateAdmin is emitted

The admin must be the admin account

Background

Given admin

{
  "address": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y="
}

admin is admin account

When msg update admin

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}

Then expect no error.

admin is not admin account

When msg update admin

{
  "admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}

Then expect the error

admin chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup: admin account chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38: unauthorized

The message response is returned

Background

Given admin

{
  "address": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y="
}

message response returned

When msg update admin

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}

Then expect response

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}

Admin is updated in state

Background

Given admin

{
  "address": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y="
}

state admin updated

When msg update admin

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}

Then expect state admin

{
  "address": "hEyiXxUCaFQmkbuhO9r+QDscjIY="
}

EventUpdateAdmin emitted

Background

Given admin

{
  "address": "BTZfSbi0JKqguZ/tIAPUIhdAa7Y="
}

event update admin emitted

When msg update admin

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}

Then expect event update

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "new_admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup"
}