Skip to content

Instantly share code, notes, and snippets.

@dicarlo2
Created September 6, 2018 17:19
Show Gist options
  • Save dicarlo2/0b3940568a304da40d60972f3d134df2 to your computer and use it in GitHub Desktop.
Save dicarlo2/0b3940568a304da40d60972f3d134df2 to your computer and use it in GitHub Desktop.
private readonly foo = ArrayStorage.for<[Address, Address]>();
private readonly foo2 = SetStorage.for<[Address, Address]>();
private readonly balances = MapStorage.for<Address, Fixed<8>>();
private readonly approvedTransfers = MapStorage.for<[Address, Address], Fixed<8>>();
private mutableRemaining: Fixed<8> = 10_000_000_000_00000000;
private mutableSupply: Fixed<8> = 0;
public constructor(
public readonly owner: Address = Deploy.senderAddress,
public readonly startTimeSeconds: Integer = Blockchain.currentBlockTime + 60 * 60,
public readonly icoDurationSeconds: Integer = 86400,
) {
super();
if (!Address.isCaller(owner)) {
throw new Error('Sender was not the owner.');
}
}
@constant
public get totalSupply(): Fixed<8> {
return this.mutableSupply;
}
@constant
public balanceOf(address: Address): Fixed<8> {
const setStorageAtAddress = this.foo2.at(address);
const x: Address = Address.from();
// tslint:disable-next-line
for (const sendAddressInPair of this.foo2.at(address)) {
}
this.foo2.delete([address, x])
const balance = this.balances.get(address);
return balance === undefined ? 0 : balance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment