Roles

Crear un nuevo rol - Transacciona

Modificadores: onlyOwner whenNotPaused

addRole
function addRole(uint _id, string memory _name, uint _percent) public onlyOwner whenNotPaused{....}

Parámetros:

uint

_id

Identificador único del rol

string

_name

Nombre del rol

uint

_percent

Porcentaje asignado a ese rol

Response: Evento

emit RoleAdded( _id, _name, _percent);

Ejemplo de llamada: [_id, _name, percent] = [156, Facilitador, 10]

Errores

  • A role with this ID already exists - El id indicando ya se encuentra registrado en la blockchain.

Eliminar un rol - Transacciona

Modificadores: onlyOwner whenNotPaused

deleteRole
function deleteRole(uint _id) public onlyOwner whenNotPaused {....}

Parámetros:

uint

_id

Identificador único del rol

Response: Evento

emit RoleRemoved(_id, name, role[index].percent);

Errores

  • No roles available - No se han encontrado roles almacenados

  • Role not found - No se encontró ningún rol con el id indicando

Ver todos los roles - No Transacciona

Modificadores: onlyOwner whenNotPaused

getRoles
function getRoles() public whenNotPaused onlyOwner view returns(Role[] memory) {....}

Parámetros: Sin parámetros de entrada

Response: Array

Errores

  • No roles available - No se encontró ningún rol almacenado.

Ver rol por Id - No Transacciona

Modificadores: onlyOwner whenNotPaused

getRoleById
function getRoleById(uint _id) public whenNotPaused onlyOwner view returns (uint id, string memory name, uint percent) {
```....}

Parámetros:

uint

_id

Identificador único del rol

Response:

uint

_id

Identificador único del rol

string

_name

Nombre del rol

uint

_percent

Porcentaje asignado a ese rol

Errores

Role not found - No se encontró ningún rol con el id indicando

Ver roles por porcentaje - No Transacciona

Modificadores: onlyOwner whenNotPaused

getRolesByPercent
```remix-solidity
function getRolesByPercent(uint _percent) public whenNotPaused onlyOwner view returns (Role[] memory) {....}

Parámetros:

uint

_percent

porcentaje

Respuesta: Array

Errores

  • No roles available - No se encontró ningún rol con el porcentaje indicado.

Última actualización