Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
use last 20 bytes of sha3 hash for address
Browse files Browse the repository at this point in the history
  • Loading branch information
Silas Davis committed Feb 23, 2017
1 parent 4ecc033 commit a7dab6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions manager/eris-mint/evm/snative.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,12 @@ func (contract *SNativeContractDescription) Dispatch(appState AppState,
return function.F(appState, caller, remainingArgs, gas)
}

// We define the address of an SNative contact as the first 20 bytes of the sha3
// We define the address of an SNative contact as the last 20 bytes of the sha3
// hash of its name
func (contract *SNativeContractDescription) Address() abi.Address {
var address abi.Address
copy(address[:], sha3.Sha3([]byte(contract.Name))[:abi.AddressLength])
hash := sha3.Sha3([]byte(contract.Name))
copy(address[:], hash[len(hash)-abi.AddressLength:])
return address
}

Expand Down

0 comments on commit a7dab6d

Please sign in to comment.