Skip to content

Commit

Permalink
Merge pull request #285 from TeknoPT/feature-add-special-extcalls
Browse files Browse the repository at this point in the history
Added new ExtCalls for Get Nexus and Validate an Address.
  • Loading branch information
TeknoPT authored Dec 12, 2023
2 parents f4bcfee + 15b4905 commit 0f48870
Show file tree
Hide file tree
Showing 3 changed files with 366 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Phantasma.Business/src/Blockchain/VM/EVMContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ public static Address AddressConvertEthereumToPhantasma(string addressText, INex
pubKey[0] = (byte)kind;
return Address.FromBytes(pubKey);
}

public static Address AddressConvertEthereumToPhantasmaNoNexus(string addressText)
{
Throw.If(!IsValidAddress(addressText), "invalid ethereum address");
var input = addressText.Substring(2);
var decodedInput = input.Decode();

AddressKind kind = AddressKind.User;

var pubKey = new byte[Address.LengthInBytes];
ByteArrayUtils.CopyBytes(decodedInput, 0, pubKey, 1, decodedInput.Length);
pubKey[0] = (byte)kind;
return Address.FromBytes(pubKey);
}

public static string AddressConvertPhantasmaToEthereum(Address addr)
{
Expand Down
Loading

0 comments on commit 0f48870

Please sign in to comment.