It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
.
.
// In full disclosure, this is a simplification the actual function, i removed stuff
// that wasn't germane to the conversation around upgradable contracts
configureFromStorage() public onlySuperAdmins unlessUpgraded returns (bool) {
address ledgerAddress = Registry(registry).getStorage(ledgerName);
address storageAddress = Registry(registry).getStorage(storageName);
tokenLedger = ITokenLedger(ledgerAddress);
externalStorage = storageAddress;
return true;
}
.
.
pragma solidity ^0.4.18;
contract storable {
function getLedgerNameHash() public view returns (bytes32);
function getStorageNameHash() public view returns (bytes32);
}
pragma solidity ^0.4.18;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "./ERC20.sol";
import "./freezable.sol";
import "./CstLedger.sol";
import "./ExternalStorage.sol";
import "./Registry.sol";
import "./CstLibrary.sol";
import "./displayable.sol";
import "./upgradeable.sol";
import "./configurable.sol";
import "./storable.sol";
contract CardstackToken is ERC20,
Ownable,
freezable,
displayable,
upgradeable,
configurable,
storable {
using SafeMath for uint256;
using CstLibrary for address;
ITokenLedger public tokenLedger;
address public externalStorage;
.
.
.
function totalSupply() public view unlessFrozen unlessUpgraded returns(uint256) {
return tokenLedger.totalTokens();
}
function tokensAvailable() public view unlessFrozen unlessUpgraded returns(uint256) {
return totalSupply().sub(totalInCirculation());
}
function balanceOf(address account) public view unlessUpgraded unlessFrozen returns (uint256) {
address thisAddress = this;
if (thisAddress == account) {
return tokensAvailable();
} else {
return tokenLedger.balanceOf(account);
}
}
function transfer(address recipient, uint256 amount) public unlessFrozen unlessUpgraded returns (bool) {
require(amount > 0);
require(!frozenAccount[recipient]);
tokenLedger.transfer(msg.sender, recipient, amount);
Transfer(msg.sender, recipient, amount);
return true;
}
function mintTokens(uint256 mintedAmount) public onlySuperAdmins unlessFrozen unlessUpgraded returns (bool) {
tokenLedger.mintTokens(mintedAmount);
Mint(mintedAmount, tokenLedger.totalTokens(), circulationCap);
Transfer(address(0), this, mintedAmount);
return true;
}
function grantTokens(address recipient, uint256 amount) public onlySuperAdmins unlessFrozen unlessUpgraded returns (bool) {
require(!frozenAccount[recipient]);
tokenLedger.debitAccount(recipient, amount);
Transfer(this, recipient, amount);
return true;
}
.
.
.
}
pragma solidity ^0.4.18;
import "./administratable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
contract ITokenLedger {
function totalTokens() public view returns (uint256);
function totalInCirculation() public view returns (uint256);
function balanceOf(address account) public view returns (uint256);
function mintTokens(uint256 amount) public;
function transfer(address sender, address reciever, uint256 amount) public;
function creditAccount(address account, uint256 amount) public;
function debitAccount(address account, uint256 amount) public;
function addAdmin(address admin) public;
function removeAdmin(address admin) public;
}
contract CstLedger is ITokenLedger, administratable {
using SafeMath for uint256;
uint256 public _totalInCirculation; // warning this does not take into account unvested nor vested-unreleased tokens into consideration
uint256 public _totalTokens;
mapping (address => uint256) public _balanceOf;
uint256 public ledgerCount;
mapping (uint256 => address) public accountForIndex;
mapping (address => bool) public accounts;
function totalTokens() public view returns (uint256) {
return _totalTokens;
}
function totalInCirculation() public view returns (uint256) {
return _totalInCirculation;
}
function balanceOf(address account) public view returns (uint256) {
return _balanceOf[account];
}
function mintTokens(uint256 amount) public onlyAdmins {
_totalTokens = _totalTokens.add(amount);
}
function makeAccountIterable(address account) internal {
if (!accounts[account]) {
accountForIndex[ledgerCount] = account;
ledgerCount = ledgerCount.add(1);
accounts[account] = true;
}
}
function transfer(address sender, address recipient, uint256 amount) public onlyAdmins {
require(_balanceOf[sender] >= amount);
_balanceOf[sender] = _balanceOf[sender].sub(amount);
_balanceOf[recipient] = _balanceOf[recipient].add(amount);
makeAccountIterable(recipient);
}
function creditAccount(address account, uint256 amount) public onlyAdmins { // decrease asset/increase liability: remove tokens
require(_balanceOf[account] >= amount);
_totalInCirculation = _totalInCirculation.sub(amount);
_balanceOf[account] = _balanceOf[account].sub(amount);
}
function debitAccount(address account, uint256 amount) public onlyAdmins { // increase asset/decrease liability: add tokens
_totalInCirculation = _totalInCirculation.add(amount);
_balanceOf[account] = _balanceOf[account].add(amount);
makeAccountIterable(account);
}
}