mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4399 from ethereum/contractWhitespace
Remove trailing whitespace in all contract files.
This commit is contained in:
commit
e1b695f199
@ -1,35 +1,35 @@
|
|||||||
pragma solidity ^0.4.11;
|
pragma solidity ^0.4.11;
|
||||||
|
|
||||||
contract announcementTypes {
|
contract announcementTypes {
|
||||||
|
|
||||||
enum announcementType {
|
enum announcementType {
|
||||||
/*
|
/*
|
||||||
type of announcements
|
type of announcements
|
||||||
*/
|
*/
|
||||||
newModule,
|
newModule,
|
||||||
dropModule,
|
dropModule,
|
||||||
replaceModule,
|
replaceModule,
|
||||||
replaceModuleHandler,
|
replaceModuleHandler,
|
||||||
question,
|
question,
|
||||||
transactionFeeRate,
|
transactionFeeRate,
|
||||||
transactionFeeMin,
|
transactionFeeMin,
|
||||||
transactionFeeMax,
|
transactionFeeMax,
|
||||||
transactionFeeBurn,
|
transactionFeeBurn,
|
||||||
providerPublicFunds,
|
providerPublicFunds,
|
||||||
providerPrivateFunds,
|
providerPrivateFunds,
|
||||||
providerPrivateClientLimit,
|
providerPrivateClientLimit,
|
||||||
providerPublicMinRate,
|
providerPublicMinRate,
|
||||||
providerPublicMaxRate,
|
providerPublicMaxRate,
|
||||||
providerPrivateMinRate,
|
providerPrivateMinRate,
|
||||||
providerPrivateMaxRate,
|
providerPrivateMaxRate,
|
||||||
providerGasProtect,
|
providerGasProtect,
|
||||||
providerInterestMinFunds,
|
providerInterestMinFunds,
|
||||||
providerRentRate,
|
providerRentRate,
|
||||||
schellingRoundBlockDelay,
|
schellingRoundBlockDelay,
|
||||||
schellingCheckRounds,
|
schellingCheckRounds,
|
||||||
schellingCheckAboves,
|
schellingCheckAboves,
|
||||||
schellingRate,
|
schellingRate,
|
||||||
publisherMinAnnouncementDelay,
|
publisherMinAnnouncementDelay,
|
||||||
publisherOppositeRate
|
publisherOppositeRate
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import "./premium.sol";
|
|||||||
import "./moduleHandler.sol";
|
import "./moduleHandler.sol";
|
||||||
|
|
||||||
contract ico is safeMath {
|
contract ico is safeMath {
|
||||||
|
|
||||||
struct icoLevels_s {
|
struct icoLevels_s {
|
||||||
uint256 block;
|
uint256 block;
|
||||||
uint8 rate;
|
uint8 rate;
|
||||||
@ -24,9 +24,9 @@ contract ico is safeMath {
|
|||||||
uint256 cor;
|
uint256 cor;
|
||||||
uint256 corp;
|
uint256 corp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 constant oneSegment = 40320;
|
uint256 constant oneSegment = 40320;
|
||||||
|
|
||||||
address public owner;
|
address public owner;
|
||||||
address public tokenAddr;
|
address public tokenAddr;
|
||||||
address public premiumAddr;
|
address public premiumAddr;
|
||||||
@ -53,7 +53,7 @@ contract ico is safeMath {
|
|||||||
constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public {
|
constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public {
|
||||||
/*
|
/*
|
||||||
Installation function.
|
Installation function.
|
||||||
|
|
||||||
@foundation The ETC address of the foundation
|
@foundation The ETC address of the foundation
|
||||||
@priceSet The address which will be able to make changes on the rate later on.
|
@priceSet The address which will be able to make changes on the rate later on.
|
||||||
@exchangeRate The current ETC/USD rate multiplied by 1e4. For example: 2.5 USD/ETC = 25000
|
@exchangeRate The current ETC/USD rate multiplied by 1e4. For example: 2.5 USD/ETC = 25000
|
||||||
@ -80,11 +80,11 @@ contract ico is safeMath {
|
|||||||
interestDB[genesisAddr[a]][0].amount = genesisValue[a];
|
interestDB[genesisAddr[a]][0].amount = genesisValue[a];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ICObonus() public view returns(uint256 bonus) {
|
function ICObonus() public view returns(uint256 bonus) {
|
||||||
/*
|
/*
|
||||||
Query of current bonus
|
Query of current bonus
|
||||||
|
|
||||||
@bonus Bonus %
|
@bonus Bonus %
|
||||||
*/
|
*/
|
||||||
for ( uint8 a=0 ; a<icoLevels.length ; a++ ) {
|
for ( uint8 a=0 ; a<icoLevels.length ; a++ ) {
|
||||||
@ -93,32 +93,32 @@ contract ico is safeMath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setInterestDB(address addr, uint256 balance) external returns(bool success) {
|
function setInterestDB(address addr, uint256 balance) external returns(bool success) {
|
||||||
/*
|
/*
|
||||||
Setting interest database. It can be requested by Token contract only.
|
Setting interest database. It can be requested by Token contract only.
|
||||||
A database has to be built in order that after ICO closed everybody can get their compound interest on their capital accumulated
|
A database has to be built in order that after ICO closed everybody can get their compound interest on their capital accumulated
|
||||||
|
|
||||||
@addr Sender
|
@addr Sender
|
||||||
@balance Quantity
|
@balance Quantity
|
||||||
|
|
||||||
@success Was the process successful or not
|
@success Was the process successful or not
|
||||||
*/
|
*/
|
||||||
require( msg.sender == tokenAddr );
|
require( msg.sender == tokenAddr );
|
||||||
uint256 _num = (block.number - startBlock) / interestBlockDelay;
|
uint256 _num = (block.number - startBlock) / interestBlockDelay;
|
||||||
interestDB[addr][_num].amount = balance;
|
interestDB[addr][_num].amount = balance;
|
||||||
if ( balance == 0 ) {
|
if ( balance == 0 ) {
|
||||||
interestDB[addr][_num].empty = true;
|
interestDB[addr][_num].empty = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkInterest(address addr) public view returns(uint256 amount) {
|
function checkInterest(address addr) public view returns(uint256 amount) {
|
||||||
/*
|
/*
|
||||||
Query of compound interest
|
Query of compound interest
|
||||||
|
|
||||||
@addr Address
|
@addr Address
|
||||||
|
|
||||||
@amount Amount of compound interest
|
@amount Amount of compound interest
|
||||||
*/
|
*/
|
||||||
uint256 _lastBal;
|
uint256 _lastBal;
|
||||||
@ -126,9 +126,9 @@ contract ico is safeMath {
|
|||||||
bool _empty;
|
bool _empty;
|
||||||
interest_s memory _idb;
|
interest_s memory _idb;
|
||||||
uint256 _to = (block.number - startBlock) / interestBlockDelay;
|
uint256 _to = (block.number - startBlock) / interestBlockDelay;
|
||||||
|
|
||||||
if ( _to == 0 || aborted ) { return 0; }
|
if ( _to == 0 || aborted ) { return 0; }
|
||||||
|
|
||||||
for ( uint256 r=0 ; r < _to ; r++ ) {
|
for ( uint256 r=0 ; r < _to ; r++ ) {
|
||||||
if ( r*interestBlockDelay+startBlock >= icoDelay ) { break; }
|
if ( r*interestBlockDelay+startBlock >= icoDelay ) { break; }
|
||||||
_idb = interestDB[addr][r];
|
_idb = interestDB[addr][r];
|
||||||
@ -148,11 +148,11 @@ contract ico is safeMath {
|
|||||||
amount += _tamount;
|
amount += _tamount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInterest(address beneficiary) external {
|
function getInterest(address beneficiary) external {
|
||||||
/*
|
/*
|
||||||
Request of compound interest. This is deleted from the database after the ICO closed and following the query of the compound interest.
|
Request of compound interest. This is deleted from the database after the ICO closed and following the query of the compound interest.
|
||||||
|
|
||||||
@beneficiary Beneficiary who will receive the interest
|
@beneficiary Beneficiary who will receive the interest
|
||||||
*/
|
*/
|
||||||
uint256 _lastBal;
|
uint256 _lastBal;
|
||||||
@ -163,10 +163,10 @@ contract ico is safeMath {
|
|||||||
address _addr = beneficiary;
|
address _addr = beneficiary;
|
||||||
uint256 _to = (block.number - startBlock) / interestBlockDelay;
|
uint256 _to = (block.number - startBlock) / interestBlockDelay;
|
||||||
if ( _addr == address(0x00) ) { _addr = msg.sender; }
|
if ( _addr == address(0x00) ) { _addr = msg.sender; }
|
||||||
|
|
||||||
require( block.number > icoDelay );
|
require( block.number > icoDelay );
|
||||||
require( ! aborted );
|
require( ! aborted );
|
||||||
|
|
||||||
for ( uint256 r=0 ; r < _to ; r++ ) {
|
for ( uint256 r=0 ; r < _to ; r++ ) {
|
||||||
if ( r*interestBlockDelay+startBlock >= icoDelay ) { break; }
|
if ( r*interestBlockDelay+startBlock >= icoDelay ) { break; }
|
||||||
_idb = interestDB[msg.sender][r];
|
_idb = interestDB[msg.sender][r];
|
||||||
@ -186,17 +186,17 @@ contract ico is safeMath {
|
|||||||
_amount += _tamount;
|
_amount += _tamount;
|
||||||
delete interestDB[msg.sender][r];
|
delete interestDB[msg.sender][r];
|
||||||
}
|
}
|
||||||
|
|
||||||
require( _amount > 0 );
|
require( _amount > 0 );
|
||||||
token(tokenAddr).mint(_addr, _amount);
|
token(tokenAddr).mint(_addr, _amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setICOEthPrice(uint256 value) external {
|
function setICOEthPrice(uint256 value) external {
|
||||||
/*
|
/*
|
||||||
Setting of the ICO ETC USD rates which can only be calle by a pre-defined address.
|
Setting of the ICO ETC USD rates which can only be calle by a pre-defined address.
|
||||||
After this function is completed till the call of the next function (which is at least an exchangeRateDelay array) this rate counts.
|
After this function is completed till the call of the next function (which is at least an exchangeRateDelay array) this rate counts.
|
||||||
With this process avoiding the sudden rate changes.
|
With this process avoiding the sudden rate changes.
|
||||||
|
|
||||||
@value The ETC/USD rate multiplied by 1e4. For example: 2.5 USD/ETC = 25000
|
@value The ETC/USD rate multiplied by 1e4. For example: 2.5 USD/ETC = 25000
|
||||||
*/
|
*/
|
||||||
require( isICO() );
|
require( isICO() );
|
||||||
@ -205,18 +205,18 @@ contract ico is safeMath {
|
|||||||
icoExchangeRateSetBlock = block.number + exchangeRateDelay;
|
icoExchangeRateSetBlock = block.number + exchangeRateDelay;
|
||||||
icoExchangeRate = value;
|
icoExchangeRate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extendICO() external {
|
function extendICO() external {
|
||||||
/*
|
/*
|
||||||
Extend the period of the ICO with one segment.
|
Extend the period of the ICO with one segment.
|
||||||
|
|
||||||
It is only possible during the ICO and only callable by the owner.
|
It is only possible during the ICO and only callable by the owner.
|
||||||
*/
|
*/
|
||||||
require( isICO() );
|
require( isICO() );
|
||||||
require( msg.sender == owner );
|
require( msg.sender == owner );
|
||||||
icoDelay += oneSegment;
|
icoDelay += oneSegment;
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeICO() external {
|
function closeICO() external {
|
||||||
/*
|
/*
|
||||||
Closing the ICO.
|
Closing the ICO.
|
||||||
@ -235,10 +235,10 @@ contract ico is safeMath {
|
|||||||
require( token(tokenAddr).closeIco() );
|
require( token(tokenAddr).closeIco() );
|
||||||
require( premium(premiumAddr).closeIco() );
|
require( premium(premiumAddr).closeIco() );
|
||||||
}
|
}
|
||||||
|
|
||||||
function abortICO() external {
|
function abortICO() external {
|
||||||
/*
|
/*
|
||||||
Withdrawal of the ICO.
|
Withdrawal of the ICO.
|
||||||
It is only possible during the ICO period.
|
It is only possible during the ICO period.
|
||||||
Only callable by the owner.
|
Only callable by the owner.
|
||||||
After this process only the receiveFunds function will be available for the customers.
|
After this process only the receiveFunds function will be available for the customers.
|
||||||
@ -247,12 +247,12 @@ contract ico is safeMath {
|
|||||||
require( msg.sender == owner );
|
require( msg.sender == owner );
|
||||||
aborted = true;
|
aborted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectTokens(address tokenContractAddr, address premiumContractAddr) external {
|
function connectTokens(address tokenContractAddr, address premiumContractAddr) external {
|
||||||
/*
|
/*
|
||||||
Installation function which joins the two token contracts with this contract.
|
Installation function which joins the two token contracts with this contract.
|
||||||
Only callable by the owner
|
Only callable by the owner
|
||||||
|
|
||||||
@tokenContractAddr Address of the corion token contract.
|
@tokenContractAddr Address of the corion token contract.
|
||||||
@premiumContractAddr Address of the corion premium token contract
|
@premiumContractAddr Address of the corion premium token contract
|
||||||
*/
|
*/
|
||||||
@ -261,7 +261,7 @@ contract ico is safeMath {
|
|||||||
tokenAddr = tokenContractAddr;
|
tokenAddr = tokenContractAddr;
|
||||||
premiumAddr = premiumContractAddr;
|
premiumAddr = premiumContractAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function receiveFunds() external {
|
function receiveFunds() external {
|
||||||
/*
|
/*
|
||||||
Refund the amount which was purchased during the ICO period.
|
Refund the amount which was purchased during the ICO period.
|
||||||
@ -274,7 +274,7 @@ contract ico is safeMath {
|
|||||||
delete brought[msg.sender];
|
delete brought[msg.sender];
|
||||||
require( msg.sender.send(_val) );
|
require( msg.sender.send(_val) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function () external payable {
|
function () external payable {
|
||||||
/*
|
/*
|
||||||
Callback function. Simply calls the buy function as a beneficiary and there is no affiliate address.
|
Callback function. Simply calls the buy function as a beneficiary and there is no affiliate address.
|
||||||
@ -287,7 +287,7 @@ contract ico is safeMath {
|
|||||||
function buy(address beneficiaryAddress, address affilateAddress) public payable returns (bool success) {
|
function buy(address beneficiaryAddress, address affilateAddress) public payable returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Buying a token
|
Buying a token
|
||||||
|
|
||||||
If there is not at least 0.2 ether balance on the beneficiaryAddress then the amount of the ether which was intended for the purchase will be reduced by 0.2 and that will be sent to the address of the beneficiary.
|
If there is not at least 0.2 ether balance on the beneficiaryAddress then the amount of the ether which was intended for the purchase will be reduced by 0.2 and that will be sent to the address of the beneficiary.
|
||||||
From the remaining amount calculate the reward with the help of the getIcoReward function.
|
From the remaining amount calculate the reward with the help of the getIcoReward function.
|
||||||
Only that affiliate address is valid which has some token on it’s account.
|
Only that affiliate address is valid which has some token on it’s account.
|
||||||
@ -327,7 +327,7 @@ contract ico is safeMath {
|
|||||||
rate = 4;
|
rate = 4;
|
||||||
} else if (extra >= 1e10) {
|
} else if (extra >= 1e10) {
|
||||||
rate = 3;
|
rate = 3;
|
||||||
} else if (extra >= 1e9) {
|
} else if (extra >= 1e9) {
|
||||||
rate = 2;
|
rate = 2;
|
||||||
} else {
|
} else {
|
||||||
rate = 1;
|
rate = 1;
|
||||||
@ -344,7 +344,7 @@ contract ico is safeMath {
|
|||||||
function checkPremium(address owner) internal {
|
function checkPremium(address owner) internal {
|
||||||
/*
|
/*
|
||||||
Crediting the premium token
|
Crediting the premium token
|
||||||
|
|
||||||
@owner The corion token balance of this address will be set based on the calculation which shows that how many times can be the amount of the purchased tokens divided by 5000. So after each 5000 token we give 1 premium token.
|
@owner The corion token balance of this address will be set based on the calculation which shows that how many times can be the amount of the purchased tokens divided by 5000. So after each 5000 token we give 1 premium token.
|
||||||
*/
|
*/
|
||||||
uint256 _reward = (brought[owner].cor / 5e9) - brought[owner].corp;
|
uint256 _reward = (brought[owner].cor / 5e9) - brought[owner].corp;
|
||||||
@ -354,11 +354,11 @@ contract ico is safeMath {
|
|||||||
totalPremiumMint = safeAdd(totalPremiumMint, _reward);
|
totalPremiumMint = safeAdd(totalPremiumMint, _reward);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIcoReward(uint256 value) public view returns (uint256 reward) {
|
function getIcoReward(uint256 value) public view returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Expected token volume at token purchase
|
Expected token volume at token purchase
|
||||||
|
|
||||||
@value The amount of ether for the purchase
|
@value The amount of ether for the purchase
|
||||||
@reward Amount of the token
|
@reward Amount of the token
|
||||||
x = (value * 1e6 * USD_ETC_exchange rate / 1e4 / 1e18) * bonus percentage
|
x = (value * 1e6 * USD_ETC_exchange rate / 1e4 / 1e18) * bonus percentage
|
||||||
@ -367,10 +367,10 @@ contract ico is safeMath {
|
|||||||
reward = (value * 1e6 * icoExchangeRate / icoExchangeRateM / 1 ether) * (ICObonus() + 100) / 100;
|
reward = (value * 1e6 * icoExchangeRate / icoExchangeRateM / 1 ether) * (ICObonus() + 100) / 100;
|
||||||
if ( reward < 5e6) { return 0; }
|
if ( reward < 5e6) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function isICO() public view returns (bool success) {
|
function isICO() public view returns (bool success) {
|
||||||
return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed );
|
return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed );
|
||||||
}
|
}
|
||||||
|
|
||||||
event EICO(address indexed Address, uint256 indexed value, address Affiliate, uint256 AffilateValue);
|
event EICO(address indexed Address, uint256 indexed value, address Affiliate, uint256 AffilateValue);
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,18 @@ contract module {
|
|||||||
/*
|
/*
|
||||||
Module
|
Module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum status {
|
enum status {
|
||||||
New,
|
New,
|
||||||
Connected,
|
Connected,
|
||||||
Disconnected,
|
Disconnected,
|
||||||
Disabled
|
Disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
status public moduleStatus;
|
status public moduleStatus;
|
||||||
uint256 public disabledUntil;
|
uint256 public disabledUntil;
|
||||||
address public moduleHandlerAddress;
|
address public moduleHandlerAddress;
|
||||||
|
|
||||||
function disableModule(bool forever) external onlyForModuleHandler returns (bool success) {
|
function disableModule(bool forever) external onlyForModuleHandler returns (bool success) {
|
||||||
_disableModule(forever);
|
_disableModule(forever);
|
||||||
return true;
|
return true;
|
||||||
@ -29,13 +29,13 @@ contract module {
|
|||||||
/*
|
/*
|
||||||
Disable the module for one week, if the forever true then for forever.
|
Disable the module for one week, if the forever true then for forever.
|
||||||
This function calls the Publisher module.
|
This function calls the Publisher module.
|
||||||
|
|
||||||
@forever For forever or not
|
@forever For forever or not
|
||||||
*/
|
*/
|
||||||
if ( forever ) { moduleStatus = status.Disabled; }
|
if ( forever ) { moduleStatus = status.Disabled; }
|
||||||
else { disabledUntil = block.number + 5760; }
|
else { disabledUntil = block.number + 5760; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceModuleHandler(address newModuleHandlerAddress) external onlyForModuleHandler returns (bool success) {
|
function replaceModuleHandler(address newModuleHandlerAddress) external onlyForModuleHandler returns (bool success) {
|
||||||
_replaceModuleHandler(newModuleHandlerAddress);
|
_replaceModuleHandler(newModuleHandlerAddress);
|
||||||
return true;
|
return true;
|
||||||
@ -44,13 +44,13 @@ contract module {
|
|||||||
/*
|
/*
|
||||||
Replace the ModuleHandler address.
|
Replace the ModuleHandler address.
|
||||||
This function calls the Publisher module.
|
This function calls the Publisher module.
|
||||||
|
|
||||||
@newModuleHandlerAddress New module handler address
|
@newModuleHandlerAddress New module handler address
|
||||||
*/
|
*/
|
||||||
require( moduleStatus == status.Connected );
|
require( moduleStatus == status.Connected );
|
||||||
moduleHandlerAddress = newModuleHandlerAddress;
|
moduleHandlerAddress = newModuleHandlerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectModule() external onlyForModuleHandler returns (bool success) {
|
function connectModule() external onlyForModuleHandler returns (bool success) {
|
||||||
_connectModule();
|
_connectModule();
|
||||||
return true;
|
return true;
|
||||||
@ -63,7 +63,7 @@ contract module {
|
|||||||
require( moduleStatus == status.New );
|
require( moduleStatus == status.New );
|
||||||
moduleStatus = status.Connected;
|
moduleStatus = status.Connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnectModule() external onlyForModuleHandler returns (bool success) {
|
function disconnectModule() external onlyForModuleHandler returns (bool success) {
|
||||||
_disconnectModule();
|
_disconnectModule();
|
||||||
return true;
|
return true;
|
||||||
@ -76,7 +76,7 @@ contract module {
|
|||||||
require( moduleStatus != status.New && moduleStatus != status.Disconnected );
|
require( moduleStatus != status.New && moduleStatus != status.Disconnected );
|
||||||
moduleStatus = status.Disconnected;
|
moduleStatus = status.Disconnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceModule(address newModuleAddress) external onlyForModuleHandler returns (bool success) {
|
function replaceModule(address newModuleAddress) external onlyForModuleHandler returns (bool success) {
|
||||||
_replaceModule(newModuleAddress);
|
_replaceModule(newModuleAddress);
|
||||||
return true;
|
return true;
|
||||||
@ -86,7 +86,7 @@ contract module {
|
|||||||
Replace the module for an another new module.
|
Replace the module for an another new module.
|
||||||
This function calls the Publisher module.
|
This function calls the Publisher module.
|
||||||
We send every Token and ether to the new module.
|
We send every Token and ether to the new module.
|
||||||
|
|
||||||
@newModuleAddress New module handler address
|
@newModuleAddress New module handler address
|
||||||
*/
|
*/
|
||||||
require( moduleStatus != status.New && moduleStatus != status.Disconnected);
|
require( moduleStatus != status.New && moduleStatus != status.Disconnected);
|
||||||
@ -100,14 +100,14 @@ contract module {
|
|||||||
}
|
}
|
||||||
moduleStatus = status.Disconnected;
|
moduleStatus = status.Disconnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferEvent(address from, address to, uint256 value) external onlyForModuleHandler returns (bool success) {
|
function transferEvent(address from, address to, uint256 value) external onlyForModuleHandler returns (bool success) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function newSchellingRoundEvent(uint256 roundID, uint256 reward) external onlyForModuleHandler returns (bool success) {
|
function newSchellingRoundEvent(uint256 roundID, uint256 reward) external onlyForModuleHandler returns (bool success) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerModuleHandler(address _moduleHandlerAddress) internal {
|
function registerModuleHandler(address _moduleHandlerAddress) internal {
|
||||||
/*
|
/*
|
||||||
Module constructor function for registering ModuleHandler address.
|
Module constructor function for registering ModuleHandler address.
|
||||||
@ -118,9 +118,9 @@ contract module {
|
|||||||
/*
|
/*
|
||||||
Test for ModuleHandler address.
|
Test for ModuleHandler address.
|
||||||
If the module is not connected then returns always false.
|
If the module is not connected then returns always false.
|
||||||
|
|
||||||
@addr Address to check
|
@addr Address to check
|
||||||
|
|
||||||
@ret This is the module handler address or not
|
@ret This is the module handler address or not
|
||||||
*/
|
*/
|
||||||
if ( moduleHandlerAddress == address(0x00) ) { return true; }
|
if ( moduleHandlerAddress == address(0x00) ) { return true; }
|
||||||
@ -130,7 +130,7 @@ contract module {
|
|||||||
function isActive() public view returns (bool success, bool active) {
|
function isActive() public view returns (bool success, bool active) {
|
||||||
/*
|
/*
|
||||||
Check self for ready for functions or not.
|
Check self for ready for functions or not.
|
||||||
|
|
||||||
@success Function call was successful or not
|
@success Function call was successful or not
|
||||||
@active Ready for functions or not
|
@active Ready for functions or not
|
||||||
*/
|
*/
|
||||||
|
@ -23,14 +23,14 @@ contract abstractModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contract moduleHandler is multiOwner, announcementTypes {
|
contract moduleHandler is multiOwner, announcementTypes {
|
||||||
|
|
||||||
struct modules_s {
|
struct modules_s {
|
||||||
address addr;
|
address addr;
|
||||||
bytes32 name;
|
bytes32 name;
|
||||||
bool schellingEvent;
|
bool schellingEvent;
|
||||||
bool transferEvent;
|
bool transferEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
modules_s[] public modules;
|
modules_s[] public modules;
|
||||||
address public foundationAddress;
|
address public foundationAddress;
|
||||||
uint256 debugModeUntil = block.number + 1000000;
|
uint256 debugModeUntil = block.number + 1000000;
|
||||||
@ -40,10 +40,10 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) public {
|
function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) public {
|
||||||
/*
|
/*
|
||||||
Loading modulest to ModuleHandler.
|
Loading modulest to ModuleHandler.
|
||||||
|
|
||||||
This module can be called only once and only by the owner, if every single module and its database are already put on the blockchain.
|
This module can be called only once and only by the owner, if every single module and its database are already put on the blockchain.
|
||||||
If forReaplace is true, than the ModuleHandler will be replaced. Before the publishing of its replace, the new contract must be already on the blockchain.
|
If forReaplace is true, than the ModuleHandler will be replaced. Before the publishing of its replace, the new contract must be already on the blockchain.
|
||||||
|
|
||||||
@foundation Address of foundation.
|
@foundation Address of foundation.
|
||||||
@forReplace Is it for replace or not. If not, it will be connected to the module.
|
@forReplace Is it for replace or not. If not, it will be connected to the module.
|
||||||
@Token address of token.
|
@Token address of token.
|
||||||
@ -64,7 +64,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Inside function for registration of the modules in the database.
|
Inside function for registration of the modules in the database.
|
||||||
If the call is false, won't happen any direct call.
|
If the call is false, won't happen any direct call.
|
||||||
|
|
||||||
@input _Structure of module.
|
@input _Structure of module.
|
||||||
@call Is connect to the module or not.
|
@call Is connect to the module or not.
|
||||||
*/
|
*/
|
||||||
@ -84,7 +84,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function getModuleAddressByName(string memory name) public view returns( bool success, bool found, address addr ) {
|
function getModuleAddressByName(string memory name) public view returns( bool success, bool found, address addr ) {
|
||||||
/*
|
/*
|
||||||
Search by name for module. The result is an Ethereum address.
|
Search by name for module. The result is an Ethereum address.
|
||||||
|
|
||||||
@name Name of module.
|
@name Name of module.
|
||||||
@addr Address of module.
|
@addr Address of module.
|
||||||
@found Is there any result.
|
@found Is there any result.
|
||||||
@ -97,7 +97,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function getModuleIDByHash(bytes32 hashOfName) public view returns( bool success, bool found, uint256 id ) {
|
function getModuleIDByHash(bytes32 hashOfName) public view returns( bool success, bool found, uint256 id ) {
|
||||||
/*
|
/*
|
||||||
Search by hash of name in the module array. The result is an index array.
|
Search by hash of name in the module array. The result is an index array.
|
||||||
|
|
||||||
@name Name of module.
|
@name Name of module.
|
||||||
@id Index of module.
|
@id Index of module.
|
||||||
@found Was there any result or not.
|
@found Was there any result or not.
|
||||||
@ -112,7 +112,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function getModuleIDByName(string memory name) public view returns( bool success, bool found, uint256 id ) {
|
function getModuleIDByName(string memory name) public view returns( bool success, bool found, uint256 id ) {
|
||||||
/*
|
/*
|
||||||
Search by name for module. The result is an index array.
|
Search by name for module. The result is an index array.
|
||||||
|
|
||||||
@name Name of module.
|
@name Name of module.
|
||||||
@id Index of module.
|
@id Index of module.
|
||||||
@found Was there any result or not.
|
@found Was there any result or not.
|
||||||
@ -128,7 +128,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function getModuleIDByAddress(address addr) public view returns( bool success, bool found, uint256 id ) {
|
function getModuleIDByAddress(address addr) public view returns( bool success, bool found, uint256 id ) {
|
||||||
/*
|
/*
|
||||||
Search by ethereum address for module. The result is an index array.
|
Search by ethereum address for module. The result is an index array.
|
||||||
|
|
||||||
@name Name of module.
|
@name Name of module.
|
||||||
@id Index of module.
|
@id Index of module.
|
||||||
@found Was there any result or not.
|
@found Was there any result or not.
|
||||||
@ -143,7 +143,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function replaceModule(string name, address addr, bool callCallback) external returns (bool success) {
|
function replaceModule(string name, address addr, bool callCallback) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Module replace, can be called only by the Publisher contract.
|
Module replace, can be called only by the Publisher contract.
|
||||||
|
|
||||||
@name Name of module.
|
@name Name of module.
|
||||||
@addr Address of module.
|
@addr Address of module.
|
||||||
@bool Was there any result or not.
|
@bool Was there any result or not.
|
||||||
@ -166,7 +166,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
modules[_id].addr = addr;
|
modules[_id].addr = addr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function callReplaceCallback(string moduleName, address newModule) external returns (bool success) {
|
function callReplaceCallback(string moduleName, address newModule) external returns (bool success) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(abi.encodePacked(moduleName, newModule)))) ) {
|
if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(abi.encodePacked(moduleName, newModule)))) ) {
|
||||||
@ -181,7 +181,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function newModule(string name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) {
|
function newModule(string name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Adding new module to the database. Can be called only by the Publisher contract.
|
Adding new module to the database. Can be called only by the Publisher contract.
|
||||||
|
|
||||||
@name Name of module.
|
@name Name of module.
|
||||||
@addr Address of module.
|
@addr Address of module.
|
||||||
@schellingEvent Gets it new Schelling round notification?
|
@schellingEvent Gets it new Schelling round notification?
|
||||||
@ -202,7 +202,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function dropModule(string name, bool callCallback) external returns (bool success) {
|
function dropModule(string name, bool callCallback) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Deleting module from the database. Can be called only by the Publisher contract.
|
Deleting module from the database. Can be called only by the Publisher contract.
|
||||||
|
|
||||||
@name Name of module to delete.
|
@name Name of module to delete.
|
||||||
@bool Was the function successful?
|
@bool Was the function successful?
|
||||||
@callCallback Call the replaceable module to confirm replacement or not.
|
@callCallback Call the replaceable module to confirm replacement or not.
|
||||||
@ -223,7 +223,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
delete modules[_id];
|
delete modules[_id];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function callDisableCallback(string moduleName) external returns (bool success) {
|
function callDisableCallback(string moduleName) external returns (bool success) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(bytes(moduleName)))) ) {
|
if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(bytes(moduleName)))) ) {
|
||||||
@ -234,14 +234,14 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
require( abstractModule(modules[_id].addr).disableModule(true) );
|
require( abstractModule(modules[_id].addr).disableModule(true) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function broadcastTransfer(address from, address to, uint256 value) external returns (bool success) {
|
function broadcastTransfer(address from, address to, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Announcing transactions for the modules.
|
Announcing transactions for the modules.
|
||||||
|
|
||||||
Can be called only by the token module.
|
Can be called only by the token module.
|
||||||
Only the configured modules get notifications.( transferEvent )
|
Only the configured modules get notifications.( transferEvent )
|
||||||
|
|
||||||
@from from who.
|
@from from who.
|
||||||
@to to who.
|
@to to who.
|
||||||
@value amount.
|
@value amount.
|
||||||
@ -261,7 +261,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
Announcing new Schelling round for the modules.
|
Announcing new Schelling round for the modules.
|
||||||
Can be called only by the Schelling module.
|
Can be called only by the Schelling module.
|
||||||
Only the configured modules get notifications( schellingEvent ).
|
Only the configured modules get notifications( schellingEvent ).
|
||||||
|
|
||||||
@roundID Number of Schelling round.
|
@roundID Number of Schelling round.
|
||||||
@reward Coin emission in this Schelling round.
|
@reward Coin emission in this Schelling round.
|
||||||
@bool Was the function successful?
|
@bool Was the function successful?
|
||||||
@ -278,10 +278,10 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function replaceModuleHandler(address newHandler) external returns (bool success) {
|
function replaceModuleHandler(address newHandler) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Replacing ModuleHandler.
|
Replacing ModuleHandler.
|
||||||
|
|
||||||
Can be called only by the publisher.
|
Can be called only by the publisher.
|
||||||
Every module will be informed about the ModuleHandler replacement.
|
Every module will be informed about the ModuleHandler replacement.
|
||||||
|
|
||||||
@newHandler Address of the new ModuleHandler.
|
@newHandler Address of the new ModuleHandler.
|
||||||
@bool Was the function successful?
|
@bool Was the function successful?
|
||||||
*/
|
*/
|
||||||
@ -301,7 +301,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function balanceOf(address owner) public view returns (bool success, uint256 value) {
|
function balanceOf(address owner) public view returns (bool success, uint256 value) {
|
||||||
/*
|
/*
|
||||||
Query of token balance.
|
Query of token balance.
|
||||||
|
|
||||||
@owner address
|
@owner address
|
||||||
@value balance.
|
@value balance.
|
||||||
@success was the function successful?
|
@success was the function successful?
|
||||||
@ -313,7 +313,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function totalSupply() public view returns (bool success, uint256 value) {
|
function totalSupply() public view returns (bool success, uint256 value) {
|
||||||
/*
|
/*
|
||||||
Query of the whole token amount.
|
Query of the whole token amount.
|
||||||
|
|
||||||
@value amount.
|
@value amount.
|
||||||
@success was the function successful?
|
@success was the function successful?
|
||||||
*/
|
*/
|
||||||
@ -324,7 +324,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function isICO() public view returns (bool success, bool ico) {
|
function isICO() public view returns (bool success, bool ico) {
|
||||||
/*
|
/*
|
||||||
Query of ICO state
|
Query of ICO state
|
||||||
|
|
||||||
@ico Is ICO in progress?.
|
@ico Is ICO in progress?.
|
||||||
@success was the function successful?
|
@success was the function successful?
|
||||||
*/
|
*/
|
||||||
@ -335,7 +335,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function getCurrentSchellingRoundID() public view returns (bool success, uint256 round) {
|
function getCurrentSchellingRoundID() public view returns (bool success, uint256 round) {
|
||||||
/*
|
/*
|
||||||
Query of number of the actual Schelling round.
|
Query of number of the actual Schelling round.
|
||||||
|
|
||||||
@round Schelling round.
|
@round Schelling round.
|
||||||
@success was the function successful?
|
@success was the function successful?
|
||||||
*/
|
*/
|
||||||
@ -346,10 +346,10 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function mint(address to, uint256 value) external returns (bool success) {
|
function mint(address to, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Token emission request. Can be called only by the provider.
|
Token emission request. Can be called only by the provider.
|
||||||
|
|
||||||
@to Place of new token
|
@to Place of new token
|
||||||
@value Token amount
|
@value Token amount
|
||||||
|
|
||||||
@success Was the function successful?
|
@success Was the function successful?
|
||||||
*/
|
*/
|
||||||
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
@ -362,7 +362,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) {
|
function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Token transaction request. Can be called only by a module.
|
Token transaction request. Can be called only by a module.
|
||||||
|
|
||||||
@from from who.
|
@from from who.
|
||||||
@to To who.
|
@to To who.
|
||||||
@value Token amount.
|
@value Token amount.
|
||||||
@ -379,7 +379,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function processTransactionFee(address from, uint256 value) external returns (bool success) {
|
function processTransactionFee(address from, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Token transaction fee. Can be called only by the provider.
|
Token transaction fee. Can be called only by the provider.
|
||||||
|
|
||||||
@from From who.
|
@from From who.
|
||||||
@value Token amount.
|
@value Token amount.
|
||||||
@success Was the function successful?
|
@success Was the function successful?
|
||||||
@ -394,7 +394,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function burn(address from, uint256 value) external returns (bool success) {
|
function burn(address from, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Token burn. Can be called only by Schelling.
|
Token burn. Can be called only by Schelling.
|
||||||
|
|
||||||
@from From who.
|
@from From who.
|
||||||
@value Token amount.
|
@value Token amount.
|
||||||
@success Was the function successful?
|
@success Was the function successful?
|
||||||
@ -409,7 +409,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
function configureModule(string moduleName, announcementType aType, uint256 value) external returns (bool success) {
|
function configureModule(string moduleName, announcementType aType, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Changing configuration of a module. Can be called only by Publisher or while debug mode by owners.
|
Changing configuration of a module. Can be called only by Publisher or while debug mode by owners.
|
||||||
|
|
||||||
@moduleName Module name which will be configured
|
@moduleName Module name which will be configured
|
||||||
@aType Type of variable (announcementType).
|
@aType Type of variable (announcementType).
|
||||||
@value New value
|
@value New value
|
||||||
@ -432,14 +432,14 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Freezing CORION Platform. Can be called only by the owner.
|
Freezing CORION Platform. Can be called only by the owner.
|
||||||
Freeze can not be recalled!
|
Freeze can not be recalled!
|
||||||
|
|
||||||
@forever Is it forever or not?
|
@forever Is it forever or not?
|
||||||
*/
|
*/
|
||||||
require( owners[msg.sender] );
|
require( owners[msg.sender] );
|
||||||
if ( forever ) {
|
if ( forever ) {
|
||||||
if ( ! insertAndCheckDo(calcDoHash("freezing", keccak256(abi.encodePacked(forever)))) ) {
|
if ( ! insertAndCheckDo(calcDoHash("freezing", keccak256(abi.encodePacked(forever)))) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ( uint256 a=0 ; a<modules.length ; a++ ) {
|
for ( uint256 a=0 ; a<modules.length ; a++ ) {
|
||||||
require( abstractModule(modules[a].addr).disableModule(forever) );
|
require( abstractModule(modules[a].addr).disableModule(forever) );
|
||||||
|
@ -3,12 +3,12 @@ pragma solidity ^0.4.11;
|
|||||||
import "./safeMath.sol";
|
import "./safeMath.sol";
|
||||||
|
|
||||||
contract multiOwner is safeMath {
|
contract multiOwner is safeMath {
|
||||||
|
|
||||||
mapping(address => bool) public owners;
|
mapping(address => bool) public owners;
|
||||||
uint256 public ownerCount;
|
uint256 public ownerCount;
|
||||||
|
|
||||||
mapping(bytes32 => address[]) public doDB;
|
mapping(bytes32 => address[]) public doDB;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Constructor
|
Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
pragma solidity ^0.4.11;
|
pragma solidity ^0.4.11;
|
||||||
|
|
||||||
contract ownedDB {
|
contract ownedDB {
|
||||||
address private owner;
|
address private owner;
|
||||||
|
|
||||||
function replaceOwner(address newOwner) external returns(bool) {
|
function replaceOwner(address newOwner) external returns(bool) {
|
||||||
/*
|
/*
|
||||||
Owner replace.
|
Owner replace.
|
||||||
|
|
||||||
@newOwner Address of new owner.
|
@newOwner Address of new owner.
|
||||||
*/
|
*/
|
||||||
require( isOwner() );
|
require( isOwner() );
|
||||||
owner = newOwner;
|
owner = newOwner;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isOwner() internal returns(bool) {
|
function isOwner() internal returns(bool) {
|
||||||
/*
|
/*
|
||||||
Check of owner address.
|
Check of owner address.
|
||||||
|
|
||||||
@bool Owner has called the contract or not
|
@bool Owner has called the contract or not
|
||||||
*/
|
*/
|
||||||
if ( owner == address(0x00) ) {
|
if ( owner == address(0x00) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return owner == msg.sender;
|
return owner == msg.sender;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ contract premium is module, safeMath {
|
|||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
(bool _success, bool _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -29,22 +29,22 @@ contract premium is module, safeMath {
|
|||||||
* @author iFA @ Corion Platform
|
* @author iFA @ Corion Platform
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
string public name = "Corion Premium";
|
string public name = "Corion Premium";
|
||||||
string public symbol = "CORP";
|
string public symbol = "CORP";
|
||||||
uint8 public decimals = 0;
|
uint8 public decimals = 0;
|
||||||
|
|
||||||
address public icoAddr;
|
address public icoAddr;
|
||||||
tokenDB public db;
|
tokenDB public db;
|
||||||
bool public isICO;
|
bool public isICO;
|
||||||
|
|
||||||
mapping(address => bool) public genesis;
|
mapping(address => bool) public genesis;
|
||||||
|
|
||||||
constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public {
|
constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public {
|
||||||
/*
|
/*
|
||||||
Setup function.
|
Setup function.
|
||||||
If an ICOaddress is defined then the balance of the genesis addresses will be set as well.
|
If an ICOaddress is defined then the balance of the genesis addresses will be set as well.
|
||||||
|
|
||||||
@forReplace This address will be replaced with the old one or not.
|
@forReplace This address will be replaced with the old one or not.
|
||||||
@moduleHandler Modulhandler’s address
|
@moduleHandler Modulhandler’s address
|
||||||
@dbAddress Address of database
|
@dbAddress Address of database
|
||||||
@ -67,18 +67,18 @@ contract premium is module, safeMath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeIco() external returns (bool success) {
|
function closeIco() external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Finishing the ICO. Can be invited only by an ICO contract.
|
Finishing the ICO. Can be invited only by an ICO contract.
|
||||||
|
|
||||||
@success If the function was successful.
|
@success If the function was successful.
|
||||||
*/
|
*/
|
||||||
require( isICO );
|
require( isICO );
|
||||||
isICO = false;
|
isICO = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf.
|
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf.
|
||||||
* @param spender The address of the account able to transfer the tokens
|
* @param spender The address of the account able to transfer the tokens
|
||||||
@ -88,18 +88,18 @@ contract premium is module, safeMath {
|
|||||||
*/
|
*/
|
||||||
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Authorize another address to use an exact amount of the principal’s balance.
|
Authorize another address to use an exact amount of the principal’s balance.
|
||||||
|
|
||||||
@spender Address of authorised party
|
@spender Address of authorised party
|
||||||
@amount Token quantity
|
@amount Token quantity
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
_approve(spender, amount, nonce);
|
_approve(spender, amount, nonce);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data.
|
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data.
|
||||||
* @param spender The address of the account able to transfer the tokens
|
* @param spender The address of the account able to transfer the tokens
|
||||||
@ -112,24 +112,24 @@ contract premium is module, safeMath {
|
|||||||
/*
|
/*
|
||||||
Authorize another address to use an exact amount of the principal’s balance.
|
Authorize another address to use an exact amount of the principal’s balance.
|
||||||
After the transaction the approvedCorionPremiumToken function of the address will be called with the given data.
|
After the transaction the approvedCorionPremiumToken function of the address will be called with the given data.
|
||||||
|
|
||||||
@spender Authorized address
|
@spender Authorized address
|
||||||
@amount Token quantity
|
@amount Token quantity
|
||||||
@extraData Extra data to be received by the receiver
|
@extraData Extra data to be received by the receiver
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
_approve(spender, amount, nonce);
|
_approve(spender, amount, nonce);
|
||||||
require( thirdPartyPContractAbstract(spender).approvedCorionPremiumToken(msg.sender, amount, extraData) );
|
require( thirdPartyPContractAbstract(spender).approvedCorionPremiumToken(msg.sender, amount, extraData) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _approve(address spender, uint256 amount, uint256 nonce) isReady internal {
|
function _approve(address spender, uint256 amount, uint256 nonce) isReady internal {
|
||||||
/*
|
/*
|
||||||
Inner function to authorize another address to use an exact amount of the principal’s balance.
|
Inner function to authorize another address to use an exact amount of the principal’s balance.
|
||||||
If the transaction count not match the authorise fails.
|
If the transaction count not match the authorise fails.
|
||||||
|
|
||||||
@spender Address of authorised party
|
@spender Address of authorised party
|
||||||
@amount Token quantity
|
@amount Token quantity
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
@ -143,10 +143,10 @@ contract premium is module, safeMath {
|
|||||||
function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) {
|
function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) {
|
||||||
/*
|
/*
|
||||||
Get the quantity of tokens given to be used
|
Get the quantity of tokens given to be used
|
||||||
|
|
||||||
@owner Authorising address
|
@owner Authorising address
|
||||||
@spender Authorised address
|
@spender Authorised address
|
||||||
|
|
||||||
@remaining Tokens to be spent
|
@remaining Tokens to be spent
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
*/
|
*/
|
||||||
@ -154,7 +154,7 @@ contract premium is module, safeMath {
|
|||||||
require( _success );
|
require( _success );
|
||||||
return (_remaining, _nonce);
|
return (_remaining, _nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
@ -166,10 +166,10 @@ contract premium is module, safeMath {
|
|||||||
Launch a transaction where the token is sent from the sender’s address to the receiver’s address.
|
Launch a transaction where the token is sent from the sender’s address to the receiver’s address.
|
||||||
Transaction fee is going to be added as well.
|
Transaction fee is going to be added as well.
|
||||||
If the receiver is not a natural address but also a person then she/he will be invited as well.
|
If the receiver is not a natural address but also a person then she/he will be invited as well.
|
||||||
|
|
||||||
@to For who
|
@to For who
|
||||||
@amount Amount
|
@amount Amount
|
||||||
|
|
||||||
@success Was the function successful?
|
@success Was the function successful?
|
||||||
*/
|
*/
|
||||||
bytes memory _data;
|
bytes memory _data;
|
||||||
@ -181,7 +181,7 @@ contract premium is module, safeMath {
|
|||||||
emit Transfer(msg.sender, to, amount, _data);
|
emit Transfer(msg.sender, to, amount, _data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from`
|
* @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from`
|
||||||
* @param from The address holding the tokens being transferred
|
* @param from The address holding the tokens being transferred
|
||||||
@ -194,11 +194,11 @@ contract premium is module, safeMath {
|
|||||||
Launch a transaction where we transfer from a given address to another one. It can only be called by an address which was allowed before.
|
Launch a transaction where we transfer from a given address to another one. It can only be called by an address which was allowed before.
|
||||||
Transaction fee will be charged too.
|
Transaction fee will be charged too.
|
||||||
If the receiver is not a natural address but also a person then she/he will be invited as well
|
If the receiver is not a natural address but also a person then she/he will be invited as well
|
||||||
|
|
||||||
@from From who?
|
@from From who?
|
||||||
@to For who?
|
@to For who?
|
||||||
@amount Amount
|
@amount Amount
|
||||||
|
|
||||||
@success If the function was successful.
|
@success If the function was successful.
|
||||||
*/
|
*/
|
||||||
if ( from != msg.sender ) {
|
if ( from != msg.sender ) {
|
||||||
@ -218,7 +218,7 @@ contract premium is module, safeMath {
|
|||||||
emit Transfer(from, to, amount, _data);
|
emit Transfer(from, to, amount, _data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` Corion tokens to `to` from `msg.sender` and notify the receiver from your transaction with your `extraData` data
|
* @notice Send `amount` Corion tokens to `to` from `msg.sender` and notify the receiver from your transaction with your `extraData` data
|
||||||
* @param to The contract address of the recipient
|
* @param to The contract address of the recipient
|
||||||
@ -230,11 +230,11 @@ contract premium is module, safeMath {
|
|||||||
/*
|
/*
|
||||||
Launch a transaction where we transfer from a given address to another one.
|
Launch a transaction where we transfer from a given address to another one.
|
||||||
After thetransaction the approvedCorionPremiumToken function of the receiver’s address is going to be called with the given data.
|
After thetransaction the approvedCorionPremiumToken function of the receiver’s address is going to be called with the given data.
|
||||||
|
|
||||||
@to For who?
|
@to For who?
|
||||||
@amount Amount
|
@amount Amount
|
||||||
@extraData Extra data that will be given to the receiver
|
@extraData Extra data that will be given to the receiver
|
||||||
|
|
||||||
@success If the function was successful.
|
@success If the function was successful.
|
||||||
*/
|
*/
|
||||||
if ( isContract(to) ) {
|
if ( isContract(to) ) {
|
||||||
@ -245,11 +245,11 @@ contract premium is module, safeMath {
|
|||||||
emit Transfer(msg.sender, to, amount, extraData);
|
emit Transfer(msg.sender, to, amount, extraData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal {
|
function transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal {
|
||||||
/*
|
/*
|
||||||
Inner function in order to transact a contract.
|
Inner function in order to transact a contract.
|
||||||
|
|
||||||
@to For who?
|
@to For who?
|
||||||
@amount Amount
|
@amount Amount
|
||||||
@extraData Extra data that will be given to the receiver
|
@extraData Extra data that will be given to the receiver
|
||||||
@ -262,13 +262,13 @@ contract premium is module, safeMath {
|
|||||||
_transfer(to, from, _back);
|
_transfer(to, from, _back);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _transfer(address from, address to, uint256 amount) isReady internal {
|
function _transfer(address from, address to, uint256 amount) isReady internal {
|
||||||
/*
|
/*
|
||||||
Inner function to launch a transaction.
|
Inner function to launch a transaction.
|
||||||
During the ICO transactions are only possible from the genesis address.
|
During the ICO transactions are only possible from the genesis address.
|
||||||
0xa636a97578d26a3b76b060bbc18226d954cf3757 address is blacklisted.
|
0xa636a97578d26a3b76b060bbc18226d954cf3757 address is blacklisted.
|
||||||
|
|
||||||
@from From how?
|
@from From how?
|
||||||
@to For who?
|
@to For who?
|
||||||
@amount Amount
|
@amount Amount
|
||||||
@ -278,38 +278,38 @@ contract premium is module, safeMath {
|
|||||||
require( db.decrease(from, amount) );
|
require( db.decrease(from, amount) );
|
||||||
require( db.increase(to, amount) );
|
require( db.increase(to, amount) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function mint(address owner, uint256 value) external returns (bool success) {
|
function mint(address owner, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Generating tokens. It can be called only by ICO contract.
|
Generating tokens. It can be called only by ICO contract.
|
||||||
|
|
||||||
@owner Address
|
@owner Address
|
||||||
@value Amount.
|
@value Amount.
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( msg.sender == icoAddr || isICO );
|
require( msg.sender == icoAddr || isICO );
|
||||||
_mint(owner, value);
|
_mint(owner, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _mint(address owner, uint256 value) isReady internal {
|
function _mint(address owner, uint256 value) isReady internal {
|
||||||
/*
|
/*
|
||||||
Inner function to create a token.
|
Inner function to create a token.
|
||||||
|
|
||||||
@owner Address of crediting the token.
|
@owner Address of crediting the token.
|
||||||
@value Amount
|
@value Amount
|
||||||
*/
|
*/
|
||||||
require( db.increase(owner, value) );
|
require( db.increase(owner, value) );
|
||||||
emit Mint(owner, value);
|
emit Mint(owner, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isContract(address addr) internal returns (bool success) {
|
function isContract(address addr) internal returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Inner function in order to check if the given address is a natural address or a contract.
|
Inner function in order to check if the given address is a natural address or a contract.
|
||||||
|
|
||||||
@addr The address which is needed to be checked.
|
@addr The address which is needed to be checked.
|
||||||
|
|
||||||
@success Is the address crontact or not
|
@success Is the address crontact or not
|
||||||
*/
|
*/
|
||||||
uint256 _codeLength;
|
uint256 _codeLength;
|
||||||
@ -322,7 +322,7 @@ contract premium is module, safeMath {
|
|||||||
function balanceOf(address owner) public view returns (uint256 value) {
|
function balanceOf(address owner) public view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Token balance query
|
Token balance query
|
||||||
|
|
||||||
@owner Address
|
@owner Address
|
||||||
@value Balance of address
|
@value Balance of address
|
||||||
*/
|
*/
|
||||||
@ -332,12 +332,12 @@ contract premium is module, safeMath {
|
|||||||
function totalSupply() public view returns (uint256 value) {
|
function totalSupply() public view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Total token quantity query
|
Total token quantity query
|
||||||
|
|
||||||
@value Total token quantity
|
@value Total token quantity
|
||||||
*/
|
*/
|
||||||
return db.totalSupply();
|
return db.totalSupply();
|
||||||
}
|
}
|
||||||
|
|
||||||
event AllowanceUsed(address indexed spender, address indexed owner, uint256 indexed value);
|
event AllowanceUsed(address indexed spender, address indexed owner, uint256 indexed value);
|
||||||
event Mint(address indexed addr, uint256 indexed value);
|
event Mint(address indexed addr, uint256 indexed value);
|
||||||
event Burn(address indexed addr, uint256 indexed value);
|
event Burn(address indexed addr, uint256 indexed value);
|
||||||
|
@ -20,7 +20,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Transaction completed. This function is only available for the modulehandler.
|
Transaction completed. This function is only available for the modulehandler.
|
||||||
It should be checked if the sender or the acceptor does not connect to the provider or it is not a provider itself if so than the change should be recorded.
|
It should be checked if the sender or the acceptor does not connect to the provider or it is not a provider itself if so than the change should be recorded.
|
||||||
|
|
||||||
@from From whom?
|
@from From whom?
|
||||||
@to For who?
|
@to For who?
|
||||||
@value amount
|
@value amount
|
||||||
@ -36,9 +36,9 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
New schelling round. This function is only available for the moduleHandler.
|
New schelling round. This function is only available for the moduleHandler.
|
||||||
We are recording the new schelling round and we are storing the whole current quantity of the tokens.
|
We are recording the new schelling round and we are storing the whole current quantity of the tokens.
|
||||||
We generate a reward quantity of tokens directed to the providers address. The collected interest will be transferred from this contract.
|
We generate a reward quantity of tokens directed to the providers address. The collected interest will be transferred from this contract.
|
||||||
|
|
||||||
@roundID Number of the schelling round.
|
@roundID Number of the schelling round.
|
||||||
@reward token emission
|
@reward token emission
|
||||||
@bool Was the function successful?
|
@bool Was the function successful?
|
||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
@ -50,7 +50,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
(bool _success, bool _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -98,13 +98,13 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
uint256 currentHeight;
|
uint256 currentHeight;
|
||||||
}
|
}
|
||||||
mapping(address => _providers) private providers;
|
mapping(address => _providers) private providers;
|
||||||
|
|
||||||
struct _globalFunds {
|
struct _globalFunds {
|
||||||
uint256 reward;
|
uint256 reward;
|
||||||
uint256 supply;
|
uint256 supply;
|
||||||
}
|
}
|
||||||
mapping(uint256 => _globalFunds) private globalFunds;
|
mapping(uint256 => _globalFunds) private globalFunds;
|
||||||
|
|
||||||
struct _client{
|
struct _client{
|
||||||
address providerAddress;
|
address providerAddress;
|
||||||
uint256 providerHeight;
|
uint256 providerHeight;
|
||||||
@ -115,13 +115,13 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
uint256 paidUpTo;
|
uint256 paidUpTo;
|
||||||
}
|
}
|
||||||
mapping(address => _client) private clients;
|
mapping(address => _client) private clients;
|
||||||
|
|
||||||
uint256 private currentSchellingRound = 1;
|
uint256 private currentSchellingRound = 1;
|
||||||
|
|
||||||
constructor(address _moduleHandler) public {
|
constructor(address _moduleHandler) public {
|
||||||
/*
|
/*
|
||||||
Install function.
|
Install function.
|
||||||
|
|
||||||
@_moduleHandler Address of the moduleHandler.
|
@_moduleHandler Address of the moduleHandler.
|
||||||
*/
|
*/
|
||||||
super.registerModuleHandler(_moduleHandler);
|
super.registerModuleHandler(_moduleHandler);
|
||||||
@ -129,7 +129,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function configure(announcementType a, uint256 b) external returns(bool) {
|
function configure(announcementType a, uint256 b) external returns(bool) {
|
||||||
/*
|
/*
|
||||||
Configuration of the provider. Can be invited just by the moduleHandler.
|
Configuration of the provider. Can be invited just by the moduleHandler.
|
||||||
|
|
||||||
@a Type of the setting
|
@a Type of the setting
|
||||||
@b value
|
@b value
|
||||||
*/
|
*/
|
||||||
@ -150,7 +150,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function getUserDetails(address addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) {
|
function getUserDetails(address addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) {
|
||||||
/*
|
/*
|
||||||
Collecting the datas of the client.
|
Collecting the datas of the client.
|
||||||
|
|
||||||
@addr Address of the client.
|
@addr Address of the client.
|
||||||
@schellingRound Number of the schelling round. If it is not defined then the current one.
|
@schellingRound Number of the schelling round. If it is not defined then the current one.
|
||||||
@ProviderAddress Address of the provider the one where connected to
|
@ProviderAddress Address of the provider the one where connected to
|
||||||
@ -173,9 +173,9 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
the share from the token emission.
|
the share from the token emission.
|
||||||
In case is a private provider it has to be checked if it has enough connected capital to be able to accept share from the token emission.
|
In case is a private provider it has to be checked if it has enough connected capital to be able to accept share from the token emission.
|
||||||
The provider’s account counts as a capital for the emission as well.
|
The provider’s account counts as a capital for the emission as well.
|
||||||
|
|
||||||
@value amount of the connected capital
|
@value amount of the connected capital
|
||||||
@priv Is the provider private or not?
|
@priv Is the provider private or not?
|
||||||
@bool Gets the share from the token emission.
|
@bool Gets the share from the token emission.
|
||||||
*/
|
*/
|
||||||
if ( priv ) {
|
if ( priv ) {
|
||||||
@ -187,8 +187,8 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
It checks if the provider has enough connected captital to be able to get from the token emission.
|
It checks if the provider has enough connected captital to be able to get from the token emission.
|
||||||
In case the provider is not able to get the share from the token emission then the connected capital will not count to the value of the globalFunds, to the current schelling round.
|
In case the provider is not able to get the share from the token emission then the connected capital will not count to the value of the globalFunds, to the current schelling round.
|
||||||
|
|
||||||
@oldValue old
|
@oldValue old
|
||||||
@newValue new
|
@newValue new
|
||||||
@priv Is the provider private?
|
@priv Is the provider private?
|
||||||
*/
|
*/
|
||||||
@ -205,12 +205,12 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function checkCorrectRate(bool priv, uint8 rate) internal returns(bool) {
|
function checkCorrectRate(bool priv, uint8 rate) internal returns(bool) {
|
||||||
/*
|
/*
|
||||||
Inner function which checks if the amount of interest what is given by the provider is fits to the criteria.
|
Inner function which checks if the amount of interest what is given by the provider is fits to the criteria.
|
||||||
|
|
||||||
@priv Is the provider private or not?
|
@priv Is the provider private or not?
|
||||||
@rate Percentage/rate of the interest
|
@rate Percentage/rate of the interest
|
||||||
@bool Correct or not?
|
@bool Correct or not?
|
||||||
*/
|
*/
|
||||||
return ( ! priv && ( rate >= publicMinRate && rate <= publicMaxRate ) ) ||
|
return ( ! priv && ( rate >= publicMinRate && rate <= publicMaxRate ) ) ||
|
||||||
( priv && ( rate >= privateMinRate && rate <= privateMaxRate ) );
|
( priv && ( rate >= privateMinRate && rate <= privateMaxRate ) );
|
||||||
}
|
}
|
||||||
function createProvider(bool priv, string name, string website, string country, string info, uint8 rate, bool isForRent, address admin) isReady external {
|
function createProvider(bool priv, string name, string website, string country, string info, uint8 rate, bool isForRent, address admin) isReady external {
|
||||||
@ -222,7 +222,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
For opening, has to have enough capital.
|
For opening, has to have enough capital.
|
||||||
All the functions of the provider except of the closing are going to be handled by the admin.
|
All the functions of the provider except of the closing are going to be handled by the admin.
|
||||||
The provider can be start as a rent as well, in this case the isForRent has to be true/correct. In case it runs as a rent the 20% of the profit will belong to the leser and the rest goes to the admin.
|
The provider can be start as a rent as well, in this case the isForRent has to be true/correct. In case it runs as a rent the 20% of the profit will belong to the leser and the rest goes to the admin.
|
||||||
|
|
||||||
@priv Privat szolgaltato e. Is private provider?
|
@priv Privat szolgaltato e. Is private provider?
|
||||||
@name Provider’s name.
|
@name Provider’s name.
|
||||||
@website Provider’s website
|
@website Provider’s website
|
||||||
@ -241,7 +241,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
require( getTokenBalance(msg.sender) >= minFundsForPublic );
|
require( getTokenBalance(msg.sender) >= minFundsForPublic );
|
||||||
}
|
}
|
||||||
require( checkCorrectRate(priv, rate) );
|
require( checkCorrectRate(priv, rate) );
|
||||||
|
|
||||||
providers[msg.sender].currentHeight++;
|
providers[msg.sender].currentHeight++;
|
||||||
uint256 currHeight = providers[msg.sender].currentHeight;
|
uint256 currHeight = providers[msg.sender].currentHeight;
|
||||||
providers[msg.sender].data[currHeight].valid = true;
|
providers[msg.sender].data[currHeight].valid = true;
|
||||||
@ -276,10 +276,10 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
This can only be invited by the provider’s admin.
|
This can only be invited by the provider’s admin.
|
||||||
The emission rate is only valid for the next schelling round for this one it is not.
|
The emission rate is only valid for the next schelling round for this one it is not.
|
||||||
The admin can only be changed by the address of the provider.
|
The admin can only be changed by the address of the provider.
|
||||||
|
|
||||||
@addr Address of the provider.
|
@addr Address of the provider.
|
||||||
@website Website.
|
@website Website.
|
||||||
@admin The new address of the admin. If we do not want to set it then we should enter 0X00.
|
@admin The new address of the admin. If we do not want to set it then we should enter 0X00.
|
||||||
@country Country
|
@country Country
|
||||||
@info Short intro.
|
@info Short intro.
|
||||||
@rate Rate of the emission what will be given to the client.
|
@rate Rate of the emission what will be given to the client.
|
||||||
@ -303,7 +303,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
for the infos of the provider.
|
for the infos of the provider.
|
||||||
In case the height is unknown then the system will use the last known height.
|
In case the height is unknown then the system will use the last known height.
|
||||||
|
|
||||||
@addr Addr of the provider
|
@addr Addr of the provider
|
||||||
@height Height
|
@height Height
|
||||||
@name Name of the provider.
|
@name Name of the provider.
|
||||||
@ -348,7 +348,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function getProviderCurrentSupply(address addr) internal view returns (uint256) {
|
function getProviderCurrentSupply(address addr) internal view returns (uint256) {
|
||||||
/*
|
/*
|
||||||
Inner function for polling the current height and the current quantity of the connected capital of the schelling round.
|
Inner function for polling the current height and the current quantity of the connected capital of the schelling round.
|
||||||
|
|
||||||
@addr Provider’s address.
|
@addr Provider’s address.
|
||||||
@uint256 Amount of the connected capital
|
@uint256 Amount of the connected capital
|
||||||
*/
|
*/
|
||||||
@ -363,7 +363,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
uint256 currHeight = providers[msg.sender].currentHeight;
|
uint256 currHeight = providers[msg.sender].currentHeight;
|
||||||
require( providers[msg.sender].data[currHeight].valid );
|
require( providers[msg.sender].data[currHeight].valid );
|
||||||
require( providers[msg.sender].data[currHeight].paidUpTo == currentSchellingRound );
|
require( providers[msg.sender].data[currHeight].paidUpTo == currentSchellingRound );
|
||||||
|
|
||||||
providers[msg.sender].data[currHeight].valid = false;
|
providers[msg.sender].data[currHeight].valid = false;
|
||||||
providers[msg.sender].data[currHeight].close = currentSchellingRound;
|
providers[msg.sender].data[currHeight].close = currentSchellingRound;
|
||||||
setRightForInterest(getProviderCurrentSupply(msg.sender), 0, providers[msg.sender].data[currHeight].priv);
|
setRightForInterest(getProviderCurrentSupply(msg.sender), 0, providers[msg.sender].data[currHeight].priv);
|
||||||
@ -373,8 +373,8 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Permition of the user to be able to connect to the provider.
|
Permition of the user to be able to connect to the provider.
|
||||||
This can only be invited by the provider’s admin.
|
This can only be invited by the provider’s admin.
|
||||||
With this kind of call only 100 address can be permitted.
|
With this kind of call only 100 address can be permitted.
|
||||||
|
|
||||||
@addr Array of the addresses for whom the connection is allowed.
|
@addr Array of the addresses for whom the connection is allowed.
|
||||||
*/
|
*/
|
||||||
uint256 currHeight = providers[provider].currentHeight;
|
uint256 currHeight = providers[provider].currentHeight;
|
||||||
@ -382,7 +382,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
require( providers[provider].data[currHeight].priv );
|
require( providers[provider].data[currHeight].priv );
|
||||||
require( providers[provider].data[currHeight].admin == msg.sender );
|
require( providers[provider].data[currHeight].admin == msg.sender );
|
||||||
require( addr.length <= 100 );
|
require( addr.length <= 100 );
|
||||||
|
|
||||||
for ( uint256 a=0 ; a<addr.length ; a++ ) {
|
for ( uint256 a=0 ; a<addr.length ; a++ ) {
|
||||||
providers[provider].data[currHeight].allowedUsers[addr[a]] = true;
|
providers[provider].data[currHeight].allowedUsers[addr[a]] = true;
|
||||||
}
|
}
|
||||||
@ -391,8 +391,8 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Disable of the user not to be able to connect to the provider.
|
Disable of the user not to be able to connect to the provider.
|
||||||
It is can called only for the admin of the provider.
|
It is can called only for the admin of the provider.
|
||||||
With this kind of call only 100 address can be permitted.
|
With this kind of call only 100 address can be permitted.
|
||||||
|
|
||||||
@addr Array of the addresses for whom the connection is allowed.
|
@addr Array of the addresses for whom the connection is allowed.
|
||||||
*/
|
*/
|
||||||
uint256 currHeight = providers[provider].currentHeight;
|
uint256 currHeight = providers[provider].currentHeight;
|
||||||
@ -400,7 +400,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
require( providers[provider].data[currHeight].priv );
|
require( providers[provider].data[currHeight].priv );
|
||||||
require( providers[provider].data[currHeight].admin == msg.sender );
|
require( providers[provider].data[currHeight].admin == msg.sender );
|
||||||
require( addr.length <= 100 );
|
require( addr.length <= 100 );
|
||||||
|
|
||||||
for ( uint256 a=0 ; a<addr.length ; a++ ) {
|
for ( uint256 a=0 ; a<addr.length ; a++ ) {
|
||||||
delete providers[provider].data[currHeight].allowedUsers[addr[a]];
|
delete providers[provider].data[currHeight].allowedUsers[addr[a]];
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
If is an active provider then the client can only connect, if address is permitted at the provider (Whitelist).
|
If is an active provider then the client can only connect, if address is permitted at the provider (Whitelist).
|
||||||
At private providers, the number of the client is restricted. If it reaches the limit no further clients are allowed to connect.
|
At private providers, the number of the client is restricted. If it reaches the limit no further clients are allowed to connect.
|
||||||
This process has a transaction fee based on the senders whole token quantity.
|
This process has a transaction fee based on the senders whole token quantity.
|
||||||
|
|
||||||
@provider Address of the provider.
|
@provider Address of the provider.
|
||||||
*/
|
*/
|
||||||
uint256 currHeight = providers[provider].currentHeight;
|
uint256 currHeight = providers[provider].currentHeight;
|
||||||
@ -427,7 +427,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
}
|
}
|
||||||
uint256 bal = getTokenBalance(msg.sender);
|
uint256 bal = getTokenBalance(msg.sender);
|
||||||
require( moduleHandler(moduleHandlerAddress).processTransactionFee(msg.sender, bal) );
|
require( moduleHandler(moduleHandlerAddress).processTransactionFee(msg.sender, bal) );
|
||||||
|
|
||||||
checkFloatingSupply(provider, currHeight, false, bal);
|
checkFloatingSupply(provider, currHeight, false, bal);
|
||||||
providers[provider].data[currHeight].clientsCount++;
|
providers[provider].data[currHeight].clientsCount++;
|
||||||
clients[msg.sender].providerAddress = provider;
|
clients[msg.sender].providerAddress = provider;
|
||||||
@ -455,7 +455,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
} else {
|
} else {
|
||||||
require( clients[msg.sender].paidUpTo == currentSchellingRound );
|
require( clients[msg.sender].paidUpTo == currentSchellingRound );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 bal = getTokenBalance(msg.sender);
|
uint256 bal = getTokenBalance(msg.sender);
|
||||||
if ( ! providerHasClosed ) {
|
if ( ! providerHasClosed ) {
|
||||||
providers[provider].data[currHeight].clientsCount--;
|
providers[provider].data[currHeight].clientsCount--;
|
||||||
@ -472,7 +472,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function checkReward(address addr) public returns (uint256 reward) {
|
function checkReward(address addr) public returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Polling the share from the token emission for clients and for providers.
|
Polling the share from the token emission for clients and for providers.
|
||||||
|
|
||||||
@addr The address want to check.
|
@addr The address want to check.
|
||||||
@reward Accumulated amount.
|
@reward Accumulated amount.
|
||||||
*/
|
*/
|
||||||
@ -494,7 +494,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
In case the client/provider was far behind then it is possible that this function should be called several times to check the total generated schelling rounds and to collect the share.
|
In case the client/provider was far behind then it is possible that this function should be called several times to check the total generated schelling rounds and to collect the share.
|
||||||
If is neither a client nor a provider then the function is not available.
|
If is neither a client nor a provider then the function is not available.
|
||||||
The tokens will be sent to the beneficiary from the address of the provider without any transaction fees.
|
The tokens will be sent to the beneficiary from the address of the provider without any transaction fees.
|
||||||
|
|
||||||
@beneficiary Address of the beneficiary
|
@beneficiary Address of the beneficiary
|
||||||
@limit Quota of the check-rounds.
|
@limit Quota of the check-rounds.
|
||||||
@provider Address of the provider
|
@provider Address of the provider
|
||||||
@ -527,7 +527,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function getClientReward(uint256 limit) internal returns (uint256 reward) {
|
function getClientReward(uint256 limit) internal returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Inner function for the client in order to collect the share from the token emission
|
Inner function for the client in order to collect the share from the token emission
|
||||||
|
|
||||||
@limit Quota of checking the schelling-rounds.
|
@limit Quota of checking the schelling-rounds.
|
||||||
@reward Collected token amount from the checked rounds.
|
@reward Collected token amount from the checked rounds.
|
||||||
*/
|
*/
|
||||||
@ -574,7 +574,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
}
|
}
|
||||||
function getProviderReward(address addr, uint256 limit) internal returns (uint256 providerReward, uint256 adminReward) {
|
function getProviderReward(address addr, uint256 limit) internal returns (uint256 providerReward, uint256 adminReward) {
|
||||||
/*
|
/*
|
||||||
Inner function for the provider in order to collect the share from the token emission
|
Inner function for the provider in order to collect the share from the token emission
|
||||||
@addr Address of the provider.
|
@addr Address of the provider.
|
||||||
@limit Quota of the check-rounds.
|
@limit Quota of the check-rounds.
|
||||||
@providerReward The reward of the provider’s address from the checked rounds.
|
@providerReward The reward of the provider’s address from the checked rounds.
|
||||||
@ -594,7 +594,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
rate = providers[addr].data[currHeight].rateHistory[a].value;
|
rate = providers[addr].data[currHeight].rateHistory[a].value;
|
||||||
}
|
}
|
||||||
if ( rate > 0 ) {
|
if ( rate > 0 ) {
|
||||||
if ( ( a > LTSID && rightForInterest(providers[addr].data[currHeight].supply[LTSID], providers[addr].data[currHeight].priv) ||
|
if ( ( a > LTSID && rightForInterest(providers[addr].data[currHeight].supply[LTSID], providers[addr].data[currHeight].priv) ||
|
||||||
rightForInterest(providers[addr].data[currHeight].supply[a], providers[addr].data[currHeight].priv) ) ) {
|
rightForInterest(providers[addr].data[currHeight].supply[a], providers[addr].data[currHeight].priv) ) ) {
|
||||||
if ( limit > 0 && steps > limit ) {
|
if ( limit > 0 && steps > limit ) {
|
||||||
a--;
|
a--;
|
||||||
@ -636,7 +636,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Inner function for updating the database when some token change has happened.
|
Inner function for updating the database when some token change has happened.
|
||||||
In this case we are checking if despite the changes the provider is still entitled to the token emission. In case the legitimacy changes then the global supply should be set as well.
|
In this case we are checking if despite the changes the provider is still entitled to the token emission. In case the legitimacy changes then the global supply should be set as well.
|
||||||
|
|
||||||
@providerAddress Provider address.
|
@providerAddress Provider address.
|
||||||
@providerHeight Provider height.
|
@providerHeight Provider height.
|
||||||
@neg the change was negative or not
|
@neg the change was negative or not
|
||||||
@ -646,15 +646,15 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
if ( currentSchellingRound != LSID ) {
|
if ( currentSchellingRound != LSID ) {
|
||||||
if ( neg ) {
|
if ( neg ) {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
providers[providerAddress].data[providerHeight].supply[LSID],
|
providers[providerAddress].data[providerHeight].supply[LSID],
|
||||||
providers[providerAddress].data[providerHeight].supply[LSID] - value,
|
providers[providerAddress].data[providerHeight].supply[LSID] - value,
|
||||||
providers[providerAddress].data[providerHeight].priv
|
providers[providerAddress].data[providerHeight].priv
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] = providers[providerAddress].data[providerHeight].supply[LSID] - value;
|
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] = providers[providerAddress].data[providerHeight].supply[LSID] - value;
|
||||||
} else {
|
} else {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
providers[providerAddress].data[providerHeight].supply[LSID],
|
providers[providerAddress].data[providerHeight].supply[LSID],
|
||||||
providers[providerAddress].data[providerHeight].supply[LSID] + value,
|
providers[providerAddress].data[providerHeight].supply[LSID] + value,
|
||||||
providers[providerAddress].data[providerHeight].priv
|
providers[providerAddress].data[providerHeight].priv
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] = providers[providerAddress].data[providerHeight].supply[LSID] + value;
|
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] = providers[providerAddress].data[providerHeight].supply[LSID] + value;
|
||||||
@ -663,15 +663,15 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
} else {
|
} else {
|
||||||
if ( neg ) {
|
if ( neg ) {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
getProviderCurrentSupply(providerAddress),
|
getProviderCurrentSupply(providerAddress),
|
||||||
getProviderCurrentSupply(providerAddress) - value,
|
getProviderCurrentSupply(providerAddress) - value,
|
||||||
providers[providerAddress].data[providerHeight].priv
|
providers[providerAddress].data[providerHeight].priv
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] -= value;
|
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] -= value;
|
||||||
} else {
|
} else {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
getProviderCurrentSupply(providerAddress),
|
getProviderCurrentSupply(providerAddress),
|
||||||
getProviderCurrentSupply(providerAddress) + value,
|
getProviderCurrentSupply(providerAddress) + value,
|
||||||
providers[providerAddress].data[providerHeight].priv
|
providers[providerAddress].data[providerHeight].priv
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] += value;
|
providers[providerAddress].data[providerHeight].supply[currentSchellingRound] += value;
|
||||||
@ -683,7 +683,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
Inner function for updating the database in case token change has happened.
|
Inner function for updating the database in case token change has happened.
|
||||||
In this case we check if the provider despite the changes is still entitled to the token emission.
|
In this case we check if the provider despite the changes is still entitled to the token emission.
|
||||||
We just call this only if the private provider and it’s own capital bears emission.
|
We just call this only if the private provider and it’s own capital bears emission.
|
||||||
|
|
||||||
@providerAddress Provider address.
|
@providerAddress Provider address.
|
||||||
@providerHeight Provider height.
|
@providerHeight Provider height.
|
||||||
@neg Was the change negative?
|
@neg Was the change negative?
|
||||||
@ -693,15 +693,15 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
if ( currentSchellingRound != LSID ) {
|
if ( currentSchellingRound != LSID ) {
|
||||||
if ( neg ) {
|
if ( neg ) {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[LSID],
|
providers[providerAddress].data[providerHeight].ownSupply[LSID],
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[LSID] - value,
|
providers[providerAddress].data[providerHeight].ownSupply[LSID] - value,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] = providers[providerAddress].data[providerHeight].ownSupply[LSID] - value;
|
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] = providers[providerAddress].data[providerHeight].ownSupply[LSID] - value;
|
||||||
} else {
|
} else {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[LSID],
|
providers[providerAddress].data[providerHeight].ownSupply[LSID],
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[LSID] + value,
|
providers[providerAddress].data[providerHeight].ownSupply[LSID] + value,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] = providers[providerAddress].data[providerHeight].ownSupply[LSID] + value;
|
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] = providers[providerAddress].data[providerHeight].ownSupply[LSID] + value;
|
||||||
@ -710,15 +710,15 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
} else {
|
} else {
|
||||||
if ( neg ) {
|
if ( neg ) {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
getProviderCurrentSupply(providerAddress),
|
getProviderCurrentSupply(providerAddress),
|
||||||
getProviderCurrentSupply(providerAddress) - value,
|
getProviderCurrentSupply(providerAddress) - value,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] -= value;
|
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] -= value;
|
||||||
} else {
|
} else {
|
||||||
setRightForInterest(
|
setRightForInterest(
|
||||||
getProviderCurrentSupply(providerAddress),
|
getProviderCurrentSupply(providerAddress),
|
||||||
getProviderCurrentSupply(providerAddress) + value,
|
getProviderCurrentSupply(providerAddress) + value,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] += value;
|
providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] += value;
|
||||||
@ -728,7 +728,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function TEMath(uint256 a, uint256 b, bool neg) internal returns (uint256) {
|
function TEMath(uint256 a, uint256 b, bool neg) internal returns (uint256) {
|
||||||
/*
|
/*
|
||||||
Inner function for the changes of the numbers
|
Inner function for the changes of the numbers
|
||||||
|
|
||||||
@a First number
|
@a First number
|
||||||
@b 2nd number
|
@b 2nd number
|
||||||
@neg Operation with numbers. If it is TRUE then subtraction, if it is FALSE then addition.
|
@neg Operation with numbers. If it is TRUE then subtraction, if it is FALSE then addition.
|
||||||
@ -740,7 +740,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Inner function for perceiving the changes of the balance and updating the database.
|
Inner function for perceiving the changes of the balance and updating the database.
|
||||||
If the address is a provider and the balance is decreasing than can not let it go under the minimum level.
|
If the address is a provider and the balance is decreasing than can not let it go under the minimum level.
|
||||||
|
|
||||||
@addr The address where the change happened.
|
@addr The address where the change happened.
|
||||||
@value Rate of the change.
|
@value Rate of the change.
|
||||||
@neg ype of the change. If it is TRUE then the balance has been decreased if it is FALSE then it has been increased.
|
@neg ype of the change. If it is TRUE then the balance has been decreased if it is FALSE then it has been increased.
|
||||||
@ -771,9 +771,9 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function getTokenBalance(address addr) internal returns (uint256 balance) {
|
function getTokenBalance(address addr) internal returns (uint256 balance) {
|
||||||
/*
|
/*
|
||||||
Inner function in order to poll the token balance of the address.
|
Inner function in order to poll the token balance of the address.
|
||||||
|
|
||||||
@addr Address
|
@addr Address
|
||||||
|
|
||||||
@balance Balance of the address.
|
@balance Balance of the address.
|
||||||
*/
|
*/
|
||||||
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
||||||
@ -783,7 +783,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function checkICO() internal returns (bool isICO) {
|
function checkICO() internal returns (bool isICO) {
|
||||||
/*
|
/*
|
||||||
Inner function to check the ICO status.
|
Inner function to check the ICO status.
|
||||||
|
|
||||||
@isICO Is the ICO in process or not?
|
@isICO Is the ICO in process or not?
|
||||||
*/
|
*/
|
||||||
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
||||||
|
@ -1,278 +1,278 @@
|
|||||||
pragma solidity ^0.4.11;
|
pragma solidity ^0.4.11;
|
||||||
|
|
||||||
import "./announcementTypes.sol";
|
import "./announcementTypes.sol";
|
||||||
import "./module.sol";
|
import "./module.sol";
|
||||||
import "./moduleHandler.sol";
|
import "./moduleHandler.sol";
|
||||||
import "./safeMath.sol";
|
import "./safeMath.sol";
|
||||||
|
|
||||||
contract publisher is announcementTypes, module, safeMath {
|
contract publisher is announcementTypes, module, safeMath {
|
||||||
/*
|
/*
|
||||||
module callbacks
|
module callbacks
|
||||||
*/
|
*/
|
||||||
function transferEvent(address from, address to, uint256 value) external returns (bool success) {
|
function transferEvent(address from, address to, uint256 value) external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Transaction completed. This function is available only for moduleHandler
|
Transaction completed. This function is available only for moduleHandler
|
||||||
If a transaction is carried out from or to an address which participated in the objection of an announcement, its objection purport is automatically set
|
If a transaction is carried out from or to an address which participated in the objection of an announcement, its objection purport is automatically set
|
||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
uint256 announcementID;
|
uint256 announcementID;
|
||||||
uint256 a;
|
uint256 a;
|
||||||
// need reverse lookup
|
// need reverse lookup
|
||||||
for ( a=0 ; a<opponents[from].length ; a++ ) {
|
for ( a=0 ; a<opponents[from].length ; a++ ) {
|
||||||
announcementID = opponents[msg.sender][a];
|
announcementID = opponents[msg.sender][a];
|
||||||
if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) {
|
if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) {
|
||||||
announcements[announcementID].oppositionWeight = safeSub(announcements[a].oppositionWeight, value);
|
announcements[announcementID].oppositionWeight = safeSub(announcements[a].oppositionWeight, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ( a=0 ; a<opponents[to].length ; a++ ) {
|
for ( a=0 ; a<opponents[to].length ; a++ ) {
|
||||||
announcementID = opponents[msg.sender][a];
|
announcementID = opponents[msg.sender][a];
|
||||||
if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) {
|
if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) {
|
||||||
announcements[announcementID].oppositionWeight = safeAdd(announcements[a].oppositionWeight, value);
|
announcements[announcementID].oppositionWeight = safeAdd(announcements[a].oppositionWeight, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Pool
|
Pool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint256 public minAnnouncementDelay = 40320;
|
uint256 public minAnnouncementDelay = 40320;
|
||||||
uint256 public minAnnouncementDelayOnICO = 17280;
|
uint256 public minAnnouncementDelayOnICO = 17280;
|
||||||
uint8 public oppositeRate = 33;
|
uint8 public oppositeRate = 33;
|
||||||
|
|
||||||
struct announcements_s {
|
struct announcements_s {
|
||||||
announcementType Type;
|
announcementType Type;
|
||||||
uint256 start;
|
uint256 start;
|
||||||
uint256 end;
|
uint256 end;
|
||||||
bool open;
|
bool open;
|
||||||
string announcement;
|
string announcement;
|
||||||
string link;
|
string link;
|
||||||
bool oppositable;
|
bool oppositable;
|
||||||
uint256 oppositionWeight;
|
uint256 oppositionWeight;
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
string _str;
|
string _str;
|
||||||
uint256 _uint;
|
uint256 _uint;
|
||||||
address _addr;
|
address _addr;
|
||||||
}
|
}
|
||||||
mapping(uint256 => announcements_s) public announcements;
|
mapping(uint256 => announcements_s) public announcements;
|
||||||
uint256 announcementsLength = 1;
|
uint256 announcementsLength = 1;
|
||||||
|
|
||||||
mapping (address => uint256[]) public opponents;
|
mapping (address => uint256[]) public opponents;
|
||||||
|
|
||||||
constructor(address moduleHandler) public {
|
constructor(address moduleHandler) public {
|
||||||
/*
|
/*
|
||||||
Installation function. The installer will be registered in the admin list automatically
|
Installation function. The installer will be registered in the admin list automatically
|
||||||
|
|
||||||
@moduleHandler Address of moduleHandler
|
@moduleHandler Address of moduleHandler
|
||||||
*/
|
*/
|
||||||
super.registerModuleHandler(moduleHandler);
|
super.registerModuleHandler(moduleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Announcements(uint256 id) public view returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string memory Announcement, string memory Link, bool Opposited, string memory _str, uint256 _uint, address _addr) {
|
function Announcements(uint256 id) public view returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string memory Announcement, string memory Link, bool Opposited, string memory _str, uint256 _uint, address _addr) {
|
||||||
/*
|
/*
|
||||||
Announcement data query
|
Announcement data query
|
||||||
|
|
||||||
@id Its identification
|
@id Its identification
|
||||||
|
|
||||||
@Type Subject of announcement
|
@Type Subject of announcement
|
||||||
@Start Height of announcement block
|
@Start Height of announcement block
|
||||||
@End Planned completion of announcement
|
@End Planned completion of announcement
|
||||||
@Closed Closed or not
|
@Closed Closed or not
|
||||||
@Announcement Announcement text
|
@Announcement Announcement text
|
||||||
@Link Link perhaps to a Forum
|
@Link Link perhaps to a Forum
|
||||||
@Opposited Objected or not
|
@Opposited Objected or not
|
||||||
@_str Text value
|
@_str Text value
|
||||||
@_uint Number value
|
@_uint Number value
|
||||||
@_addr Address value
|
@_addr Address value
|
||||||
*/
|
*/
|
||||||
Type = uint256(announcements[id].Type);
|
Type = uint256(announcements[id].Type);
|
||||||
Start = announcements[id].start;
|
Start = announcements[id].start;
|
||||||
End = announcements[id].end;
|
End = announcements[id].end;
|
||||||
Closed = ! announcements[id].open;
|
Closed = ! announcements[id].open;
|
||||||
Announcement = announcements[id].announcement;
|
Announcement = announcements[id].announcement;
|
||||||
Link = announcements[id].link;
|
Link = announcements[id].link;
|
||||||
if ( checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) {
|
if ( checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) {
|
||||||
Opposited = true;
|
Opposited = true;
|
||||||
}
|
}
|
||||||
_str = announcements[id]._str;
|
_str = announcements[id]._str;
|
||||||
_uint = announcements[id]._uint;
|
_uint = announcements[id]._uint;
|
||||||
_addr = announcements[id]._addr;
|
_addr = announcements[id]._addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkOpposited(uint256 weight, bool oppositable) public view returns (bool success) {
|
function checkOpposited(uint256 weight, bool oppositable) public view returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Veto check
|
Veto check
|
||||||
|
|
||||||
@weight Purport of objections so far
|
@weight Purport of objections so far
|
||||||
@oppositable Opposable at all
|
@oppositable Opposable at all
|
||||||
|
|
||||||
@success Opposed or not
|
@success Opposed or not
|
||||||
*/
|
*/
|
||||||
if ( ! oppositable ) { return false; }
|
if ( ! oppositable ) { return false; }
|
||||||
(bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
|
(bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
|
||||||
require( _success );
|
require( _success );
|
||||||
return _amount * oppositeRate / 100 > weight;
|
return _amount * oppositeRate / 100 > weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
function newAnnouncement(announcementType Type, string Announcement, string Link, bool Oppositable, string _str, uint256 _uint, address _addr) onlyOwner external {
|
function newAnnouncement(announcementType Type, string Announcement, string Link, bool Oppositable, string _str, uint256 _uint, address _addr) onlyOwner external {
|
||||||
/*
|
/*
|
||||||
New announcement. Can be called only by those in the admin list
|
New announcement. Can be called only by those in the admin list
|
||||||
|
|
||||||
@Type Topic of announcement
|
@Type Topic of announcement
|
||||||
@Start height of announcement block
|
@Start height of announcement block
|
||||||
@End planned completion of announcement
|
@End planned completion of announcement
|
||||||
@Closed Completed or not
|
@Closed Completed or not
|
||||||
@Announcement Announcement text
|
@Announcement Announcement text
|
||||||
@Link link to a Forum
|
@Link link to a Forum
|
||||||
@Opposition opposed or not
|
@Opposition opposed or not
|
||||||
@_str text box
|
@_str text box
|
||||||
@_uint number box
|
@_uint number box
|
||||||
@_addr address box
|
@_addr address box
|
||||||
*/
|
*/
|
||||||
announcementsLength++;
|
announcementsLength++;
|
||||||
announcements[announcementsLength].Type = Type;
|
announcements[announcementsLength].Type = Type;
|
||||||
announcements[announcementsLength].start = block.number;
|
announcements[announcementsLength].start = block.number;
|
||||||
if ( checkICO() ) {
|
if ( checkICO() ) {
|
||||||
announcements[announcementsLength].end = block.number + minAnnouncementDelayOnICO;
|
announcements[announcementsLength].end = block.number + minAnnouncementDelayOnICO;
|
||||||
} else {
|
} else {
|
||||||
announcements[announcementsLength].end = block.number + minAnnouncementDelay;
|
announcements[announcementsLength].end = block.number + minAnnouncementDelay;
|
||||||
}
|
}
|
||||||
announcements[announcementsLength].open = true;
|
announcements[announcementsLength].open = true;
|
||||||
announcements[announcementsLength].announcement = Announcement;
|
announcements[announcementsLength].announcement = Announcement;
|
||||||
announcements[announcementsLength].link = Link;
|
announcements[announcementsLength].link = Link;
|
||||||
announcements[announcementsLength].oppositable = Oppositable;
|
announcements[announcementsLength].oppositable = Oppositable;
|
||||||
announcements[announcementsLength].oppositionWeight = 0;
|
announcements[announcementsLength].oppositionWeight = 0;
|
||||||
announcements[announcementsLength].result = false;
|
announcements[announcementsLength].result = false;
|
||||||
announcements[announcementsLength]._str = _str;
|
announcements[announcementsLength]._str = _str;
|
||||||
announcements[announcementsLength]._uint = _uint;
|
announcements[announcementsLength]._uint = _uint;
|
||||||
announcements[announcementsLength]._addr = _addr;
|
announcements[announcementsLength]._addr = _addr;
|
||||||
emit ENewAnnouncement(announcementsLength, Type);
|
emit ENewAnnouncement(announcementsLength, Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeAnnouncement(uint256 id) onlyOwner external {
|
function closeAnnouncement(uint256 id) onlyOwner external {
|
||||||
/*
|
/*
|
||||||
Close announcement. It can be closed only by those in the admin list. Windup is allowed only after the announcement is completed.
|
Close announcement. It can be closed only by those in the admin list. Windup is allowed only after the announcement is completed.
|
||||||
|
|
||||||
@id Announcement identification
|
@id Announcement identification
|
||||||
*/
|
*/
|
||||||
require( announcements[id].open && announcements[id].end < block.number );
|
require( announcements[id].open && announcements[id].end < block.number );
|
||||||
if ( ! checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) {
|
if ( ! checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) {
|
||||||
announcements[id].result = true;
|
announcements[id].result = true;
|
||||||
if ( announcements[id].Type == announcementType.newModule ) {
|
if ( announcements[id].Type == announcementType.newModule ) {
|
||||||
require( moduleHandler(moduleHandlerAddress).newModule(announcements[id]._str, announcements[id]._addr, true, true) );
|
require( moduleHandler(moduleHandlerAddress).newModule(announcements[id]._str, announcements[id]._addr, true, true) );
|
||||||
} else if ( announcements[id].Type == announcementType.dropModule ) {
|
} else if ( announcements[id].Type == announcementType.dropModule ) {
|
||||||
require( moduleHandler(moduleHandlerAddress).dropModule(announcements[id]._str, true) );
|
require( moduleHandler(moduleHandlerAddress).dropModule(announcements[id]._str, true) );
|
||||||
} else if ( announcements[id].Type == announcementType.replaceModule ) {
|
} else if ( announcements[id].Type == announcementType.replaceModule ) {
|
||||||
require( moduleHandler(moduleHandlerAddress).replaceModule(announcements[id]._str, announcements[id]._addr, true) );
|
require( moduleHandler(moduleHandlerAddress).replaceModule(announcements[id]._str, announcements[id]._addr, true) );
|
||||||
} else if ( announcements[id].Type == announcementType.replaceModuleHandler) {
|
} else if ( announcements[id].Type == announcementType.replaceModuleHandler) {
|
||||||
require( moduleHandler(moduleHandlerAddress).replaceModuleHandler(announcements[id]._addr) );
|
require( moduleHandler(moduleHandlerAddress).replaceModuleHandler(announcements[id]._addr) );
|
||||||
} else if ( announcements[id].Type == announcementType.transactionFeeRate ||
|
} else if ( announcements[id].Type == announcementType.transactionFeeRate ||
|
||||||
announcements[id].Type == announcementType.transactionFeeMin ||
|
announcements[id].Type == announcementType.transactionFeeMin ||
|
||||||
announcements[id].Type == announcementType.transactionFeeMax ||
|
announcements[id].Type == announcementType.transactionFeeMax ||
|
||||||
announcements[id].Type == announcementType.transactionFeeBurn ) {
|
announcements[id].Type == announcementType.transactionFeeBurn ) {
|
||||||
require( moduleHandler(moduleHandlerAddress).configureModule("token", announcements[id].Type, announcements[id]._uint) );
|
require( moduleHandler(moduleHandlerAddress).configureModule("token", announcements[id].Type, announcements[id]._uint) );
|
||||||
} else if ( announcements[id].Type == announcementType.providerPublicFunds ||
|
} else if ( announcements[id].Type == announcementType.providerPublicFunds ||
|
||||||
announcements[id].Type == announcementType.providerPrivateFunds ||
|
announcements[id].Type == announcementType.providerPrivateFunds ||
|
||||||
announcements[id].Type == announcementType.providerPrivateClientLimit ||
|
announcements[id].Type == announcementType.providerPrivateClientLimit ||
|
||||||
announcements[id].Type == announcementType.providerPublicMinRate ||
|
announcements[id].Type == announcementType.providerPublicMinRate ||
|
||||||
announcements[id].Type == announcementType.providerPublicMaxRate ||
|
announcements[id].Type == announcementType.providerPublicMaxRate ||
|
||||||
announcements[id].Type == announcementType.providerPrivateMinRate ||
|
announcements[id].Type == announcementType.providerPrivateMinRate ||
|
||||||
announcements[id].Type == announcementType.providerPrivateMaxRate ||
|
announcements[id].Type == announcementType.providerPrivateMaxRate ||
|
||||||
announcements[id].Type == announcementType.providerGasProtect ||
|
announcements[id].Type == announcementType.providerGasProtect ||
|
||||||
announcements[id].Type == announcementType.providerInterestMinFunds ||
|
announcements[id].Type == announcementType.providerInterestMinFunds ||
|
||||||
announcements[id].Type == announcementType.providerRentRate ) {
|
announcements[id].Type == announcementType.providerRentRate ) {
|
||||||
require( moduleHandler(moduleHandlerAddress).configureModule("provider", announcements[id].Type, announcements[id]._uint) );
|
require( moduleHandler(moduleHandlerAddress).configureModule("provider", announcements[id].Type, announcements[id]._uint) );
|
||||||
} else if ( announcements[id].Type == announcementType.schellingRoundBlockDelay ||
|
} else if ( announcements[id].Type == announcementType.schellingRoundBlockDelay ||
|
||||||
announcements[id].Type == announcementType.schellingCheckRounds ||
|
announcements[id].Type == announcementType.schellingCheckRounds ||
|
||||||
announcements[id].Type == announcementType.schellingCheckAboves ||
|
announcements[id].Type == announcementType.schellingCheckAboves ||
|
||||||
announcements[id].Type == announcementType.schellingRate ) {
|
announcements[id].Type == announcementType.schellingRate ) {
|
||||||
require( moduleHandler(moduleHandlerAddress).configureModule("schelling", announcements[id].Type, announcements[id]._uint) );
|
require( moduleHandler(moduleHandlerAddress).configureModule("schelling", announcements[id].Type, announcements[id]._uint) );
|
||||||
} else if ( announcements[id].Type == announcementType.publisherMinAnnouncementDelay) {
|
} else if ( announcements[id].Type == announcementType.publisherMinAnnouncementDelay) {
|
||||||
minAnnouncementDelay = announcements[id]._uint;
|
minAnnouncementDelay = announcements[id]._uint;
|
||||||
} else if ( announcements[id].Type == announcementType.publisherOppositeRate) {
|
} else if ( announcements[id].Type == announcementType.publisherOppositeRate) {
|
||||||
oppositeRate = uint8(announcements[id]._uint);
|
oppositeRate = uint8(announcements[id]._uint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
announcements[id].end = block.number;
|
announcements[id].end = block.number;
|
||||||
announcements[id].open = false;
|
announcements[id].open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function oppositeAnnouncement(uint256 id) external {
|
function oppositeAnnouncement(uint256 id) external {
|
||||||
/*
|
/*
|
||||||
Opposition of announcement
|
Opposition of announcement
|
||||||
If announcement is opposable, anyone owning a token can oppose it
|
If announcement is opposable, anyone owning a token can oppose it
|
||||||
Opposition is automatically with the total amount of tokens
|
Opposition is automatically with the total amount of tokens
|
||||||
If the quantity of his tokens changes, the purport of his opposition changes automatically
|
If the quantity of his tokens changes, the purport of his opposition changes automatically
|
||||||
The prime time is the windup of the announcement, because this is the moment when the number of tokens in opposition are counted.
|
The prime time is the windup of the announcement, because this is the moment when the number of tokens in opposition are counted.
|
||||||
One address is entitled to be in oppositon only once. An opposition cannot be withdrawn.
|
One address is entitled to be in oppositon only once. An opposition cannot be withdrawn.
|
||||||
Running announcements can be opposed only.
|
Running announcements can be opposed only.
|
||||||
|
|
||||||
@id Announcement identification
|
@id Announcement identification
|
||||||
*/
|
*/
|
||||||
uint256 newArrayID = 0;
|
uint256 newArrayID = 0;
|
||||||
bool foundEmptyArrayID = false;
|
bool foundEmptyArrayID = false;
|
||||||
require( announcements[id].open );
|
require( announcements[id].open );
|
||||||
require( announcements[id].oppositable );
|
require( announcements[id].oppositable );
|
||||||
for ( uint256 a=0 ; a<opponents[msg.sender].length ; a++ ) {
|
for ( uint256 a=0 ; a<opponents[msg.sender].length ; a++ ) {
|
||||||
require( opponents[msg.sender][a] != id );
|
require( opponents[msg.sender][a] != id );
|
||||||
if ( ! announcements[opponents[msg.sender][a]].open) {
|
if ( ! announcements[opponents[msg.sender][a]].open) {
|
||||||
delete opponents[msg.sender][a];
|
delete opponents[msg.sender][a];
|
||||||
if ( ! foundEmptyArrayID ) {
|
if ( ! foundEmptyArrayID ) {
|
||||||
foundEmptyArrayID = true;
|
foundEmptyArrayID = true;
|
||||||
newArrayID = a;
|
newArrayID = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! foundEmptyArrayID ) {
|
if ( ! foundEmptyArrayID ) {
|
||||||
foundEmptyArrayID = true;
|
foundEmptyArrayID = true;
|
||||||
newArrayID = a;
|
newArrayID = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(msg.sender);
|
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
require( _balance > 0);
|
require( _balance > 0);
|
||||||
if ( foundEmptyArrayID ) {
|
if ( foundEmptyArrayID ) {
|
||||||
opponents[msg.sender][newArrayID] = id;
|
opponents[msg.sender][newArrayID] = id;
|
||||||
} else {
|
} else {
|
||||||
opponents[msg.sender].push(id);
|
opponents[msg.sender].push(id);
|
||||||
}
|
}
|
||||||
announcements[id].oppositionWeight += _balance;
|
announcements[id].oppositionWeight += _balance;
|
||||||
emit EOppositeAnnouncement(id, msg.sender, _balance);
|
emit EOppositeAnnouncement(id, msg.sender, _balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
function invalidateAnnouncement(uint256 id) onlyOwner external {
|
function invalidateAnnouncement(uint256 id) onlyOwner external {
|
||||||
/*
|
/*
|
||||||
Withdraw announcement. Only those in the admin list can withdraw it.
|
Withdraw announcement. Only those in the admin list can withdraw it.
|
||||||
|
|
||||||
@id Announcement identification
|
@id Announcement identification
|
||||||
*/
|
*/
|
||||||
require( announcements[id].open );
|
require( announcements[id].open );
|
||||||
announcements[id].end = block.number;
|
announcements[id].end = block.number;
|
||||||
announcements[id].open = false;
|
announcements[id].open = false;
|
||||||
emit EInvalidateAnnouncement(id);
|
emit EInvalidateAnnouncement(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier onlyOwner() {
|
modifier onlyOwner() {
|
||||||
/*
|
/*
|
||||||
Only the owner is allowed to call it.
|
Only the owner is allowed to call it.
|
||||||
*/
|
*/
|
||||||
require( moduleHandler(moduleHandlerAddress).owners(msg.sender) );
|
require( moduleHandler(moduleHandlerAddress).owners(msg.sender) );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkICO() internal returns (bool isICO) {
|
function checkICO() internal returns (bool isICO) {
|
||||||
/*
|
/*
|
||||||
Inner function to check the ICO status.
|
Inner function to check the ICO status.
|
||||||
@bool Is the ICO in process or not?
|
@bool Is the ICO in process or not?
|
||||||
*/
|
*/
|
||||||
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
||||||
require( _success );
|
require( _success );
|
||||||
return _isICO;
|
return _isICO;
|
||||||
}
|
}
|
||||||
|
|
||||||
event ENewAnnouncement(uint256 id, announcementType typ);
|
event ENewAnnouncement(uint256 id, announcementType typ);
|
||||||
event EOppositeAnnouncement(uint256 id, address addr, uint256 value);
|
event EOppositeAnnouncement(uint256 id, address addr, uint256 value);
|
||||||
event EInvalidateAnnouncement(uint256 id);
|
event EInvalidateAnnouncement(uint256 id);
|
||||||
event ECloseAnnouncement(uint256 id);
|
event ECloseAnnouncement(uint256 id);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ contract safeMath {
|
|||||||
/*
|
/*
|
||||||
Biztonsagos hozzadas. Tulcsordulas elleni vedelem.
|
Biztonsagos hozzadas. Tulcsordulas elleni vedelem.
|
||||||
A vegeredmeny nem lehet kevesebb mint az @a, ha igen megall a kod.
|
A vegeredmeny nem lehet kevesebb mint az @a, ha igen megall a kod.
|
||||||
|
|
||||||
@a Amihez hozzaadni kell
|
@a Amihez hozzaadni kell
|
||||||
@b Amennyit hozzaadni kell.
|
@b Amennyit hozzaadni kell.
|
||||||
@uint256 Vegeredmeny.
|
@uint256 Vegeredmeny.
|
||||||
@ -15,12 +15,12 @@ contract safeMath {
|
|||||||
}
|
}
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeSub(uint256 a, uint256 b) internal returns(uint256) {
|
function safeSub(uint256 a, uint256 b) internal returns(uint256) {
|
||||||
/*
|
/*
|
||||||
Biztonsagos kivonas. Tulcsordulas elleni vedelem.
|
Biztonsagos kivonas. Tulcsordulas elleni vedelem.
|
||||||
A vegeredmeny nem lehet tobb mint az @a, ha igen megall a kod.
|
A vegeredmeny nem lehet tobb mint az @a, ha igen megall a kod.
|
||||||
|
|
||||||
@a Amibol kivonni kell.
|
@a Amibol kivonni kell.
|
||||||
@b Amennyit kivonni kell.
|
@b Amennyit kivonni kell.
|
||||||
@uint256 Vegeredmeny.
|
@uint256 Vegeredmeny.
|
||||||
|
@ -141,9 +141,9 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
}
|
}
|
||||||
function transferEvent(address from, address to, uint256 value) external returns (bool) {
|
function transferEvent(address from, address to, uint256 value) external returns (bool) {
|
||||||
/*
|
/*
|
||||||
Transaction completed. This function can be called only by the ModuleHandler.
|
Transaction completed. This function can be called only by the ModuleHandler.
|
||||||
If this contract is the receiver, the amount will be added to the prize pool of the current round.
|
If this contract is the receiver, the amount will be added to the prize pool of the current round.
|
||||||
|
|
||||||
@from From who
|
@from From who
|
||||||
@to To who
|
@to To who
|
||||||
@value Amount
|
@value Amount
|
||||||
@ -160,7 +160,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
(bool _success, bool _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -175,7 +175,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
require( db.setFunds(addr, amount) );
|
require( db.setFunds(addr, amount) );
|
||||||
}
|
}
|
||||||
function setVoter(address owner, _voter memory voter) internal {
|
function setVoter(address owner, _voter memory voter) internal {
|
||||||
require( db.setVoter(owner,
|
require( db.setVoter(owner,
|
||||||
voter.roundID,
|
voter.roundID,
|
||||||
voter.hash,
|
voter.hash,
|
||||||
voter.status,
|
voter.status,
|
||||||
@ -189,7 +189,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
return _voter(b, c, d, e, f);
|
return _voter(b, c, d, e, f);
|
||||||
}
|
}
|
||||||
function setRound(uint256 id, _rounds memory round) internal {
|
function setRound(uint256 id, _rounds memory round) internal {
|
||||||
require( db.setRound(id,
|
require( db.setRound(id,
|
||||||
round.totalAboveWeight,
|
round.totalAboveWeight,
|
||||||
round.totalBelowWeight,
|
round.totalBelowWeight,
|
||||||
round.reward,
|
round.reward,
|
||||||
@ -250,7 +250,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
constructor(address _moduleHandler, address _db, bool _forReplace) public {
|
constructor(address _moduleHandler, address _db, bool _forReplace) public {
|
||||||
/*
|
/*
|
||||||
Installation function.
|
Installation function.
|
||||||
|
|
||||||
@_moduleHandler Address of ModuleHandler.
|
@_moduleHandler Address of ModuleHandler.
|
||||||
@_db Address of the database.
|
@_db Address of the database.
|
||||||
@_forReplace This address will be replaced with the old one or not.
|
@_forReplace This address will be replaced with the old one or not.
|
||||||
@ -265,7 +265,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function configure(announcementType a, uint256 b) external returns(bool) {
|
function configure(announcementType a, uint256 b) external returns(bool) {
|
||||||
/*
|
/*
|
||||||
Can be called only by the ModuleHandler.
|
Can be called only by the ModuleHandler.
|
||||||
|
|
||||||
@a Sort of configuration
|
@a Sort of configuration
|
||||||
@b Value
|
@b Value
|
||||||
*/
|
*/
|
||||||
@ -280,22 +280,22 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function prepareVote(bytes32 votehash, uint256 roundID) isReady noContract external {
|
function prepareVote(bytes32 votehash, uint256 roundID) isReady noContract external {
|
||||||
/*
|
/*
|
||||||
Initializing manual vote.
|
Initializing manual vote.
|
||||||
Only the hash of vote will be sent. (Envelope sending).
|
Only the hash of vote will be sent. (Envelope sending).
|
||||||
The address must be in default state, that is there are no vote in progress.
|
The address must be in default state, that is there are no vote in progress.
|
||||||
Votes can be sent only on the actually Schelling round.
|
Votes can be sent only on the actually Schelling round.
|
||||||
|
|
||||||
@votehash Hash of the vote
|
@votehash Hash of the vote
|
||||||
@roundID Number of Schelling round
|
@roundID Number of Schelling round
|
||||||
*/
|
*/
|
||||||
nextRound();
|
nextRound();
|
||||||
|
|
||||||
uint256 currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
schellingVars._rounds memory round = getRound(currentRound);
|
schellingVars._rounds memory round = getRound(currentRound);
|
||||||
_voter memory voter;
|
_voter memory voter;
|
||||||
uint256 funds;
|
uint256 funds;
|
||||||
|
|
||||||
require( roundID == currentRound );
|
require( roundID == currentRound );
|
||||||
|
|
||||||
voter = getVoter(msg.sender);
|
voter = getVoter(msg.sender);
|
||||||
funds = getFunds(msg.sender);
|
funds = getFunds(msg.sender);
|
||||||
|
|
||||||
@ -304,10 +304,10 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
voter.roundID = currentRound;
|
voter.roundID = currentRound;
|
||||||
voter.hash = votehash;
|
voter.hash = votehash;
|
||||||
voter.status = voterStatus.afterPrepareVote;
|
voter.status = voterStatus.afterPrepareVote;
|
||||||
|
|
||||||
setVoter(msg.sender, voter);
|
setVoter(msg.sender, voter);
|
||||||
round.voted = true;
|
round.voted = true;
|
||||||
|
|
||||||
setRound(currentRound, round);
|
setRound(currentRound, round);
|
||||||
}
|
}
|
||||||
function sendVote(string vote) isReady noContract external {
|
function sendVote(string vote) isReady noContract external {
|
||||||
@ -318,21 +318,21 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
If the vote invalid, the deposit will be lost.
|
If the vote invalid, the deposit will be lost.
|
||||||
If the “envelope” was opened later than 1,5 Schelling round, the vote is automatically invalid, and deposit can be lost.
|
If the “envelope” was opened later than 1,5 Schelling round, the vote is automatically invalid, and deposit can be lost.
|
||||||
Lost deposits will be 100% burned.
|
Lost deposits will be 100% burned.
|
||||||
|
|
||||||
@vote Hash of the content of the vote.
|
@vote Hash of the content of the vote.
|
||||||
*/
|
*/
|
||||||
nextRound();
|
nextRound();
|
||||||
|
|
||||||
uint256 currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
_rounds memory round;
|
_rounds memory round;
|
||||||
_voter memory voter;
|
_voter memory voter;
|
||||||
uint256 funds;
|
uint256 funds;
|
||||||
|
|
||||||
bool lostEverything;
|
bool lostEverything;
|
||||||
voter = getVoter(msg.sender);
|
voter = getVoter(msg.sender);
|
||||||
round = getRound(voter.roundID);
|
round = getRound(voter.roundID);
|
||||||
funds = getFunds(msg.sender);
|
funds = getFunds(msg.sender);
|
||||||
|
|
||||||
require( voter.status == voterStatus.afterPrepareVote );
|
require( voter.status == voterStatus.afterPrepareVote );
|
||||||
require( voter.roundID < currentRound );
|
require( voter.roundID < currentRound );
|
||||||
if ( keccak256(bytes(vote)) == voter.hash ) {
|
if ( keccak256(bytes(vote)) == voter.hash ) {
|
||||||
@ -355,7 +355,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
delete funds;
|
delete funds;
|
||||||
delete voter.status;
|
delete voter.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
setVoter(msg.sender, voter);
|
setVoter(msg.sender, voter);
|
||||||
setRound(voter.roundID, round);
|
setRound(voter.roundID, round);
|
||||||
setFunds(msg.sender, funds);
|
setFunds(msg.sender, funds);
|
||||||
@ -368,17 +368,17 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
The right votes take share of deposits.
|
The right votes take share of deposits.
|
||||||
*/
|
*/
|
||||||
nextRound();
|
nextRound();
|
||||||
|
|
||||||
uint256 currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
_rounds memory round;
|
_rounds memory round;
|
||||||
_voter memory voter;
|
_voter memory voter;
|
||||||
uint256 funds;
|
uint256 funds;
|
||||||
|
|
||||||
voter = getVoter(msg.sender);
|
voter = getVoter(msg.sender);
|
||||||
round = getRound(voter.roundID);
|
round = getRound(voter.roundID);
|
||||||
funds = getFunds(msg.sender);
|
funds = getFunds(msg.sender);
|
||||||
|
|
||||||
require( voter.status == voterStatus.afterSendVoteOk ||
|
require( voter.status == voterStatus.afterSendVoteOk ||
|
||||||
voter.status == voterStatus.afterSendVoteBad );
|
voter.status == voterStatus.afterSendVoteBad );
|
||||||
if ( round.blockHeight+roundBlockDelay/2 <= block.number ) {
|
if ( round.blockHeight+roundBlockDelay/2 <= block.number ) {
|
||||||
if ( isWinner(round, voter.voteResult) && voter.status == voterStatus.afterSendVoteOk ) {
|
if ( isWinner(round, voter.voteResult) && voter.status == voterStatus.afterSendVoteOk ) {
|
||||||
@ -390,7 +390,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
delete voter.status;
|
delete voter.status;
|
||||||
delete voter.roundID;
|
delete voter.roundID;
|
||||||
} else { revert(); }
|
} else { revert(); }
|
||||||
|
|
||||||
setVoter(msg.sender, voter);
|
setVoter(msg.sender, voter);
|
||||||
setFunds(msg.sender, funds);
|
setFunds(msg.sender, funds);
|
||||||
}
|
}
|
||||||
@ -400,12 +400,12 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
The prizes will be collected here, and with this function can be transferred to the account of the user.
|
The prizes will be collected here, and with this function can be transferred to the account of the user.
|
||||||
Optionally there can be an address of a beneficiary added, which address the prize will be sent to. Without beneficiary, the owner is the default address.
|
Optionally there can be an address of a beneficiary added, which address the prize will be sent to. Without beneficiary, the owner is the default address.
|
||||||
Prize will be sent from the Schelling address without any transaction fee.
|
Prize will be sent from the Schelling address without any transaction fee.
|
||||||
|
|
||||||
@beneficiary Address of the beneficiary
|
@beneficiary Address of the beneficiary
|
||||||
*/
|
*/
|
||||||
schellingVars._voter memory voter = getVoter(msg.sender);
|
schellingVars._voter memory voter = getVoter(msg.sender);
|
||||||
uint256 funds = getFunds(msg.sender);
|
uint256 funds = getFunds(msg.sender);
|
||||||
|
|
||||||
address _beneficiary = msg.sender;
|
address _beneficiary = msg.sender;
|
||||||
if (beneficiary != address(0x00)) { _beneficiary = beneficiary; }
|
if (beneficiary != address(0x00)) { _beneficiary = beneficiary; }
|
||||||
uint256 reward;
|
uint256 reward;
|
||||||
@ -414,13 +414,13 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
reward = voter.rewards;
|
reward = voter.rewards;
|
||||||
delete voter.rewards;
|
delete voter.rewards;
|
||||||
require( moduleHandler(moduleHandlerAddress).transfer(address(this), _beneficiary, reward, false) );
|
require( moduleHandler(moduleHandlerAddress).transfer(address(this), _beneficiary, reward, false) );
|
||||||
|
|
||||||
setVoter(msg.sender, voter);
|
setVoter(msg.sender, voter);
|
||||||
}
|
}
|
||||||
function checkReward() public view returns (uint256 reward) {
|
function checkReward() public view returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Withdraw of the amount of the prize (it’s only information).
|
Withdraw of the amount of the prize (it’s only information).
|
||||||
|
|
||||||
@reward Prize
|
@reward Prize
|
||||||
*/
|
*/
|
||||||
schellingVars._voter memory voter = getVoter(msg.sender);
|
schellingVars._voter memory voter = getVoter(msg.sender);
|
||||||
@ -435,9 +435,9 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
_rounds memory newRound;
|
_rounds memory newRound;
|
||||||
_rounds memory prevRound;
|
_rounds memory prevRound;
|
||||||
uint256 currentSchellingRound = getCurrentSchellingRound();
|
uint256 currentSchellingRound = getCurrentSchellingRound();
|
||||||
|
|
||||||
if ( round.blockHeight+roundBlockDelay > block.number) { return false; }
|
if ( round.blockHeight+roundBlockDelay > block.number) { return false; }
|
||||||
|
|
||||||
newRound.blockHeight = block.number;
|
newRound.blockHeight = block.number;
|
||||||
if ( ! round.voted ) {
|
if ( ! round.voted ) {
|
||||||
newRound.reward = round.reward;
|
newRound.reward = round.reward;
|
||||||
@ -452,9 +452,9 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
if ( above >= interestCheckAboves ) {
|
if ( above >= interestCheckAboves ) {
|
||||||
expansion = getTotalSupply() * interestRate / interestRateM / 100;
|
expansion = getTotalSupply() * interestRate / interestRateM / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSchellingRound++;
|
currentSchellingRound++;
|
||||||
|
|
||||||
pushRound(newRound);
|
pushRound(newRound);
|
||||||
setSchellingExpansion(currentSchellingRound, expansion);
|
setSchellingExpansion(currentSchellingRound, expansion);
|
||||||
require( moduleHandler(moduleHandlerAddress).broadcastSchellingRound(currentSchellingRound, expansion) );
|
require( moduleHandler(moduleHandlerAddress).broadcastSchellingRound(currentSchellingRound, expansion) );
|
||||||
@ -466,19 +466,19 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
Every participant entry with his own deposit.
|
Every participant entry with his own deposit.
|
||||||
In case of wrong vote only this amount of deposit will be burn.
|
In case of wrong vote only this amount of deposit will be burn.
|
||||||
The deposit will be sent to the address of Schelling, charged with transaction fee.
|
The deposit will be sent to the address of Schelling, charged with transaction fee.
|
||||||
|
|
||||||
@amount Amount of deposit.
|
@amount Amount of deposit.
|
||||||
*/
|
*/
|
||||||
_voter memory voter = getVoter(msg.sender);
|
_voter memory voter = getVoter(msg.sender);
|
||||||
uint256 funds = getFunds(msg.sender);
|
uint256 funds = getFunds(msg.sender);
|
||||||
|
|
||||||
(bool a, bool b) = moduleHandler(moduleHandlerAddress).isICO();
|
(bool a, bool b) = moduleHandler(moduleHandlerAddress).isICO();
|
||||||
require( b && b );
|
require( b && b );
|
||||||
require( voter.status == voterStatus.base );
|
require( voter.status == voterStatus.base );
|
||||||
require( amount > 0 );
|
require( amount > 0 );
|
||||||
require( moduleHandler(moduleHandlerAddress).transfer(msg.sender, address(this), amount, true) );
|
require( moduleHandler(moduleHandlerAddress).transfer(msg.sender, address(this), amount, true) );
|
||||||
funds += amount;
|
funds += amount;
|
||||||
|
|
||||||
setFunds(msg.sender, funds);
|
setFunds(msg.sender, funds);
|
||||||
}
|
}
|
||||||
function getFunds() isReady noContract external {
|
function getFunds() isReady noContract external {
|
||||||
@ -489,17 +489,17 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
*/
|
*/
|
||||||
_voter memory voter = getVoter(msg.sender);
|
_voter memory voter = getVoter(msg.sender);
|
||||||
uint256 funds = getFunds(msg.sender);
|
uint256 funds = getFunds(msg.sender);
|
||||||
|
|
||||||
require( funds > 0 );
|
require( funds > 0 );
|
||||||
require( voter.status == voterStatus.base );
|
require( voter.status == voterStatus.base );
|
||||||
setFunds(msg.sender, 0);
|
setFunds(msg.sender, 0);
|
||||||
|
|
||||||
require( moduleHandler(moduleHandlerAddress).transfer(address(this), msg.sender, funds, true) );
|
require( moduleHandler(moduleHandlerAddress).transfer(address(this), msg.sender, funds, true) );
|
||||||
}
|
}
|
||||||
function getCurrentSchellingRoundID() public view returns (uint256) {
|
function getCurrentSchellingRoundID() public view returns (uint256) {
|
||||||
/*
|
/*
|
||||||
Number of actual Schelling round.
|
Number of actual Schelling round.
|
||||||
|
|
||||||
@uint256 Schelling round.
|
@uint256 Schelling round.
|
||||||
*/
|
*/
|
||||||
return getCurrentSchellingRound();
|
return getCurrentSchellingRound();
|
||||||
@ -507,7 +507,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function getSchellingRound(uint256 id) public view returns (uint256 expansion) {
|
function getSchellingRound(uint256 id) public view returns (uint256 expansion) {
|
||||||
/*
|
/*
|
||||||
Amount of token emission of the Schelling round.
|
Amount of token emission of the Schelling round.
|
||||||
|
|
||||||
@id Number of Schelling round
|
@id Number of Schelling round
|
||||||
@expansion Amount of token emission
|
@expansion Amount of token emission
|
||||||
*/
|
*/
|
||||||
@ -516,7 +516,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function getRoundWeight(uint256 aboveW, uint256 belowW) internal returns (uint256) {
|
function getRoundWeight(uint256 aboveW, uint256 belowW) internal returns (uint256) {
|
||||||
/*
|
/*
|
||||||
Inside function for calculating the weights of the votes.
|
Inside function for calculating the weights of the votes.
|
||||||
|
|
||||||
@aboveW Weight of votes: ABOVE
|
@aboveW Weight of votes: ABOVE
|
||||||
@belowW Weight of votes: BELOW
|
@belowW Weight of votes: BELOW
|
||||||
@uint256 Calculatet weight
|
@uint256 Calculatet weight
|
||||||
@ -532,7 +532,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function isWinner(_rounds memory round, bool aboveVote) internal returns (bool) {
|
function isWinner(_rounds memory round, bool aboveVote) internal returns (bool) {
|
||||||
/*
|
/*
|
||||||
Inside function for calculating the result of the game.
|
Inside function for calculating the result of the game.
|
||||||
|
|
||||||
@round Structure of Schelling round.
|
@round Structure of Schelling round.
|
||||||
@aboveVote Is the vote = ABOVE or not
|
@aboveVote Is the vote = ABOVE or not
|
||||||
@bool Result
|
@bool Result
|
||||||
@ -543,31 +543,31 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTotalSupply() internal returns (uint256 amount) {
|
function getTotalSupply() internal returns (uint256 amount) {
|
||||||
/*
|
/*
|
||||||
Inside function for querying the whole amount of the tokens.
|
Inside function for querying the whole amount of the tokens.
|
||||||
|
|
||||||
@uint256 Whole token amount
|
@uint256 Whole token amount
|
||||||
*/
|
*/
|
||||||
(bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
|
(bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
|
||||||
require( _success );
|
require( _success );
|
||||||
return _amount;
|
return _amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTokenBalance(address addr) internal returns (uint256 balance) {
|
function getTokenBalance(address addr) internal returns (uint256 balance) {
|
||||||
/*
|
/*
|
||||||
Inner function in order to poll the token balance of the address.
|
Inner function in order to poll the token balance of the address.
|
||||||
|
|
||||||
@addr Address
|
@addr Address
|
||||||
|
|
||||||
@balance Balance of the address.
|
@balance Balance of the address.
|
||||||
*/
|
*/
|
||||||
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
||||||
require( _success );
|
require( _success );
|
||||||
return _balance;
|
return _balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier noContract {
|
modifier noContract {
|
||||||
/*
|
/*
|
||||||
Contract can’t call this function, only a natural address.
|
Contract can’t call this function, only a natural address.
|
||||||
|
@ -23,7 +23,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
(bool _success, bool _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
string public name = "Corion";
|
string public name = "Corion";
|
||||||
string public symbol = "COR";
|
string public symbol = "COR";
|
||||||
uint8 public decimals = 6;
|
uint8 public decimals = 6;
|
||||||
|
|
||||||
tokenDB public db;
|
tokenDB public db;
|
||||||
address public icoAddr;
|
address public icoAddr;
|
||||||
uint256 public transactionFeeRate = 20;
|
uint256 public transactionFeeRate = 20;
|
||||||
@ -45,15 +45,15 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
uint256 public transactionFeeBurn = 80;
|
uint256 public transactionFeeBurn = 80;
|
||||||
address public exchangeAddress;
|
address public exchangeAddress;
|
||||||
bool public isICO = true;
|
bool public isICO = true;
|
||||||
|
|
||||||
mapping(address => bool) public genesis;
|
mapping(address => bool) public genesis;
|
||||||
|
|
||||||
constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] memory genesisAddr, uint256[] memory genesisValue) public payable {
|
constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] memory genesisAddr, uint256[] memory genesisValue) public payable {
|
||||||
/*
|
/*
|
||||||
Installation function
|
Installation function
|
||||||
|
|
||||||
When _icoAddr is defined, 0.2 ether has to be attached as many times as many genesis addresses are given
|
When _icoAddr is defined, 0.2 ether has to be attached as many times as many genesis addresses are given
|
||||||
|
|
||||||
@forReplace This address will be replaced with the old one or not.
|
@forReplace This address will be replaced with the old one or not.
|
||||||
@moduleHandler Modulhandler's address
|
@moduleHandler Modulhandler's address
|
||||||
@dbAddr Address of database
|
@dbAddr Address of database
|
||||||
@ -82,18 +82,18 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeIco() external returns (bool success) {
|
function closeIco() external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
ICO finished. It can be called only by ICO contract
|
ICO finished. It can be called only by ICO contract
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( msg.sender == icoAddr );
|
require( msg.sender == icoAddr );
|
||||||
isICO = false;
|
isICO = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf.
|
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf.
|
||||||
* @param spender The address of the account able to transfer the tokens
|
* @param spender The address of the account able to transfer the tokens
|
||||||
@ -104,17 +104,17 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Authorise another address to use a certain quantity of the authorising owner’s balance
|
Authorise another address to use a certain quantity of the authorising owner’s balance
|
||||||
|
|
||||||
@spender Address of authorised party
|
@spender Address of authorised party
|
||||||
@amount Token quantity
|
@amount Token quantity
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
_approve(spender, amount, nonce);
|
_approve(spender, amount, nonce);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data.
|
* @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data.
|
||||||
* @param spender The address of the account able to transfer the tokens
|
* @param spender The address of the account able to transfer the tokens
|
||||||
@ -127,24 +127,24 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Authorise another address to use a certain quantity of the authorising owner’s balance
|
Authorise another address to use a certain quantity of the authorising owner’s balance
|
||||||
Following the transaction the receiver address `approvedCorionToken` function is called by the given data
|
Following the transaction the receiver address `approvedCorionToken` function is called by the given data
|
||||||
|
|
||||||
@spender Authorized address
|
@spender Authorized address
|
||||||
@amount Token quantity
|
@amount Token quantity
|
||||||
@extraData Extra data to be received by the receiver
|
@extraData Extra data to be received by the receiver
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
_approve(spender, amount, nonce);
|
_approve(spender, amount, nonce);
|
||||||
require( thirdPartyContractAbstract(spender).approvedCorionToken(msg.sender, amount, extraData) );
|
require( thirdPartyContractAbstract(spender).approvedCorionToken(msg.sender, amount, extraData) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _approve(address spender, uint256 amount, uint256 nonce) internal {
|
function _approve(address spender, uint256 amount, uint256 nonce) internal {
|
||||||
/*
|
/*
|
||||||
Internal Function to authorise another address to use a certain quantity of the authorising owner’s balance.
|
Internal Function to authorise another address to use a certain quantity of the authorising owner’s balance.
|
||||||
If the transaction count not match the authorise fails.
|
If the transaction count not match the authorise fails.
|
||||||
|
|
||||||
@spender Address of authorised party
|
@spender Address of authorised party
|
||||||
@amount Token quantity
|
@amount Token quantity
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
@ -158,10 +158,10 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) {
|
function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) {
|
||||||
/*
|
/*
|
||||||
Get the quantity of tokens given to be used
|
Get the quantity of tokens given to be used
|
||||||
|
|
||||||
@owner Authorising address
|
@owner Authorising address
|
||||||
@spender Authorised address
|
@spender Authorised address
|
||||||
|
|
||||||
@remaining Tokens to be spent
|
@remaining Tokens to be spent
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
*/
|
*/
|
||||||
@ -169,7 +169,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
require( _success );
|
require( _success );
|
||||||
return (_remaining, _nonce);
|
return (_remaining, _nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
* @notice Send `amount` Corion tokens to `to` from `msg.sender`
|
||||||
* @param to The address of the recipient
|
* @param to The address of the recipient
|
||||||
@ -181,10 +181,10 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
Start transaction, token is sent from caller’s address to receiver’s address
|
Start transaction, token is sent from caller’s address to receiver’s address
|
||||||
Transaction fee is to be deducted.
|
Transaction fee is to be deducted.
|
||||||
If receiver is not a natural address but a person, he will be called
|
If receiver is not a natural address but a person, he will be called
|
||||||
|
|
||||||
@to To who
|
@to To who
|
||||||
@amount Quantity
|
@amount Quantity
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
bytes memory _data;
|
bytes memory _data;
|
||||||
@ -196,7 +196,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
emit Transfer(msg.sender, to, amount, _data);
|
emit Transfer(msg.sender, to, amount, _data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from`
|
* @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from`
|
||||||
* @param from The address holding the tokens being transferred
|
* @param from The address holding the tokens being transferred
|
||||||
@ -209,11 +209,11 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
Start transaction to send a quantity from a given address to another address. (approve / allowance). This can be called only by the address approved in advance
|
Start transaction to send a quantity from a given address to another address. (approve / allowance). This can be called only by the address approved in advance
|
||||||
Transaction fee is to be deducted
|
Transaction fee is to be deducted
|
||||||
If receiver is not a natural address but a person, he will be called
|
If receiver is not a natural address but a person, he will be called
|
||||||
|
|
||||||
@from From who.
|
@from From who.
|
||||||
@to To who
|
@to To who
|
||||||
@amount Quantity
|
@amount Quantity
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
if ( from != msg.sender ) {
|
if ( from != msg.sender ) {
|
||||||
@ -233,7 +233,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
emit Transfer(from, to, amount, _data);
|
emit Transfer(from, to, amount, _data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from`
|
* @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from`
|
||||||
* @param from The address holding the tokens being transferred
|
* @param from The address holding the tokens being transferred
|
||||||
@ -245,12 +245,12 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
/*
|
/*
|
||||||
Start transaction to send a quantity from a given address to another address
|
Start transaction to send a quantity from a given address to another address
|
||||||
Only ModuleHandler can call it
|
Only ModuleHandler can call it
|
||||||
|
|
||||||
@from From who
|
@from From who
|
||||||
@to To who.
|
@to To who.
|
||||||
@amount Quantity
|
@amount Quantity
|
||||||
@fee Deduct transaction fee - yes or no?
|
@fee Deduct transaction fee - yes or no?
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
bytes memory _data;
|
bytes memory _data;
|
||||||
@ -259,7 +259,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
emit Transfer(from, to, amount, _data);
|
emit Transfer(from, to, amount, _data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Send `amount` Corion tokens to `to` from `msg.sender` and notify the receiver from your transaction with your `extraData` data
|
* @notice Send `amount` Corion tokens to `to` from `msg.sender` and notify the receiver from your transaction with your `extraData` data
|
||||||
* @param to The contract address of the recipient
|
* @param to The contract address of the recipient
|
||||||
@ -272,11 +272,11 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
Start transaction to send a quantity from a given address to another address
|
Start transaction to send a quantity from a given address to another address
|
||||||
After transaction the function `receiveCorionToken`of the receiver is called by the given data
|
After transaction the function `receiveCorionToken`of the receiver is called by the given data
|
||||||
When sending an amount, it is possible the total amount cannot be processed, the remaining amount is sent back with no fee charged
|
When sending an amount, it is possible the total amount cannot be processed, the remaining amount is sent back with no fee charged
|
||||||
|
|
||||||
@to To who.
|
@to To who.
|
||||||
@amount Quantity
|
@amount Quantity
|
||||||
@extraData Extra data the receiver will get
|
@extraData Extra data the receiver will get
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
if ( isContract(to) ) {
|
if ( isContract(to) ) {
|
||||||
@ -287,11 +287,11 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
emit Transfer(msg.sender, to, amount, extraData);
|
emit Transfer(msg.sender, to, amount, extraData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal {
|
function _transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal {
|
||||||
/*
|
/*
|
||||||
Internal function to start transactions to a contract
|
Internal function to start transactions to a contract
|
||||||
|
|
||||||
@from From who
|
@from From who
|
||||||
@to To who.
|
@to To who.
|
||||||
@amount Quantity
|
@amount Quantity
|
||||||
@ -306,15 +306,15 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
}
|
}
|
||||||
_processTransactionFee(from, amount - _back);
|
_processTransactionFee(from, amount - _back);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _transfer(address from, address to, uint256 amount, bool fee) internal {
|
function _transfer(address from, address to, uint256 amount, bool fee) internal {
|
||||||
/*
|
/*
|
||||||
Internal function to start transactions. When Tokens are sent, transaction fee is charged
|
Internal function to start transactions. When Tokens are sent, transaction fee is charged
|
||||||
During ICO transactions are allowed only from genesis addresses.
|
During ICO transactions are allowed only from genesis addresses.
|
||||||
After sending the tokens, the ModuleHandler is notified and it will broadcast the fact among members
|
After sending the tokens, the ModuleHandler is notified and it will broadcast the fact among members
|
||||||
|
|
||||||
The 0xa636a97578d26a3b76b060bbc18226d954cf3757 address are blacklisted.
|
The 0xa636a97578d26a3b76b060bbc18226d954cf3757 address are blacklisted.
|
||||||
|
|
||||||
@from From who
|
@from From who
|
||||||
@to To who
|
@to To who
|
||||||
@amount Quantity
|
@amount Quantity
|
||||||
@ -336,7 +336,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
}
|
}
|
||||||
require( moduleHandler(moduleHandlerAddress).broadcastTransfer(from, to, amount) );
|
require( moduleHandler(moduleHandlerAddress).broadcastTransfer(from, to, amount) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Transaction fee will be deduced from `owner` for transacting `value`
|
* @notice Transaction fee will be deduced from `owner` for transacting `value`
|
||||||
* @param owner The address where will the transaction fee deduced
|
* @param owner The address where will the transaction fee deduced
|
||||||
@ -345,23 +345,23 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
*/
|
*/
|
||||||
function processTransactionFee(address owner, uint256 value) isReady external returns (bool success) {
|
function processTransactionFee(address owner, uint256 value) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Charge transaction fee. It can be called only by moduleHandler
|
Charge transaction fee. It can be called only by moduleHandler
|
||||||
|
|
||||||
@owner From who.
|
@owner From who.
|
||||||
@value Quantity to calculate the fee
|
@value Quantity to calculate the fee
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
_processTransactionFee(owner, value);
|
_processTransactionFee(owner, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _processTransactionFee(address owner, uint256 value) internal {
|
function _processTransactionFee(address owner, uint256 value) internal {
|
||||||
/*
|
/*
|
||||||
Internal function to charge the transaction fee. A certain quantity is burnt, the rest is sent to the Schelling game prize pool.
|
Internal function to charge the transaction fee. A certain quantity is burnt, the rest is sent to the Schelling game prize pool.
|
||||||
No transaction fee during ICO.
|
No transaction fee during ICO.
|
||||||
|
|
||||||
@owner From who
|
@owner From who
|
||||||
@value Quantity to calculate the fee
|
@value Quantity to calculate the fee
|
||||||
*/
|
*/
|
||||||
@ -385,13 +385,13 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
_burn(owner, _fee);
|
_burn(owner, _fee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTransactionFee(uint256 value) public view returns (bool success, uint256 fee) {
|
function getTransactionFee(uint256 value) public view returns (bool success, uint256 fee) {
|
||||||
/*
|
/*
|
||||||
Transaction fee query.
|
Transaction fee query.
|
||||||
|
|
||||||
@value Quantity to calculate the fee
|
@value Quantity to calculate the fee
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
@fee Amount of Transaction fee
|
@fee Amount of Transaction fee
|
||||||
*/
|
*/
|
||||||
@ -401,25 +401,25 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
else if ( fee < transactionFeeMin ) { fee = transactionFeeMin; }
|
else if ( fee < transactionFeeMin ) { fee = transactionFeeMin; }
|
||||||
return (true, fee);
|
return (true, fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mint(address owner, uint256 value) isReady external returns (bool success) {
|
function mint(address owner, uint256 value) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Generating tokens. It can be called only by ICO contract or the moduleHandler.
|
Generating tokens. It can be called only by ICO contract or the moduleHandler.
|
||||||
|
|
||||||
@owner Address
|
@owner Address
|
||||||
@value Amount.
|
@value Amount.
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) || msg.sender == icoAddr );
|
require( super.isModuleHandler(msg.sender) || msg.sender == icoAddr );
|
||||||
_mint(owner, value);
|
_mint(owner, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _mint(address owner, uint256 value) internal {
|
function _mint(address owner, uint256 value) internal {
|
||||||
/*
|
/*
|
||||||
Internal function to generate tokens
|
Internal function to generate tokens
|
||||||
|
|
||||||
@owner Token is credited to this address
|
@owner Token is credited to this address
|
||||||
@value Quantity
|
@value Quantity
|
||||||
*/
|
*/
|
||||||
@ -430,25 +430,25 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
}
|
}
|
||||||
emit Mint(owner, value);
|
emit Mint(owner, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function burn(address owner, uint256 value) isReady external returns (bool success) {
|
function burn(address owner, uint256 value) isReady external returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Burning the token. Can call only modulehandler
|
Burning the token. Can call only modulehandler
|
||||||
|
|
||||||
@owner Burn the token from this address
|
@owner Burn the token from this address
|
||||||
@value Quantity
|
@value Quantity
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
_burn(owner, value);
|
_burn(owner, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _burn(address owner, uint256 value) internal {
|
function _burn(address owner, uint256 value) internal {
|
||||||
/*
|
/*
|
||||||
Internal function to burn the token
|
Internal function to burn the token
|
||||||
|
|
||||||
@owner Burn the token from this address
|
@owner Burn the token from this address
|
||||||
@value Quantity
|
@value Quantity
|
||||||
*/
|
*/
|
||||||
@ -456,13 +456,13 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, address(0x00), value) );
|
require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, address(0x00), value) );
|
||||||
emit Burn(owner, value);
|
emit Burn(owner, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isContract(address addr) internal returns (bool success) {
|
function isContract(address addr) internal returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Internal function to check if the given address is natural, or a contract
|
Internal function to check if the given address is natural, or a contract
|
||||||
|
|
||||||
@addr Address to be checked
|
@addr Address to be checked
|
||||||
|
|
||||||
@success Is the address crontact or not
|
@success Is the address crontact or not
|
||||||
*/
|
*/
|
||||||
uint256 _codeLength;
|
uint256 _codeLength;
|
||||||
@ -475,9 +475,9 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
function balanceOf(address owner) public view returns (uint256 value) {
|
function balanceOf(address owner) public view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Token balance query
|
Token balance query
|
||||||
|
|
||||||
@owner Address
|
@owner Address
|
||||||
|
|
||||||
@value Balance of address
|
@value Balance of address
|
||||||
*/
|
*/
|
||||||
return db.balanceOf(owner);
|
return db.balanceOf(owner);
|
||||||
@ -486,19 +486,19 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
function totalSupply() public view returns (uint256 value) {
|
function totalSupply() public view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Total token quantity query
|
Total token quantity query
|
||||||
|
|
||||||
@value Total token quantity
|
@value Total token quantity
|
||||||
*/
|
*/
|
||||||
return db.totalSupply();
|
return db.totalSupply();
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure(announcementType aType, uint256 value) isReady external returns(bool success) {
|
function configure(announcementType aType, uint256 value) isReady external returns(bool success) {
|
||||||
/*
|
/*
|
||||||
Token settings configuration.It can be call only by moduleHandler
|
Token settings configuration.It can be call only by moduleHandler
|
||||||
|
|
||||||
@aType Type of setting
|
@aType Type of setting
|
||||||
@value Value
|
@value Value
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
@ -509,7 +509,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
else { return false; }
|
else { return false; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
event AllowanceUsed(address indexed spender, address indexed owner, uint256 indexed value);
|
event AllowanceUsed(address indexed spender, address indexed owner, uint256 indexed value);
|
||||||
event Mint(address indexed addr, uint256 indexed value);
|
event Mint(address indexed addr, uint256 indexed value);
|
||||||
event Burn(address indexed addr, uint256 indexed value);
|
event Burn(address indexed addr, uint256 indexed value);
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
pragma solidity ^0.4.11;
|
pragma solidity ^0.4.11;
|
||||||
|
|
||||||
import "./safeMath.sol";
|
import "./safeMath.sol";
|
||||||
import "./owned.sol";
|
import "./owned.sol";
|
||||||
|
|
||||||
contract tokenDB is safeMath, ownedDB {
|
contract tokenDB is safeMath, ownedDB {
|
||||||
|
|
||||||
struct allowance_s {
|
struct allowance_s {
|
||||||
uint256 amount;
|
uint256 amount;
|
||||||
uint256 nonce;
|
uint256 nonce;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapping(address => mapping(address => allowance_s)) public allowance;
|
mapping(address => mapping(address => allowance_s)) public allowance;
|
||||||
mapping (address => uint256) public balanceOf;
|
mapping (address => uint256) public balanceOf;
|
||||||
uint256 public totalSupply;
|
uint256 public totalSupply;
|
||||||
|
|
||||||
function increase(address owner, uint256 value) external returns(bool success) {
|
function increase(address owner, uint256 value) external returns(bool success) {
|
||||||
/*
|
/*
|
||||||
Increase of balance of the address in database. Only owner can call it.
|
Increase of balance of the address in database. Only owner can call it.
|
||||||
|
|
||||||
@owner Address
|
@owner Address
|
||||||
@value Quantity
|
@value Quantity
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( isOwner() );
|
require( isOwner() );
|
||||||
balanceOf[owner] = safeAdd(balanceOf[owner], value);
|
balanceOf[owner] = safeAdd(balanceOf[owner], value);
|
||||||
totalSupply = safeAdd(totalSupply, value);
|
totalSupply = safeAdd(totalSupply, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function decrease(address owner, uint256 value) external returns(bool success) {
|
function decrease(address owner, uint256 value) external returns(bool success) {
|
||||||
/*
|
/*
|
||||||
Decrease of balance of the address in database. Only owner can call it.
|
Decrease of balance of the address in database. Only owner can call it.
|
||||||
|
|
||||||
@owner Address
|
@owner Address
|
||||||
@value Quantity
|
@value Quantity
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( isOwner() );
|
require( isOwner() );
|
||||||
balanceOf[owner] = safeSub(balanceOf[owner], value);
|
balanceOf[owner] = safeSub(balanceOf[owner], value);
|
||||||
totalSupply = safeSub(totalSupply, value);
|
totalSupply = safeSub(totalSupply, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAllowance(address owner, address spender, uint256 amount, uint256 nonce) external returns(bool success) {
|
function setAllowance(address owner, address spender, uint256 amount, uint256 nonce) external returns(bool success) {
|
||||||
/*
|
/*
|
||||||
Set allowance in the database. Only owner can call it.
|
Set allowance in the database. Only owner can call it.
|
||||||
|
|
||||||
@owner Owner address
|
@owner Owner address
|
||||||
@spender Spender address
|
@spender Spender address
|
||||||
@amount Amount to set
|
@amount Amount to set
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
require( isOwner() );
|
require( isOwner() );
|
||||||
allowance[owner][spender].amount = amount;
|
allowance[owner][spender].amount = amount;
|
||||||
allowance[owner][spender].nonce = nonce;
|
allowance[owner][spender].nonce = nonce;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllowance(address owner, address spender) public view returns(bool success, uint256 remaining, uint256 nonce) {
|
function getAllowance(address owner, address spender) public view returns(bool success, uint256 remaining, uint256 nonce) {
|
||||||
/*
|
/*
|
||||||
Get allowance from the database.
|
Get allowance from the database.
|
||||||
|
|
||||||
@owner Owner address
|
@owner Owner address
|
||||||
@spender Spender address
|
@spender Spender address
|
||||||
|
|
||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
@remaining Remaining amount of the allowance
|
@remaining Remaining amount of the allowance
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
*/
|
*/
|
||||||
return ( true, allowance[owner][spender].amount, allowance[owner][spender].nonce );
|
return ( true, allowance[owner][spender].amount, allowance[owner][spender].nonce );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ contract OutcomeToken is StandardToken {
|
|||||||
{
|
{
|
||||||
eventContract = msg.sender;
|
eventContract = msg.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Events contract issues new tokens for address. Returns success
|
/// @dev Events contract issues new tokens for address. Returns success
|
||||||
/// @param _for Address of receiver
|
/// @param _for Address of receiver
|
||||||
/// @param outcomeTokenCount Number of tokens to issue
|
/// @param outcomeTokenCount Number of tokens to issue
|
||||||
|
@ -25,7 +25,7 @@ contract Bounty is PullPayment, Destructible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Create and deploy the target contract (extension of Target contract), and sets the
|
* @dev Create and deploy the target contract (extension of Target contract), and sets the
|
||||||
* msg.sender as a researcher
|
* msg.sender as a researcher
|
||||||
* @return A target contract
|
* @return A target contract
|
||||||
*/
|
*/
|
||||||
@ -69,10 +69,10 @@ contract Bounty is PullPayment, Destructible {
|
|||||||
contract Target {
|
contract Target {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Checks all values a contract assumes to be true all the time. If this function returns
|
* @dev Checks all values a contract assumes to be true all the time. If this function returns
|
||||||
* false, the contract is broken in some way and is in an inconsistent state.
|
* false, the contract is broken in some way and is in an inconsistent state.
|
||||||
* In order to win the bounty, security researchers will try to cause this broken state.
|
* In order to win the bounty, security researchers will try to cause this broken state.
|
||||||
* @return True if all invariant values are correct, false otherwise.
|
* @return True if all invariant values are correct, false otherwise.
|
||||||
*/
|
*/
|
||||||
function checkInvariant() public returns(bool);
|
function checkInvariant() public returns(bool);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ contract LimitBalance {
|
|||||||
uint256 public limit;
|
uint256 public limit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Constructor that sets the passed value as a limit.
|
* @dev Constructor that sets the passed value as a limit.
|
||||||
* @param _limit uint256 to represent the limit.
|
* @param _limit uint256 to represent the limit.
|
||||||
*/
|
*/
|
||||||
constructor(uint256 _limit) public {
|
constructor(uint256 _limit) public {
|
||||||
|
@ -9,7 +9,7 @@ pragma solidity ^0.4.11;
|
|||||||
contract ReentrancyGuard {
|
contract ReentrancyGuard {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev We use a single lock for the whole contract.
|
* @dev We use a single lock for the whole contract.
|
||||||
*/
|
*/
|
||||||
bool private rentrancy_lock = false;
|
bool private rentrancy_lock = false;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ contract FinalizableCrowdsale is Crowdsale, Ownable {
|
|||||||
|
|
||||||
finalization();
|
finalization();
|
||||||
emit Finalized();
|
emit Finalized();
|
||||||
|
|
||||||
isFinalized = true;
|
isFinalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ contract Destructible is Ownable {
|
|||||||
constructor() public payable { }
|
constructor() public payable { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Transfers the current balance to the owner and terminates the contract.
|
* @dev Transfers the current balance to the owner and terminates the contract.
|
||||||
*/
|
*/
|
||||||
function destroy() public onlyOwner {
|
function destroy() public onlyOwner {
|
||||||
selfdestruct(owner);
|
selfdestruct(owner);
|
||||||
|
@ -4,7 +4,7 @@ pragma solidity ^0.4.11;
|
|||||||
import "../ownership/Ownable.sol";
|
import "../ownership/Ownable.sol";
|
||||||
import "../token/ERC20Basic.sol";
|
import "../token/ERC20Basic.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title TokenDestructible:
|
* @title TokenDestructible:
|
||||||
* @author Remco Bloemen <remco@2π.com>
|
* @author Remco Bloemen <remco@2π.com>
|
||||||
* @dev Base contract that can be destroyed by owner. All funds in contract including
|
* @dev Base contract that can be destroyed by owner. All funds in contract including
|
||||||
@ -14,7 +14,7 @@ contract TokenDestructible is Ownable {
|
|||||||
|
|
||||||
constructor() public payable { }
|
constructor() public payable { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Terminate contract and refund to owner
|
* @notice Terminate contract and refund to owner
|
||||||
* @param tokens List of addresses of ERC20 or ERC20Basic token contracts to
|
* @param tokens List of addresses of ERC20 or ERC20Basic token contracts to
|
||||||
refund.
|
refund.
|
||||||
|
@ -6,14 +6,14 @@ import './Ownable.sol';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Claimable
|
* @title Claimable
|
||||||
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
|
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
|
||||||
* This allows the new owner to accept the transfer.
|
* This allows the new owner to accept the transfer.
|
||||||
*/
|
*/
|
||||||
contract Claimable is Ownable {
|
contract Claimable is Ownable {
|
||||||
address public pendingOwner;
|
address public pendingOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Modifier throws if called by any account other than the pendingOwner.
|
* @dev Modifier throws if called by any account other than the pendingOwner.
|
||||||
*/
|
*/
|
||||||
modifier onlyPendingOwner() {
|
modifier onlyPendingOwner() {
|
||||||
if (msg.sender != pendingOwner) {
|
if (msg.sender != pendingOwner) {
|
||||||
@ -23,8 +23,8 @@ contract Claimable is Ownable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows the current owner to set the pendingOwner address.
|
* @dev Allows the current owner to set the pendingOwner address.
|
||||||
* @param newOwner The address to transfer ownership to.
|
* @param newOwner The address to transfer ownership to.
|
||||||
*/
|
*/
|
||||||
function transferOwnership(address newOwner) public onlyOwner {
|
function transferOwnership(address newOwner) public onlyOwner {
|
||||||
pendingOwner = newOwner;
|
pendingOwner = newOwner;
|
||||||
|
@ -4,7 +4,7 @@ import './Ownable.sol';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Contactable token
|
* @title Contactable token
|
||||||
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
|
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
|
||||||
* contact information.
|
* contact information.
|
||||||
*/
|
*/
|
||||||
contract Contactable is Ownable{
|
contract Contactable is Ownable{
|
||||||
|
@ -15,10 +15,10 @@ contract DelayedClaimable is Claimable {
|
|||||||
uint256 public start;
|
uint256 public start;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Used to specify the time period during which a pending
|
* @dev Used to specify the time period during which a pending
|
||||||
* owner can claim ownership.
|
* owner can claim ownership.
|
||||||
* @param _start The earliest time ownership can be claimed.
|
* @param _start The earliest time ownership can be claimed.
|
||||||
* @param _end The latest time ownership can be claimed.
|
* @param _end The latest time ownership can be claimed.
|
||||||
*/
|
*/
|
||||||
function setLimits(uint256 _start, uint256 _end) public onlyOwner {
|
function setLimits(uint256 _start, uint256 _end) public onlyOwner {
|
||||||
if (_start > _end)
|
if (_start > _end)
|
||||||
@ -29,8 +29,8 @@ contract DelayedClaimable is Claimable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
|
* @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
|
||||||
* the specified start and end time.
|
* the specified start and end time.
|
||||||
*/
|
*/
|
||||||
function claimOwnership() public onlyPendingOwner {
|
function claimOwnership() public onlyPendingOwner {
|
||||||
if ((block.number > end) || (block.number < start))
|
if ((block.number > end) || (block.number < start))
|
||||||
|
@ -2,7 +2,7 @@ pragma solidity ^0.4.11;
|
|||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Contracts that should not own Contracts
|
* @title Contracts that should not own Contracts
|
||||||
* @author Remco Bloemen <remco@2π.com>
|
* @author Remco Bloemen <remco@2π.com>
|
||||||
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
|
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
|
||||||
|
@ -2,7 +2,7 @@ pragma solidity ^0.4.11;
|
|||||||
|
|
||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Contracts that should not own Ether
|
* @title Contracts that should not own Ether
|
||||||
* @author Remco Bloemen <remco@2π.com>
|
* @author Remco Bloemen <remco@2π.com>
|
||||||
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
|
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
|
||||||
@ -16,9 +16,9 @@ contract HasNoEther is Ownable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Constructor that rejects incoming Ether
|
* @dev Constructor that rejects incoming Ether
|
||||||
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
|
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
|
||||||
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
|
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
|
||||||
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
|
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
|
||||||
* we could use assembly to access msg.value.
|
* we could use assembly to access msg.value.
|
||||||
*/
|
*/
|
||||||
constructor() public payable {
|
constructor() public payable {
|
||||||
|
@ -3,7 +3,7 @@ pragma solidity ^0.4.11;
|
|||||||
import "./Ownable.sol";
|
import "./Ownable.sol";
|
||||||
import "../token/ERC20Basic.sol";
|
import "../token/ERC20Basic.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Contracts that should not own Tokens
|
* @title Contracts that should not own Tokens
|
||||||
* @author Remco Bloemen <remco@2π.com>
|
* @author Remco Bloemen <remco@2π.com>
|
||||||
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
|
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
|
||||||
@ -12,7 +12,7 @@ import "../token/ERC20Basic.sol";
|
|||||||
*/
|
*/
|
||||||
contract HasNoTokens is Ownable {
|
contract HasNoTokens is Ownable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Reject all ERC23 compatible tokens
|
* @dev Reject all ERC23 compatible tokens
|
||||||
* @param from_ address The address that is transferring the tokens
|
* @param from_ address The address that is transferring the tokens
|
||||||
* @param value_ uint256 the amount of the specified token
|
* @param value_ uint256 the amount of the specified token
|
||||||
|
@ -4,10 +4,10 @@ import "./HasNoEther.sol";
|
|||||||
import "./HasNoTokens.sol";
|
import "./HasNoTokens.sol";
|
||||||
import "./HasNoContracts.sol";
|
import "./HasNoContracts.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Base contract for contracts that should not own things.
|
* @title Base contract for contracts that should not own things.
|
||||||
* @author Remco Bloemen <remco@2π.com>
|
* @author Remco Bloemen <remco@2π.com>
|
||||||
* @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or
|
* @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or
|
||||||
* Owned contracts. See respective base contracts for details.
|
* Owned contracts. See respective base contracts for details.
|
||||||
*/
|
*/
|
||||||
contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
|
contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
|
||||||
|
@ -3,14 +3,14 @@ pragma solidity ^0.4.11;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Ownable
|
* @title Ownable
|
||||||
* @dev The Ownable contract has an owner address, and provides basic authorization control
|
* @dev The Ownable contract has an owner address, and provides basic authorization control
|
||||||
* functions, this simplifies the implementation of "user permissions".
|
* functions, this simplifies the implementation of "user permissions".
|
||||||
*/
|
*/
|
||||||
contract Ownable {
|
contract Ownable {
|
||||||
address public owner;
|
address public owner;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
|
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
|
||||||
* account.
|
* account.
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@ contract Ownable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Throws if called by any account other than the owner.
|
* @dev Throws if called by any account other than the owner.
|
||||||
*/
|
*/
|
||||||
modifier onlyOwner() {
|
modifier onlyOwner() {
|
||||||
if (msg.sender != owner) {
|
if (msg.sender != owner) {
|
||||||
@ -32,7 +32,7 @@ contract Ownable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows the current owner to transfer control of the contract to a newOwner.
|
* @dev Allows the current owner to transfer control of the contract to a newOwner.
|
||||||
* @param newOwner The address to transfer ownership to.
|
* @param newOwner The address to transfer ownership to.
|
||||||
*/
|
*/
|
||||||
function transferOwnership(address newOwner) public onlyOwner {
|
function transferOwnership(address newOwner) public onlyOwner {
|
||||||
if (newOwner != address(0)) {
|
if (newOwner != address(0)) {
|
||||||
|
@ -3,7 +3,7 @@ pragma solidity ^0.4.11;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Shareable
|
* @title Shareable
|
||||||
* @dev inheritable "property" contract that enables methods to be protected by requiring the
|
* @dev inheritable "property" contract that enables methods to be protected by requiring the
|
||||||
* acquiescence of either a single, or, crucially, each of a number of, designated owners.
|
* acquiescence of either a single, or, crucially, each of a number of, designated owners.
|
||||||
* @dev Usage: use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed.
|
* @dev Usage: use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed.
|
||||||
*/
|
*/
|
||||||
@ -41,9 +41,9 @@ contract Shareable {
|
|||||||
}
|
}
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Modifier for multisig functions.
|
* @dev Modifier for multisig functions.
|
||||||
* @param _operation The operation must have an intrinsic hash in order that later attempts can be
|
* @param _operation The operation must have an intrinsic hash in order that later attempts can be
|
||||||
* realised as the same underlying operation and thus count as confirmations.
|
* realised as the same underlying operation and thus count as confirmations.
|
||||||
*/
|
*/
|
||||||
@ -53,8 +53,8 @@ contract Shareable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Constructor is given the number of sigs required to do protected "onlymanyowners"
|
* @dev Constructor is given the number of sigs required to do protected "onlymanyowners"
|
||||||
* transactions as well as the selection of addresses capable of confirming them.
|
* transactions as well as the selection of addresses capable of confirming them.
|
||||||
* @param _owners A list of owners.
|
* @param _owners A list of owners.
|
||||||
* @param _required The amount required for a transaction to be approved.
|
* @param _required The amount required for a transaction to be approved.
|
||||||
|
@ -7,7 +7,7 @@ import '../math/SafeMath.sol';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Basic token
|
* @title Basic token
|
||||||
* @dev Basic version of StandardToken, with no allowances.
|
* @dev Basic version of StandardToken, with no allowances.
|
||||||
*/
|
*/
|
||||||
contract BasicToken is ERC20Basic {
|
contract BasicToken is ERC20Basic {
|
||||||
using SafeMath for uint256;
|
using SafeMath for uint256;
|
||||||
@ -27,7 +27,7 @@ contract BasicToken is ERC20Basic {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Gets the balance of the specified address.
|
* @dev Gets the balance of the specified address.
|
||||||
* @param _owner The address to query the the balance of.
|
* @param _owner The address to query the the balance of.
|
||||||
* @return An uint256 representing the amount owned by the passed address.
|
* @return An uint256 representing the amount owned by the passed address.
|
||||||
*/
|
*/
|
||||||
function balanceOf(address _owner) public view returns (uint256 balance) {
|
function balanceOf(address _owner) public view returns (uint256 balance) {
|
||||||
|
@ -4,11 +4,11 @@ import "./ERC20.sol";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title LimitedTransferToken
|
* @title LimitedTransferToken
|
||||||
* @dev LimitedTransferToken defines the generic interface and the implementation to limit token
|
* @dev LimitedTransferToken defines the generic interface and the implementation to limit token
|
||||||
* transferability for different events. It is intended to be used as a base class for other token
|
* transferability for different events. It is intended to be used as a base class for other token
|
||||||
* contracts.
|
* contracts.
|
||||||
* LimitedTransferToken has been designed to allow for different limiting factors,
|
* LimitedTransferToken has been designed to allow for different limiting factors,
|
||||||
* this can be achieved by recursively calling super.transferableTokens() until the base class is
|
* this can be achieved by recursively calling super.transferableTokens() until the base class is
|
||||||
* hit. For example:
|
* hit. For example:
|
||||||
* function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
* function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
||||||
* return min256(unlockedTokens, super.transferableTokens(holder, time));
|
* return min256(unlockedTokens, super.transferableTokens(holder, time));
|
||||||
@ -48,7 +48,7 @@ contract LimitedTransferToken is ERC20 {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Default transferable tokens function returns all tokens for a holder (no limit).
|
* @dev Default transferable tokens function returns all tokens for a holder (no limit).
|
||||||
* @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
|
* @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
|
||||||
* specific logic for limiting token transferability for a holder over time.
|
* specific logic for limiting token transferability for a holder over time.
|
||||||
*/
|
*/
|
||||||
function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
||||||
|
@ -6,7 +6,7 @@ import "./StandardToken.sol";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title SimpleToken
|
* @title SimpleToken
|
||||||
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
|
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
|
||||||
* Note they can later distribute these tokens as they wish using `transfer` and other
|
* Note they can later distribute these tokens as they wish using `transfer` and other
|
||||||
* `StandardToken` functions.
|
* `StandardToken` functions.
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ contract SimpleToken is StandardToken {
|
|||||||
uint256 public INITIAL_SUPPLY = 10000;
|
uint256 public INITIAL_SUPPLY = 10000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Constructor that gives msg.sender all of existing tokens.
|
* @dev Constructor that gives msg.sender all of existing tokens.
|
||||||
*/
|
*/
|
||||||
constructor() public {
|
constructor() public {
|
||||||
totalSupply = INITIAL_SUPPLY;
|
totalSupply = INITIAL_SUPPLY;
|
||||||
|
@ -5,11 +5,11 @@ import './ERC20Basic.sol';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title TokenTimelock
|
* @title TokenTimelock
|
||||||
* @dev TokenTimelock is a token holder contract that will allow a
|
* @dev TokenTimelock is a token holder contract that will allow a
|
||||||
* beneficiary to extract the tokens after a given release time
|
* beneficiary to extract the tokens after a given release time
|
||||||
*/
|
*/
|
||||||
contract TokenTimelock {
|
contract TokenTimelock {
|
||||||
|
|
||||||
// ERC20 basic token contract being held
|
// ERC20 basic token contract being held
|
||||||
ERC20Basic token;
|
ERC20Basic token;
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @dev Calculate the amount of non vested tokens at a specific time.
|
* @dev Calculate the amount of non vested tokens at a specific time.
|
||||||
* @param grant TokenGrant The grant to be checked.
|
* @param grant TokenGrant The grant to be checked.
|
||||||
* @param time uint64 The time to be checked
|
* @param time uint64 The time to be checked
|
||||||
* @return An uint256 representing the amount of non vested tokens of a specific grant on the
|
* @return An uint256 representing the amount of non vested tokens of a specific grant on the
|
||||||
* passed time frame.
|
* passed time frame.
|
||||||
*/
|
*/
|
||||||
function nonVestedTokens(TokenGrant memory grant, uint64 time) private view returns (uint256) {
|
function nonVestedTokens(TokenGrant memory grant, uint64 time) private view returns (uint256) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
contract C {
|
contract C {
|
||||||
uint[] x;
|
uint[] x;
|
||||||
function() external {
|
function() external {
|
||||||
uint[] storage y = x;
|
uint[] storage y = x;
|
||||||
assembly {
|
assembly {
|
||||||
pop(y)
|
pop(y)
|
||||||
@ -8,4 +8,4 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError: (119-120): You have to use the _slot or _offset suffix to access storage reference variables.
|
// TypeError: (118-119): You have to use the _slot or _offset suffix to access storage reference variables.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
contract C {
|
contract C {
|
||||||
uint[] x;
|
uint[] x;
|
||||||
function() external {
|
function() external {
|
||||||
uint[] storage y = x;
|
uint[] storage y = x;
|
||||||
assembly {
|
assembly {
|
||||||
y_slot := 1
|
y_slot := 1
|
||||||
@ -9,5 +9,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError: (115-121): Storage variables cannot be assigned to.
|
// TypeError: (114-120): Storage variables cannot be assigned to.
|
||||||
// TypeError: (139-147): Storage variables cannot be assigned to.
|
// TypeError: (138-146): Storage variables cannot be assigned to.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
contract C {
|
contract C {
|
||||||
uint[] x;
|
uint[] x;
|
||||||
function() external {
|
function() external {
|
||||||
uint[] storage y = x;
|
uint[] storage y = x;
|
||||||
assembly {
|
assembly {
|
||||||
pop(y_slot)
|
pop(y_slot)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
contract C {
|
contract C {
|
||||||
uint[] x;
|
uint[] x;
|
||||||
function() external {
|
function() external {
|
||||||
uint[] memory y = x;
|
uint[] memory y = x;
|
||||||
assembly {
|
assembly {
|
||||||
pop(y_slot)
|
pop(y_slot)
|
||||||
@ -9,5 +9,5 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError: (118-124): The suffixes _offset and _slot can only be used on storage variables.
|
// TypeError: (117-123): The suffixes _offset and _slot can only be used on storage variables.
|
||||||
// TypeError: (142-150): The suffixes _offset and _slot can only be used on storage variables.
|
// TypeError: (141-149): The suffixes _offset and _slot can only be used on storage variables.
|
||||||
|
@ -3,4 +3,4 @@ contract C {
|
|||||||
(uint a) = f();
|
(uint a) = f();
|
||||||
a;
|
a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ contract C {
|
|||||||
(uint a, string memory b,,) = f();
|
(uint a, string memory b,,) = f();
|
||||||
a; b;
|
a; b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError: (85-118): Type string memory is not implicitly convertible to expected type uint256.
|
// TypeError: (85-118): Type string memory is not implicitly convertible to expected type uint256.
|
||||||
// TypeError: (85-118): Type uint256 is not implicitly convertible to expected type string memory.
|
// TypeError: (85-118): Type uint256 is not implicitly convertible to expected type string memory.
|
||||||
|
@ -5,6 +5,6 @@ contract C {
|
|||||||
}
|
}
|
||||||
a;
|
a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// DeclarationError: (99-100): Undeclared identifier.
|
// DeclarationError: (99-100): Undeclared identifier.
|
||||||
|
@ -4,7 +4,7 @@ contract C {
|
|||||||
(uint a, uint b, uint c) = (a, b, c);
|
(uint a, uint b, uint c) = (a, b, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// DeclarationError: (79-80): Undeclared identifier. "a" is not (or not yet) visible at this point.
|
// DeclarationError: (79-80): Undeclared identifier. "a" is not (or not yet) visible at this point.
|
||||||
// DeclarationError: (82-83): Undeclared identifier. "b" is not (or not yet) visible at this point.
|
// DeclarationError: (82-83): Undeclared identifier. "b" is not (or not yet) visible at this point.
|
||||||
|
@ -4,6 +4,6 @@ contract C {
|
|||||||
function f() internal pure returns (uint, uint, uint, S storage, uint, uint) {
|
function f() internal pure returns (uint, uint, uint, S storage, uint, uint) {
|
||||||
(,,,s.x[2](),,) = f();
|
(,,,s.x[2](),,) = f();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError: (160-168): Expression has to be an lvalue.
|
// TypeError: (160-168): Expression has to be an lvalue.
|
||||||
|
Loading…
Reference in New Issue
Block a user