Skip to content

The dual behaviour of an 'Address' #11

Closed

Description

@yurigabrich
  1. May an address be differently invoked depending on the function used? In other words, sometimes the variable is passed as a byte[] (hexstring), and sometimes as string(Base58).
    Does it hurt usability?

  2. How can I use the CheckWitness and evaluate if the address is a member at the same time?

if ( (((string)args[1])[0] != 'A') || (((string)args[1]).Length == 0) )
throw new InvalidOperationException("Provide a valid destiny address.");

  1. May I use the dual behaviour of an Address at the same invoke function with a conversion such as .AsByteArray()? Or an explicit conversion like the below is enough?

if ( (((string)args[1])[0] != 'A') || (((string)args[1]).Length == 0) )
throw new InvalidOperationException("Provide a valid destiny address.");
if ( GetMemb((byte[])args[1]).AsString().Length != 0 )
throw new InvalidOperationException("The address you are transaction to must be a member too.");

Activity

  1. changed the title [-]The dual behaviorr of an 'Address'[/-] [+]The dual behaviour of an 'Address'[/+] on Mar 13, 2020
  2. yurigabrich commented on Mar 13, 2020

    @yurigabrich
    OwnerAuthor
    1. Yes, the address may be passed differently by each function, however it is not good for usability, nor to code readability.
    2. No need to use CheckWitness, just check if the address has a register in the smart contract environment. Only byte[] is needed for that.
    3. No, one format limits the operation of the other. On the present case, the purpose of the ifclause is duplicated. The latter condition is enough to evaluate if an address is a valid option or not.
  3. Repository owner locked as resolved and limited conversation to collaborators on Mar 13, 2020
  4. self-assigned this
    on Apr 7, 2020
  5. added this to the Towards v1.0 milestone on Apr 7, 2020
  6. linked a pull request that will close this issueDapp csh #3on Apr 7, 2020
  7. linked a pull request that will close this issueMTEsm v1.0 #17on Jun 15, 2020
  8. removed a link to a pull requestMTEsm v1.0 #17on Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions