diff options
Diffstat (limited to 'data/basics/userBalance.go')
-rw-r--r-- | data/basics/userBalance.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/data/basics/userBalance.go b/data/basics/userBalance.go index d80aef813..4a5253e42 100644 --- a/data/basics/userBalance.go +++ b/data/basics/userBalance.go @@ -17,6 +17,7 @@ package basics import ( + "encoding/binary" "fmt" "reflect" @@ -42,7 +43,7 @@ const ( // MaxEncodedAccountDataSize is a rough estimate for the worst-case scenario we're going to have of the account data and address serialized. // this number is verified by the TestEncodedAccountDataSize function. - MaxEncodedAccountDataSize = 750000 + MaxEncodedAccountDataSize = 850000 // encodedMaxAssetsPerAccount is the decoder limit of number of assets stored per account. // it's being verified by the unit test TestEncodedAccountAllocationBounds to align @@ -379,6 +380,18 @@ type AssetParams struct { Clawback Address `codec:"c"` } +// ToBeHashed implements crypto.Hashable +func (app AppIndex) ToBeHashed() (protocol.HashID, []byte) { + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, uint64(app)) + return protocol.AppIndex, buf +} + +// Address yields the "app address" of the app +func (app AppIndex) Address() Address { + return Address(crypto.HashObj(app)) +} + // MakeAccountData returns a UserToken func MakeAccountData(status Status, algos MicroAlgos) AccountData { return AccountData{Status: status, MicroAlgos: algos} |