mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4330 from ethereum/v050-var-keyword-preparations
drop var-keyword in compilationTests in favor of explicit types
This commit is contained in:
commit
966ecaaf79
@ -309,7 +309,7 @@ contract ico is safeMath {
|
|||||||
require( beneficiaryAddress.send(0.2 ether) );
|
require( beneficiaryAddress.send(0.2 ether) );
|
||||||
_value = safeSub(_value, 0.2 ether);
|
_value = safeSub(_value, 0.2 ether);
|
||||||
}
|
}
|
||||||
var _reward = getIcoReward(_value);
|
uint256 _reward = getIcoReward(_value);
|
||||||
require( _reward > 0 );
|
require( _reward > 0 );
|
||||||
require( token(tokenAddr).mint(beneficiaryAddress, _reward) );
|
require( token(tokenAddr).mint(beneficiaryAddress, _reward) );
|
||||||
brought[beneficiaryAddress].eth = safeAdd(brought[beneficiaryAddress].eth, _value);
|
brought[beneficiaryAddress].eth = safeAdd(brought[beneficiaryAddress].eth, _value);
|
||||||
|
@ -90,7 +90,7 @@ contract 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);
|
||||||
var (_success, _balance) = abstractModuleHandler(moduleHandlerAddress).balanceOf(address(this));
|
(bool _success, uint256 _balance) = abstractModuleHandler(moduleHandlerAddress).balanceOf(address(this));
|
||||||
require( _success );
|
require( _success );
|
||||||
if ( _balance > 0 ) {
|
if ( _balance > 0 ) {
|
||||||
require( abstractModuleHandler(moduleHandlerAddress).transfer(address(this), newModuleAddress, _balance, false) );
|
require( abstractModuleHandler(moduleHandlerAddress).transfer(address(this), newModuleAddress, _balance, false) );
|
||||||
|
@ -69,7 +69,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@call Is connect to the module or not.
|
@call Is connect to the module or not.
|
||||||
*/
|
*/
|
||||||
if ( call ) { require( abstractModule(input.addr).connectModule() ); }
|
if ( call ) { require( abstractModule(input.addr).connectModule() ); }
|
||||||
var (success, found, id) = getModuleIDByAddress(input.addr);
|
(bool success, bool found, uint256 id) = getModuleIDByAddress(input.addr);
|
||||||
require( success && ! found );
|
require( success && ! found );
|
||||||
(success, found, id) = getModuleIDByHash(input.name);
|
(success, found, id) = getModuleIDByHash(input.name);
|
||||||
require( success && ! found );
|
require( success && ! found );
|
||||||
@ -90,7 +90,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@found Is there any result.
|
@found Is there any result.
|
||||||
@success Was the transaction succesfull or not.
|
@success Was the transaction succesfull or not.
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByName(name);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName(name);
|
||||||
if ( _success && _found ) { return (true, true, modules[_id].addr); }
|
if ( _success && _found ) { return (true, true, modules[_id].addr); }
|
||||||
return (true, false, 0x00);
|
return (true, false, 0x00);
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@bool Was there any result or not.
|
@bool Was there any result or not.
|
||||||
@callCallback Call the replaceable module to confirm replacement or not.
|
@callCallback Call the replaceable module to confirm replacement or not.
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
@ -172,7 +172,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(moduleName, newModule))) ) {
|
if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(moduleName, newModule))) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var (_success, _found, _id) = getModuleIDByName(moduleName);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName(moduleName);
|
||||||
require( _success);
|
require( _success);
|
||||||
require( abstractModule(modules[_id].addr).replaceModule(newModule) );
|
require( abstractModule(modules[_id].addr).replaceModule(newModule) );
|
||||||
return true;
|
return true;
|
||||||
@ -188,7 +188,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@transferEvent Gets it new transaction notification?
|
@transferEvent Gets it new transaction notification?
|
||||||
@bool Was there any result or not.
|
@bool Was there any result or not.
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
@ -207,7 +207,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@bool Was the function successfull?
|
@bool Was the function successfull?
|
||||||
@callCallback Call the replaceable module to confirm replacement or not.
|
@callCallback Call the replaceable module to confirm replacement or not.
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
@ -229,7 +229,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(moduleName))) ) {
|
if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(moduleName))) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var (_success, _found, _id) = getModuleIDByName(moduleName);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName(moduleName);
|
||||||
require( _success);
|
require( _success);
|
||||||
require( abstractModule(modules[_id].addr).disableModule(true) );
|
require( abstractModule(modules[_id].addr).disableModule(true) );
|
||||||
return true;
|
return true;
|
||||||
@ -247,7 +247,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@value amount.
|
@value amount.
|
||||||
@bool Was the function successfull?
|
@bool Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success && _found && modules[_id].name == keccak256('Token') );
|
require( _success && _found && modules[_id].name == keccak256('Token') );
|
||||||
for ( uint256 a=0 ; a<modules.length ; a++ ) {
|
for ( uint256 a=0 ; a<modules.length ; a++ ) {
|
||||||
if ( modules[a].transferEvent && abstractModule(modules[a].addr).isActive() ) {
|
if ( modules[a].transferEvent && abstractModule(modules[a].addr).isActive() ) {
|
||||||
@ -266,7 +266,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@reward Coin emission in this Schelling round.
|
@reward Coin emission in this Schelling round.
|
||||||
@bool Was the function successfull?
|
@bool Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success && _found && modules[_id].name == keccak256('Schelling') );
|
require( _success && _found && modules[_id].name == keccak256('Schelling') );
|
||||||
for ( uint256 a=0 ; a<modules.length ; a++ ) {
|
for ( uint256 a=0 ; a<modules.length ; a++ ) {
|
||||||
if ( modules[a].schellingEvent && abstractModule(modules[a].addr).isActive() ) {
|
if ( modules[a].schellingEvent && abstractModule(modules[a].addr).isActive() ) {
|
||||||
@ -285,7 +285,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@newHandler Address of the new ModuleHandler.
|
@newHandler Address of the new ModuleHandler.
|
||||||
@bool Was the function successfull?
|
@bool Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
@ -306,7 +306,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@value balance.
|
@value balance.
|
||||||
@success was the function successfull?
|
@success was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByName('Token');
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, token(modules[_id].addr).balanceOf(owner));
|
return (true, token(modules[_id].addr).balanceOf(owner));
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@value amount.
|
@value amount.
|
||||||
@success was the function successfull?
|
@success was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByName('Token');
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, token(modules[_id].addr).totalSupply());
|
return (true, token(modules[_id].addr).totalSupply());
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@ico Is ICO in progress?.
|
@ico Is ICO in progress?.
|
||||||
@success was the function successfull?
|
@success was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByName('Token');
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, token(modules[_id].addr).isICO());
|
return (true, token(modules[_id].addr).isICO());
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@round Schelling round.
|
@round Schelling round.
|
||||||
@success was the function successfull?
|
@success was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByName('Schelling');
|
(bool _success, bool _found, uint256 _id) = getModuleIDByName('Schelling');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, schelling(modules[_id].addr).getCurrentSchellingRoundID());
|
return (true, schelling(modules[_id].addr).getCurrentSchellingRoundID());
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
|
|
||||||
@success Was the function successfull?
|
@success Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success && _found && modules[_id].name == keccak256('Provider') );
|
require( _success && _found && modules[_id].name == keccak256('Provider') );
|
||||||
(_success, _found, _id) = getModuleIDByName('Token');
|
(_success, _found, _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
@ -369,7 +369,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@fee Transaction fee will be charged or not?
|
@fee Transaction fee will be charged or not?
|
||||||
@success Was the function successfull?
|
@success Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
(_success, _found, _id) = getModuleIDByName('Token');
|
(_success, _found, _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
@ -384,7 +384,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@value Token amount.
|
@value Token amount.
|
||||||
@success Was the function successfull?
|
@success Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success && _found && modules[_id].name == keccak256('Provider') );
|
require( _success && _found && modules[_id].name == keccak256('Provider') );
|
||||||
(_success, _found, _id) = getModuleIDByName('Token');
|
(_success, _found, _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
@ -399,7 +399,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@value Token amount.
|
@value Token amount.
|
||||||
@success Was the function successfull?
|
@success Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success && _found && modules[_id].name == keccak256('Schelling') );
|
require( _success && _found && modules[_id].name == keccak256('Schelling') );
|
||||||
(_success, _found, _id) = getModuleIDByName('Token');
|
(_success, _found, _id) = getModuleIDByName('Token');
|
||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
@ -415,7 +415,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
@value New value
|
@value New value
|
||||||
@success Was the function successfull?
|
@success Was the function successfull?
|
||||||
*/
|
*/
|
||||||
var (_success, _found, _id) = getModuleIDByAddress(msg.sender);
|
(bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
if ( ! ( _found && modules[_id].name == keccak256('Publisher') )) {
|
||||||
require( block.number < debugModeUntil );
|
require( block.number < debugModeUntil );
|
||||||
|
@ -19,7 +19,7 @@ contract premium is module, safeMath {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
var (_success, _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ contract premium is module, safeMath {
|
|||||||
@remaining Tokens to be spent
|
@remaining Tokens to be spent
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
*/
|
*/
|
||||||
var (_success, _remaining, _nonce) = db.getAllowance(owner, spender);
|
(bool _success, uint256 _remaining, uint256 _nonce) = db.getAllowance(owner, spender);
|
||||||
require( _success );
|
require( _success );
|
||||||
return (_remaining, _nonce);
|
return (_remaining, _nonce);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ contract premium is module, safeMath {
|
|||||||
@success If the function was successful.
|
@success If the function was successful.
|
||||||
*/
|
*/
|
||||||
if ( from != msg.sender ) {
|
if ( from != msg.sender ) {
|
||||||
var (_success, _reamining, _nonce) = db.getAllowance(from, msg.sender);
|
(bool _success, uint256 _reamining, uint256 _nonce) = db.getAllowance(from, msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
_reamining = safeSub(_reamining, amount);
|
_reamining = safeSub(_reamining, amount);
|
||||||
_nonce = safeAdd(_nonce, 1);
|
_nonce = safeAdd(_nonce, 1);
|
||||||
@ -255,7 +255,7 @@ contract premium is module, safeMath {
|
|||||||
@extraData Extra data that will be given to the receiver
|
@extraData Extra data that will be given to the receiver
|
||||||
*/
|
*/
|
||||||
_transfer(from, to, amount);
|
_transfer(from, to, amount);
|
||||||
var (_success, _back) = thirdPartyPContractAbstract(to).receiveCorionPremiumToken(from, amount, extraData);
|
(bool _success, uint256 _back) = thirdPartyPContractAbstract(to).receiveCorionPremiumToken(from, amount, extraData);
|
||||||
require( _success );
|
require( _success );
|
||||||
require( amount > _back );
|
require( amount > _back );
|
||||||
if ( _back > 0 ) {
|
if ( _back > 0 ) {
|
||||||
|
@ -12,7 +12,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
function connectModule() external returns (bool success) {
|
function connectModule() external returns (bool success) {
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
super._connectModule();
|
super._connectModule();
|
||||||
var (_success, currentSchellingRound) = moduleHandler(moduleHandlerAddress).getCurrentSchellingRoundID();
|
(bool _success, uint256 currentSchellingRound) = moduleHandler(moduleHandlerAddress).getCurrentSchellingRoundID();
|
||||||
require( _success );
|
require( _success );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
var (_success, _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
@ -192,8 +192,8 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
@newValue new
|
@newValue new
|
||||||
@priv Is the provider private?
|
@priv Is the provider private?
|
||||||
*/
|
*/
|
||||||
var a = rightForInterest(oldValue, priv);
|
bool a = rightForInterest(oldValue, priv);
|
||||||
var b = rightForInterest(newValue, priv);
|
bool b = rightForInterest(newValue, priv);
|
||||||
if ( a && b ) {
|
if ( a && b ) {
|
||||||
globalFunds[currentSchellingRound].supply = globalFunds[currentSchellingRound].supply - oldValue + newValue;
|
globalFunds[currentSchellingRound].supply = globalFunds[currentSchellingRound].supply - oldValue + newValue;
|
||||||
} else if ( a && ! b ) {
|
} else if ( a && ! b ) {
|
||||||
@ -243,7 +243,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
require( checkCorrectRate(priv, rate) );
|
require( checkCorrectRate(priv, rate) );
|
||||||
|
|
||||||
providers[msg.sender].currentHeight++;
|
providers[msg.sender].currentHeight++;
|
||||||
var 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;
|
||||||
if ( admin == 0x00 ) {
|
if ( admin == 0x00 ) {
|
||||||
providers[msg.sender].data[currHeight].admin = msg.sender;
|
providers[msg.sender].data[currHeight].admin = msg.sender;
|
||||||
@ -284,7 +284,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
@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.
|
||||||
*/
|
*/
|
||||||
var currHeight = providers[addr].currentHeight;
|
uint256 currHeight = providers[addr].currentHeight;
|
||||||
require( providers[addr].data[currHeight].valid );
|
require( providers[addr].data[currHeight].valid );
|
||||||
require( checkCorrectRate(providers[addr].data[currHeight].priv, rate) );
|
require( checkCorrectRate(providers[addr].data[currHeight].priv, rate) );
|
||||||
require( providers[addr].data[currHeight].admin == msg.sender || msg.sender == addr );
|
require( providers[addr].data[currHeight].admin == msg.sender || msg.sender == addr );
|
||||||
@ -360,7 +360,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
It is only possible to close that active provider which is owned by the sender itself after calling the whole share of the emission.
|
It is only possible to close that active provider which is owned by the sender itself after calling the whole share of the emission.
|
||||||
Whom were connected to the provider those clients will have to disconnect after they’ve called their share of emission which was not called before.
|
Whom were connected to the provider those clients will have to disconnect after they’ve called their share of emission which was not called before.
|
||||||
*/
|
*/
|
||||||
var 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 );
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
|
|
||||||
@addr Array of the addresses for whom the connection is allowed.
|
@addr Array of the addresses for whom the connection is allowed.
|
||||||
*/
|
*/
|
||||||
var currHeight = providers[provider].currentHeight;
|
uint256 currHeight = providers[provider].currentHeight;
|
||||||
require( providers[provider].data[currHeight].valid );
|
require( providers[provider].data[currHeight].valid );
|
||||||
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 );
|
||||||
@ -395,7 +395,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
|
|
||||||
@addr Array of the addresses for whom the connection is allowed.
|
@addr Array of the addresses for whom the connection is allowed.
|
||||||
*/
|
*/
|
||||||
var currHeight = providers[provider].currentHeight;
|
uint256 currHeight = providers[provider].currentHeight;
|
||||||
require( providers[provider].data[currHeight].valid );
|
require( providers[provider].data[currHeight].valid );
|
||||||
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 );
|
||||||
@ -417,7 +417,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
|
|
||||||
@provider Address of the provider.
|
@provider Address of the provider.
|
||||||
*/
|
*/
|
||||||
var currHeight = providers[provider].currentHeight;
|
uint256 currHeight = providers[provider].currentHeight;
|
||||||
require( ! providers[msg.sender].data[currHeight].valid );
|
require( ! providers[msg.sender].data[currHeight].valid );
|
||||||
require( clients[msg.sender].providerAddress == 0x00 );
|
require( clients[msg.sender].providerAddress == 0x00 );
|
||||||
require( providers[provider].data[currHeight].valid );
|
require( providers[provider].data[currHeight].valid );
|
||||||
@ -425,7 +425,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
require( providers[provider].data[currHeight].allowedUsers[msg.sender] &&
|
require( providers[provider].data[currHeight].allowedUsers[msg.sender] &&
|
||||||
providers[provider].data[currHeight].clientsCount < privateProviderLimit );
|
providers[provider].data[currHeight].clientsCount < privateProviderLimit );
|
||||||
}
|
}
|
||||||
var 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);
|
||||||
@ -445,9 +445,9 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
Before disconnecting we should poll our share from the token emission even if there was nothing factually.
|
Before disconnecting we should poll our share from the token emission even if there was nothing factually.
|
||||||
It is only possible to disconnect those providers who were connected by us before.
|
It is only possible to disconnect those providers who were connected by us before.
|
||||||
*/
|
*/
|
||||||
var provider = clients[msg.sender].providerAddress;
|
address provider = clients[msg.sender].providerAddress;
|
||||||
require( provider != 0x0 );
|
require( provider != 0x0 );
|
||||||
var currHeight = clients[msg.sender].providerHeight;
|
uint256 currHeight = clients[msg.sender].providerHeight;
|
||||||
bool providerHasClosed = false;
|
bool providerHasClosed = false;
|
||||||
if ( providers[provider].data[currHeight].close > 0 ) {
|
if ( providers[provider].data[currHeight].close > 0 ) {
|
||||||
providerHasClosed = true;
|
providerHasClosed = true;
|
||||||
@ -456,7 +456,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
require( clients[msg.sender].paidUpTo == currentSchellingRound );
|
require( clients[msg.sender].paidUpTo == currentSchellingRound );
|
||||||
}
|
}
|
||||||
|
|
||||||
var bal = getTokenBalance(msg.sender);
|
uint256 bal = getTokenBalance(msg.sender);
|
||||||
if ( ! providerHasClosed ) {
|
if ( ! providerHasClosed ) {
|
||||||
providers[provider].data[currHeight].clientsCount--;
|
providers[provider].data[currHeight].clientsCount--;
|
||||||
checkFloatingSupply(provider, currHeight, true, bal);
|
checkFloatingSupply(provider, currHeight, true, bal);
|
||||||
@ -500,9 +500,9 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
@provider Address of the provider
|
@provider Address of the provider
|
||||||
@reward Accumulated amount from the previous rounds.
|
@reward Accumulated amount from the previous rounds.
|
||||||
*/
|
*/
|
||||||
var _limit = limit;
|
uint256 _limit = limit;
|
||||||
var _beneficiary = beneficiary;
|
address _beneficiary = beneficiary;
|
||||||
var _provider = provider;
|
address _provider = provider;
|
||||||
if ( _limit == 0 ) { _limit = gasProtectMaxRounds; }
|
if ( _limit == 0 ) { _limit = gasProtectMaxRounds; }
|
||||||
if ( _beneficiary == 0x00 ) { _beneficiary = msg.sender; }
|
if ( _beneficiary == 0x00 ) { _beneficiary = msg.sender; }
|
||||||
if ( _provider == 0x00 ) { _provider = msg.sender; }
|
if ( _provider == 0x00 ) { _provider = msg.sender; }
|
||||||
@ -537,7 +537,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
uint256 provHeight;
|
uint256 provHeight;
|
||||||
bool interest = false;
|
bool interest = false;
|
||||||
uint256 a;
|
uint256 a;
|
||||||
var rate = clients[msg.sender].lastRate;
|
uint8 rate = clients[msg.sender].lastRate;
|
||||||
for ( a = (clients[msg.sender].paidUpTo + 1) ; a <= currentSchellingRound ; a++ ) {
|
for ( a = (clients[msg.sender].paidUpTo + 1) ; a <= currentSchellingRound ; a++ ) {
|
||||||
if (globalFunds[a].reward > 0 && globalFunds[a].supply > 0) {
|
if (globalFunds[a].reward > 0 && globalFunds[a].supply > 0) {
|
||||||
provAddr = clients[msg.sender].providerAddress;
|
provAddr = clients[msg.sender].providerAddress;
|
||||||
@ -587,7 +587,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
uint256 currHeight = providers[addr].currentHeight;
|
uint256 currHeight = providers[addr].currentHeight;
|
||||||
uint256 LTSID = providers[addr].data[currHeight].lastSupplyID;
|
uint256 LTSID = providers[addr].data[currHeight].lastSupplyID;
|
||||||
uint256 a;
|
uint256 a;
|
||||||
var rate = providers[addr].data[currHeight].lastPaidRate;
|
uint8 rate = providers[addr].data[currHeight].lastPaidRate;
|
||||||
for ( a = (providers[addr].data[currHeight].paidUpTo + 1) ; a <= currentSchellingRound ; a++ ) {
|
for ( a = (providers[addr].data[currHeight].paidUpTo + 1) ; a <= currentSchellingRound ; a++ ) {
|
||||||
if (globalFunds[a].reward > 0 && globalFunds[a].supply > 0) {
|
if (globalFunds[a].reward > 0 && globalFunds[a].supply > 0) {
|
||||||
if ( providers[addr].data[currHeight].rateHistory[a].valid ) {
|
if ( providers[addr].data[currHeight].rateHistory[a].valid ) {
|
||||||
@ -754,7 +754,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
clients[addr].supply[currentSchellingRound] = TEMath(clients[addr].supply[currentSchellingRound], value, neg);
|
clients[addr].supply[currentSchellingRound] = TEMath(clients[addr].supply[currentSchellingRound], value, neg);
|
||||||
}
|
}
|
||||||
} else if ( providers[addr].data[providers[addr].currentHeight].valid ) {
|
} else if ( providers[addr].data[providers[addr].currentHeight].valid ) {
|
||||||
var currentHeight = providers[addr].currentHeight;
|
uint256 currentHeight = providers[addr].currentHeight;
|
||||||
if ( neg ) {
|
if ( neg ) {
|
||||||
uint256 balance = getTokenBalance(addr);
|
uint256 balance = getTokenBalance(addr);
|
||||||
if ( providers[addr].data[currentHeight].priv ) {
|
if ( providers[addr].data[currentHeight].priv ) {
|
||||||
@ -776,7 +776,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
|
|
||||||
@balance Balance of the address.
|
@balance Balance of the address.
|
||||||
*/
|
*/
|
||||||
var (_success, _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
||||||
require( _success );
|
require( _success );
|
||||||
return _balance;
|
return _balance;
|
||||||
}
|
}
|
||||||
@ -786,7 +786,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
|
|
||||||
@isICO Is the ICO in proccess or not?
|
@isICO Is the ICO in proccess or not?
|
||||||
*/
|
*/
|
||||||
var (_success, _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
||||||
require( _success );
|
require( _success );
|
||||||
return _isICO;
|
return _isICO;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ contract publisher is announcementTypes, module, safeMath {
|
|||||||
@success Opposed or not
|
@success Opposed or not
|
||||||
*/
|
*/
|
||||||
if ( ! oppositable ) { return false; }
|
if ( ! oppositable ) { return false; }
|
||||||
var (_success, _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;
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ contract publisher is announcementTypes, module, safeMath {
|
|||||||
newArrayID = a;
|
newArrayID = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var (_success, _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 ) {
|
||||||
@ -266,7 +266,7 @@ contract publisher is announcementTypes, module, safeMath {
|
|||||||
Inner function to check the ICO status.
|
Inner function to check the ICO status.
|
||||||
@bool Is the ICO in proccess or not?
|
@bool Is the ICO in proccess or not?
|
||||||
*/
|
*/
|
||||||
var (_success, _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
|
||||||
require( _success );
|
require( _success );
|
||||||
return _isICO;
|
return _isICO;
|
||||||
}
|
}
|
||||||
|
@ -151,15 +151,15 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
*/
|
*/
|
||||||
require( super.isModuleHandler(msg.sender) );
|
require( super.isModuleHandler(msg.sender) );
|
||||||
if ( to == address(this) ) {
|
if ( to == address(this) ) {
|
||||||
var currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
var round = getRound(currentRound);
|
schellingVars._rounds memory round = getRound(currentRound);
|
||||||
round.reward += value;
|
round.reward += value;
|
||||||
setRound(currentRound, round);
|
setRound(currentRound, round);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
var (_success, _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
Schelling database functions.
|
Schelling database functions.
|
||||||
*/
|
*/
|
||||||
function getFunds(address addr) internal returns (uint256) {
|
function getFunds(address addr) internal returns (uint256) {
|
||||||
var (a, b) = db.getFunds(addr);
|
(bool a, uint256 b) = db.getFunds(addr);
|
||||||
require( a );
|
require( a );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
function getVoter(address addr) internal returns (_voter) {
|
function getVoter(address addr) internal returns (_voter) {
|
||||||
var (a, b, c, d, e, f) = db.getVoter(addr);
|
(bool a, uint256 b, bytes32 c, schellingVars.voterStatus d, bool e, uint256 f) = db.getVoter(addr);
|
||||||
require( a );
|
require( a );
|
||||||
return _voter(b, c, d, e, f);
|
return _voter(b, c, d, e, f);
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
function pushRound(_rounds round) internal returns (uint256) {
|
function pushRound(_rounds round) internal returns (uint256) {
|
||||||
var (a, b) = db.pushRound(
|
(bool a, uint256 b) = db.pushRound(
|
||||||
round.totalAboveWeight,
|
round.totalAboveWeight,
|
||||||
round.totalBelowWeight,
|
round.totalBelowWeight,
|
||||||
round.reward,
|
round.reward,
|
||||||
@ -209,12 +209,12 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
function getRound(uint256 id) internal returns (_rounds) {
|
function getRound(uint256 id) internal returns (_rounds) {
|
||||||
var (a, b, c, d, e, f) = db.getRound(id);
|
(bool a, uint256 b, uint256 c, uint256 d, uint256 e, bool f) = db.getRound(id);
|
||||||
require( a );
|
require( a );
|
||||||
return _rounds(b, c, d, e, f);
|
return _rounds(b, c, d, e, f);
|
||||||
}
|
}
|
||||||
function getCurrentRound() internal returns (uint256) {
|
function getCurrentRound() internal returns (uint256) {
|
||||||
var (a, b) = db.getCurrentRound();
|
(bool a, uint256 b) = db.getCurrentRound();
|
||||||
require( a );
|
require( a );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
require( db.setCurrentSchellingRound(id) );
|
require( db.setCurrentSchellingRound(id) );
|
||||||
}
|
}
|
||||||
function getCurrentSchellingRound() internal returns(uint256) {
|
function getCurrentSchellingRound() internal returns(uint256) {
|
||||||
var (a, b) = db.getCurrentSchellingRound();
|
(bool a, uint256 b) = db.getCurrentSchellingRound();
|
||||||
require( a );
|
require( a );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
require( db.setSchellingExpansion(id, amount) );
|
require( db.setSchellingExpansion(id, amount) );
|
||||||
}
|
}
|
||||||
function getSchellingExpansion(uint256 id) internal returns(uint256) {
|
function getSchellingExpansion(uint256 id) internal returns(uint256) {
|
||||||
var (a, b) = db.getSchellingExpansion(id);
|
(bool a, uint256 b) = db.getSchellingExpansion(id);
|
||||||
require( a );
|
require( a );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -289,8 +289,8 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
*/
|
*/
|
||||||
nextRound();
|
nextRound();
|
||||||
|
|
||||||
var currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
var round = getRound(currentRound);
|
schellingVars._rounds memory round = getRound(currentRound);
|
||||||
_voter memory voter;
|
_voter memory voter;
|
||||||
uint256 funds;
|
uint256 funds;
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
*/
|
*/
|
||||||
nextRound();
|
nextRound();
|
||||||
|
|
||||||
var currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
_rounds memory round;
|
_rounds memory round;
|
||||||
_voter memory voter;
|
_voter memory voter;
|
||||||
uint256 funds;
|
uint256 funds;
|
||||||
@ -369,7 +369,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
*/
|
*/
|
||||||
nextRound();
|
nextRound();
|
||||||
|
|
||||||
var currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
_rounds memory round;
|
_rounds memory round;
|
||||||
_voter memory voter;
|
_voter memory voter;
|
||||||
uint256 funds;
|
uint256 funds;
|
||||||
@ -403,8 +403,8 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
@beneficiary Address of the beneficiary
|
@beneficiary Address of the beneficiary
|
||||||
*/
|
*/
|
||||||
var voter = getVoter(msg.sender);
|
schellingVars._voter memory voter = getVoter(msg.sender);
|
||||||
var funds = getFunds(msg.sender);
|
uint256 funds = getFunds(msg.sender);
|
||||||
|
|
||||||
address _beneficiary = msg.sender;
|
address _beneficiary = msg.sender;
|
||||||
if (beneficiary != 0x0) { _beneficiary = beneficiary; }
|
if (beneficiary != 0x0) { _beneficiary = beneficiary; }
|
||||||
@ -423,18 +423,18 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
@reward Prize
|
@reward Prize
|
||||||
*/
|
*/
|
||||||
var voter = getVoter(msg.sender);
|
schellingVars._voter memory voter = getVoter(msg.sender);
|
||||||
return voter.rewards;
|
return voter.rewards;
|
||||||
}
|
}
|
||||||
function nextRound() internal returns (bool) {
|
function nextRound() internal returns (bool) {
|
||||||
/*
|
/*
|
||||||
Inside function, checks the time of the Schelling round and if its needed, creates a new Schelling round.
|
Inside function, checks the time of the Schelling round and if its needed, creates a new Schelling round.
|
||||||
*/
|
*/
|
||||||
var currentRound = getCurrentRound();
|
uint256 currentRound = getCurrentRound();
|
||||||
var round = getRound(currentRound);
|
_rounds memory round = getRound(currentRound);
|
||||||
_rounds memory newRound;
|
_rounds memory newRound;
|
||||||
_rounds memory prevRound;
|
_rounds memory prevRound;
|
||||||
var currentSchellingRound = getCurrentSchellingRound();
|
uint256 currentSchellingRound = getCurrentSchellingRound();
|
||||||
|
|
||||||
if ( round.blockHeight+roundBlockDelay > block.number) { return false; }
|
if ( round.blockHeight+roundBlockDelay > block.number) { return false; }
|
||||||
|
|
||||||
@ -469,10 +469,10 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
@amount Amount of deposit.
|
@amount Amount of deposit.
|
||||||
*/
|
*/
|
||||||
var voter = getVoter(msg.sender);
|
_voter memory voter = getVoter(msg.sender);
|
||||||
var funds = getFunds(msg.sender);
|
uint256 funds = getFunds(msg.sender);
|
||||||
|
|
||||||
var (a, 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 );
|
||||||
@ -487,8 +487,8 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
If the deposit isn’t lost, it can be withdrawn.
|
If the deposit isn’t lost, it can be withdrawn.
|
||||||
By withdrawn, the deposit will be sent from Schelling address to the users address, charged with transaction fee..
|
By withdrawn, the deposit will be sent from Schelling address to the users address, charged with transaction fee..
|
||||||
*/
|
*/
|
||||||
var voter = getVoter(msg.sender);
|
_voter memory voter = getVoter(msg.sender);
|
||||||
var 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 );
|
||||||
@ -550,7 +550,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
@uint256 Whole token amount
|
@uint256 Whole token amount
|
||||||
*/
|
*/
|
||||||
var (_success, _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
|
(bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
|
||||||
require( _success );
|
require( _success );
|
||||||
return _amount;
|
return _amount;
|
||||||
}
|
}
|
||||||
@ -563,7 +563,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
@balance Balance of the address.
|
@balance Balance of the address.
|
||||||
*/
|
*/
|
||||||
var (_success, _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
(bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr);
|
||||||
require( _success );
|
require( _success );
|
||||||
return _balance;
|
return _balance;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
modifier isReady {
|
modifier isReady {
|
||||||
var (_success, _active) = super.isActive();
|
(bool _success, bool _active) = super.isActive();
|
||||||
require( _success && _active );
|
require( _success && _active );
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
@remaining Tokens to be spent
|
@remaining Tokens to be spent
|
||||||
@nonce Transaction count
|
@nonce Transaction count
|
||||||
*/
|
*/
|
||||||
var (_success, _remaining, _nonce) = db.getAllowance(owner, spender);
|
(bool _success, uint256 _remaining, uint256 _nonce) = db.getAllowance(owner, spender);
|
||||||
require( _success );
|
require( _success );
|
||||||
return (_remaining, _nonce);
|
return (_remaining, _nonce);
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
@success Was the Function successful?
|
@success Was the Function successful?
|
||||||
*/
|
*/
|
||||||
if ( from != msg.sender ) {
|
if ( from != msg.sender ) {
|
||||||
var (_success, _reamining, _nonce) = db.getAllowance(from, msg.sender);
|
(bool _success, uint256 _reamining, uint256 _nonce) = db.getAllowance(from, msg.sender);
|
||||||
require( _success );
|
require( _success );
|
||||||
_reamining = safeSub(_reamining, amount);
|
_reamining = safeSub(_reamining, amount);
|
||||||
_nonce = safeAdd(_nonce, 1);
|
_nonce = safeAdd(_nonce, 1);
|
||||||
@ -298,7 +298,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
@extraData Extra data the receiver will get
|
@extraData Extra data the receiver will get
|
||||||
*/
|
*/
|
||||||
_transfer(from, to, amount, exchangeAddress == to);
|
_transfer(from, to, amount, exchangeAddress == to);
|
||||||
var (_success, _back) = thirdPartyContractAbstract(to).receiveCorionToken(from, amount, extraData);
|
(bool _success, uint256 _back) = thirdPartyContractAbstract(to).receiveCorionToken(from, amount, extraData);
|
||||||
require( _success );
|
require( _success );
|
||||||
require( amount > _back );
|
require( amount > _back );
|
||||||
if ( _back > 0 ) {
|
if ( _back > 0 ) {
|
||||||
@ -321,7 +321,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
@fee Deduct transaction fee - yes or no?
|
@fee Deduct transaction fee - yes or no?
|
||||||
*/
|
*/
|
||||||
if( fee ) {
|
if( fee ) {
|
||||||
var (success, _fee) = getTransactionFee(amount);
|
(bool success, uint256 _fee) = getTransactionFee(amount);
|
||||||
require( success );
|
require( success );
|
||||||
require( db.balanceOf(from) >= amount + _fee );
|
require( db.balanceOf(from) >= amount + _fee );
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
@value Quantity to calculate the fee
|
@value Quantity to calculate the fee
|
||||||
*/
|
*/
|
||||||
if ( isICO ) { return; }
|
if ( isICO ) { return; }
|
||||||
var (_success, _fee) = getTransactionFee(value);
|
(bool _success, uint256 _fee) = getTransactionFee(value);
|
||||||
require( _success );
|
require( _success );
|
||||||
uint256 _forBurn = _fee * transactionFeeBurn / 100;
|
uint256 _forBurn = _fee * transactionFeeBurn / 100;
|
||||||
uint256 _forSchelling = _fee - _forBurn;
|
uint256 _forSchelling = _fee - _forBurn;
|
||||||
|
@ -95,7 +95,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
// The price function is exp(quantities[i]/b) / sum(exp(q/b) for q in quantities)
|
// The price function is exp(quantities[i]/b) / sum(exp(q/b) for q in quantities)
|
||||||
// To avoid overflow, calculate with
|
// To avoid overflow, calculate with
|
||||||
// exp(quantities[i]/b - offset) / sum(exp(q/b - offset) for q in quantities)
|
// exp(quantities[i]/b - offset) / sum(exp(q/b - offset) for q in quantities)
|
||||||
var (sum, , outcomeExpTerm) = sumExpOffset(logN, netOutcomeTokensSold, funding, outcomeTokenIndex);
|
(uint256 sum, , uint256 outcomeExpTerm) = sumExpOffset(logN, netOutcomeTokensSold, funding, outcomeTokenIndex);
|
||||||
return outcomeExpTerm / (sum / ONE);
|
return outcomeExpTerm / (sum / ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
// The cost function is C = b * log(sum(exp(q/b) for q in quantities)).
|
// The cost function is C = b * log(sum(exp(q/b) for q in quantities)).
|
||||||
// To avoid overflow, we need to calc with an exponent offset:
|
// To avoid overflow, we need to calc with an exponent offset:
|
||||||
// C = b * (offset + log(sum(exp(q/b - offset) for q in quantities)))
|
// C = b * (offset + log(sum(exp(q/b - offset) for q in quantities)))
|
||||||
var (sum, offset, ) = sumExpOffset(logN, netOutcomeTokensSold, funding, 0);
|
(uint256 sum, int256 offset, ) = sumExpOffset(logN, netOutcomeTokensSold, funding, 0);
|
||||||
costLevel = Math.ln(sum);
|
costLevel = Math.ln(sum);
|
||||||
costLevel = costLevel.add(offset);
|
costLevel = costLevel.add(offset);
|
||||||
costLevel = (costLevel.mul(int(ONE)) / logN).mul(int(funding));
|
costLevel = (costLevel.mul(int(ONE)) / logN).mul(int(funding));
|
||||||
|
@ -72,7 +72,7 @@ contract MajorityOracle is Oracle {
|
|||||||
constant
|
constant
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
var (outcomeSet, ) = getStatusAndOutcome();
|
(bool outcomeSet, ) = getStatusAndOutcome();
|
||||||
return outcomeSet;
|
return outcomeSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ contract MajorityOracle is Oracle {
|
|||||||
constant
|
constant
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
var (, winningOutcome) = getStatusAndOutcome();
|
(, int winningOutcome) = getStatusAndOutcome();
|
||||||
return winningOutcome;
|
return winningOutcome;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,22 +216,22 @@ contract MilestoneTracker {
|
|||||||
// Decode the RLP encoded milestones and add them to the milestones list
|
// Decode the RLP encoded milestones and add them to the milestones list
|
||||||
bytes memory mProposedMilestones = proposedMilestones;
|
bytes memory mProposedMilestones = proposedMilestones;
|
||||||
|
|
||||||
var itmProposals = mProposedMilestones.toRLPItem(true);
|
RLP.RLPItem memory itmProposals = mProposedMilestones.toRLPItem(true);
|
||||||
|
|
||||||
if (!itmProposals.isList()) throw;
|
if (!itmProposals.isList()) throw;
|
||||||
|
|
||||||
var itrProposals = itmProposals.iterator();
|
RLP.Iterator memory itrProposals = itmProposals.iterator();
|
||||||
|
|
||||||
while(itrProposals.hasNext()) {
|
while(itrProposals.hasNext()) {
|
||||||
|
|
||||||
|
|
||||||
var itmProposal = itrProposals.next();
|
RLP.RLPItem memory itmProposal = itrProposals.next();
|
||||||
|
|
||||||
Milestone milestone = milestones[milestones.length ++];
|
Milestone milestone = milestones[milestones.length ++];
|
||||||
|
|
||||||
if (!itmProposal.isList()) throw;
|
if (!itmProposal.isList()) throw;
|
||||||
|
|
||||||
var itrProposal = itmProposal.iterator();
|
RLP.Iterator memory itrProposal = itmProposal.iterator();
|
||||||
|
|
||||||
milestone.description = itrProposal.next().toAscii();
|
milestone.description = itrProposal.next().toAscii();
|
||||||
milestone.url = itrProposal.next().toAscii();
|
milestone.url = itrProposal.next().toAscii();
|
||||||
|
@ -32,8 +32,8 @@ library RLP {
|
|||||||
|
|
||||||
function next(Iterator memory self) internal constant returns (RLPItem memory subItem) {
|
function next(Iterator memory self) internal constant returns (RLPItem memory subItem) {
|
||||||
if(hasNext(self)) {
|
if(hasNext(self)) {
|
||||||
var ptr = self._unsafe_nextPtr;
|
uint ptr = self._unsafe_nextPtr;
|
||||||
var itemLength = _itemLength(ptr);
|
uint itemLength = _itemLength(ptr);
|
||||||
subItem._unsafe_memPtr = ptr;
|
subItem._unsafe_memPtr = ptr;
|
||||||
subItem._unsafe_length = itemLength;
|
subItem._unsafe_length = itemLength;
|
||||||
self._unsafe_nextPtr = ptr + itemLength;
|
self._unsafe_nextPtr = ptr + itemLength;
|
||||||
@ -50,7 +50,7 @@ library RLP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasNext(Iterator memory self) internal constant returns (bool) {
|
function hasNext(Iterator memory self) internal constant returns (bool) {
|
||||||
var item = self._unsafe_item;
|
RLPItem memory item = self._unsafe_item;
|
||||||
return self._unsafe_nextPtr < item._unsafe_memPtr + item._unsafe_length;
|
return self._unsafe_nextPtr < item._unsafe_memPtr + item._unsafe_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ library RLP {
|
|||||||
/// @param strict Will throw if the data is not RLP encoded.
|
/// @param strict Will throw if the data is not RLP encoded.
|
||||||
/// @return An RLPItem
|
/// @return An RLPItem
|
||||||
function toRLPItem(bytes memory self, bool strict) internal constant returns (RLPItem memory) {
|
function toRLPItem(bytes memory self, bool strict) internal constant returns (RLPItem memory) {
|
||||||
var item = toRLPItem(self);
|
RLPItem memory item = toRLPItem(self);
|
||||||
if(strict) {
|
if(strict) {
|
||||||
uint len = self.length;
|
uint len = self.length;
|
||||||
if(_payloadOffset(item) > len)
|
if(_payloadOffset(item) > len)
|
||||||
@ -170,7 +170,7 @@ library RLP {
|
|||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The bytes.
|
/// @return The bytes.
|
||||||
function toBytes(RLPItem memory self) internal constant returns (bytes memory bts) {
|
function toBytes(RLPItem memory self) internal constant returns (bytes memory bts) {
|
||||||
var len = self._unsafe_length;
|
uint len = self._unsafe_length;
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
bts = new bytes(len);
|
bts = new bytes(len);
|
||||||
@ -184,7 +184,7 @@ library RLP {
|
|||||||
function toData(RLPItem memory self) internal constant returns (bytes memory bts) {
|
function toData(RLPItem memory self) internal constant returns (bytes memory bts) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
var (rStartPos, len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
bts = new bytes(len);
|
bts = new bytes(len);
|
||||||
_copyToBytes(rStartPos, bts, len);
|
_copyToBytes(rStartPos, bts, len);
|
||||||
}
|
}
|
||||||
@ -196,9 +196,9 @@ library RLP {
|
|||||||
function toList(RLPItem memory self) internal constant returns (RLPItem[] memory list) {
|
function toList(RLPItem memory self) internal constant returns (RLPItem[] memory list) {
|
||||||
if(!isList(self))
|
if(!isList(self))
|
||||||
throw;
|
throw;
|
||||||
var numItems = items(self);
|
uint numItems = items(self);
|
||||||
list = new RLPItem[](numItems);
|
list = new RLPItem[](numItems);
|
||||||
var it = iterator(self);
|
Iterator memory it = iterator(self);
|
||||||
uint idx;
|
uint idx;
|
||||||
while(hasNext(it)) {
|
while(hasNext(it)) {
|
||||||
list[idx] = next(it);
|
list[idx] = next(it);
|
||||||
@ -213,7 +213,7 @@ library RLP {
|
|||||||
function toAscii(RLPItem memory self) internal constant returns (string memory str) {
|
function toAscii(RLPItem memory self) internal constant returns (string memory str) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
var (rStartPos, len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
bytes memory bts = new bytes(len);
|
bytes memory bts = new bytes(len);
|
||||||
_copyToBytes(rStartPos, bts, len);
|
_copyToBytes(rStartPos, bts, len);
|
||||||
str = string(bts);
|
str = string(bts);
|
||||||
@ -226,7 +226,7 @@ library RLP {
|
|||||||
function toUint(RLPItem memory self) internal constant returns (uint data) {
|
function toUint(RLPItem memory self) internal constant returns (uint data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
var (rStartPos, len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
if (len > 32 || len == 0)
|
if (len > 32 || len == 0)
|
||||||
throw;
|
throw;
|
||||||
assembly {
|
assembly {
|
||||||
@ -241,7 +241,7 @@ library RLP {
|
|||||||
function toBool(RLPItem memory self) internal constant returns (bool data) {
|
function toBool(RLPItem memory self) internal constant returns (bool data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
var (rStartPos, len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
if (len != 1)
|
if (len != 1)
|
||||||
throw;
|
throw;
|
||||||
uint temp;
|
uint temp;
|
||||||
@ -260,7 +260,7 @@ library RLP {
|
|||||||
function toByte(RLPItem memory self) internal constant returns (byte data) {
|
function toByte(RLPItem memory self) internal constant returns (byte data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
var (rStartPos, len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
if (len != 1)
|
if (len != 1)
|
||||||
throw;
|
throw;
|
||||||
uint8 temp;
|
uint8 temp;
|
||||||
@ -293,7 +293,7 @@ library RLP {
|
|||||||
function toAddress(RLPItem memory self) internal constant returns (address data) {
|
function toAddress(RLPItem memory self) internal constant returns (address data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
var (rStartPos, len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
if (len != 20)
|
if (len != 20)
|
||||||
throw;
|
throw;
|
||||||
assembly {
|
assembly {
|
||||||
|
@ -135,7 +135,7 @@ library strings {
|
|||||||
* @return A newly allocated string containing the slice's text.
|
* @return A newly allocated string containing the slice's text.
|
||||||
*/
|
*/
|
||||||
function toString(slice self) internal returns (string) {
|
function toString(slice self) internal returns (string) {
|
||||||
var ret = new string(self._len);
|
string memory ret = new string(self._len);
|
||||||
uint retptr;
|
uint retptr;
|
||||||
assembly { retptr := add(ret, 32) }
|
assembly { retptr := add(ret, 32) }
|
||||||
|
|
||||||
@ -153,8 +153,8 @@ library strings {
|
|||||||
*/
|
*/
|
||||||
function len(slice self) internal returns (uint) {
|
function len(slice self) internal returns (uint) {
|
||||||
// Starting at ptr-31 means the LSB will be the byte we care about
|
// Starting at ptr-31 means the LSB will be the byte we care about
|
||||||
var ptr = self._ptr - 31;
|
uint ptr = self._ptr - 31;
|
||||||
var end = ptr + self._len;
|
uint end = ptr + self._len;
|
||||||
uint len;
|
uint len;
|
||||||
for (len = 0; ptr < end; len++) {
|
for (len = 0; ptr < end; len++) {
|
||||||
uint8 b;
|
uint8 b;
|
||||||
@ -199,8 +199,8 @@ library strings {
|
|||||||
if (other._len < self._len)
|
if (other._len < self._len)
|
||||||
shortest = other._len;
|
shortest = other._len;
|
||||||
|
|
||||||
var selfptr = self._ptr;
|
uint selfptr = self._ptr;
|
||||||
var otherptr = other._ptr;
|
uint otherptr = other._ptr;
|
||||||
for (uint idx = 0; idx < shortest; idx += 32) {
|
for (uint idx = 0; idx < shortest; idx += 32) {
|
||||||
uint a;
|
uint a;
|
||||||
uint b;
|
uint b;
|
||||||
@ -211,7 +211,7 @@ library strings {
|
|||||||
if (a != b) {
|
if (a != b) {
|
||||||
// Mask out irrelevant bytes and check again
|
// Mask out irrelevant bytes and check again
|
||||||
uint mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
|
uint mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
|
||||||
var diff = (a & mask) - (b & mask);
|
uint diff = (a & mask) - (b & mask);
|
||||||
if (diff != 0)
|
if (diff != 0)
|
||||||
return int(diff);
|
return int(diff);
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ library strings {
|
|||||||
|
|
||||||
// Load the rune into the MSBs of b
|
// Load the rune into the MSBs of b
|
||||||
assembly { word:= mload(mload(add(self, 32))) }
|
assembly { word:= mload(mload(add(self, 32))) }
|
||||||
var b = word / div;
|
uint b = word / div;
|
||||||
if (b < 0x80) {
|
if (b < 0x80) {
|
||||||
ret = b;
|
ret = b;
|
||||||
len = 1;
|
len = 1;
|
||||||
@ -410,7 +410,7 @@ library strings {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var selfptr = self._ptr + self._len - needle._len;
|
uint selfptr = self._ptr + self._len - needle._len;
|
||||||
|
|
||||||
if (selfptr == needle._ptr) {
|
if (selfptr == needle._ptr) {
|
||||||
return true;
|
return true;
|
||||||
@ -438,7 +438,7 @@ library strings {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
var selfptr = self._ptr + self._len - needle._len;
|
uint selfptr = self._ptr + self._len - needle._len;
|
||||||
bool equal = true;
|
bool equal = true;
|
||||||
if (selfptr != needle._ptr) {
|
if (selfptr != needle._ptr) {
|
||||||
assembly {
|
assembly {
|
||||||
@ -668,7 +668,7 @@ library strings {
|
|||||||
* @return The concatenation of the two strings.
|
* @return The concatenation of the two strings.
|
||||||
*/
|
*/
|
||||||
function concat(slice self, slice other) internal returns (string) {
|
function concat(slice self, slice other) internal returns (string) {
|
||||||
var ret = new string(self._len + other._len);
|
string memory ret = new string(self._len + other._len);
|
||||||
uint retptr;
|
uint retptr;
|
||||||
assembly { retptr := add(ret, 32) }
|
assembly { retptr := add(ret, 32) }
|
||||||
memcpy(retptr, self._ptr, self._len);
|
memcpy(retptr, self._ptr, self._len);
|
||||||
@ -692,7 +692,7 @@ library strings {
|
|||||||
for(uint i = 0; i < parts.length; i++)
|
for(uint i = 0; i < parts.length; i++)
|
||||||
len += parts[i]._len;
|
len += parts[i]._len;
|
||||||
|
|
||||||
var ret = new string(len);
|
string memory ret = new string(len);
|
||||||
uint retptr;
|
uint retptr;
|
||||||
assembly { retptr := add(ret, 32) }
|
assembly { retptr := add(ret, 32) }
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ contract Shareable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint256 ownerIndexBit = 2**index;
|
uint256 ownerIndexBit = 2**index;
|
||||||
var pending = pendings[_operation];
|
PendingState memory pending = pendings[_operation];
|
||||||
if (pending.ownersDone & ownerIndexBit > 0) {
|
if (pending.ownersDone & ownerIndexBit > 0) {
|
||||||
pending.yetNeeded++;
|
pending.yetNeeded++;
|
||||||
pending.ownersDone -= ownerIndexBit;
|
pending.ownersDone -= ownerIndexBit;
|
||||||
@ -116,7 +116,7 @@ contract Shareable {
|
|||||||
* @return True if the owner has confirmed and false otherwise.
|
* @return True if the owner has confirmed and false otherwise.
|
||||||
*/
|
*/
|
||||||
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
|
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
|
||||||
var pending = pendings[_operation];
|
PendingState memory pending = pendings[_operation];
|
||||||
uint256 index = ownerIndex[_owner];
|
uint256 index = ownerIndex[_owner];
|
||||||
|
|
||||||
// make sure they're an owner
|
// make sure they're an owner
|
||||||
@ -142,7 +142,7 @@ contract Shareable {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pending = pendings[_operation];
|
PendingState memory pending = pendings[_operation];
|
||||||
// if we're not yet working on this operation, switch over and reset the confirmation status.
|
// if we're not yet working on this operation, switch over and reset the confirmation status.
|
||||||
if (pending.yetNeeded == 0) {
|
if (pending.yetNeeded == 0) {
|
||||||
// reset count of confirmations needed.
|
// reset count of confirmations needed.
|
||||||
|
@ -24,7 +24,7 @@ contract StandardToken is ERC20, BasicToken {
|
|||||||
* @param _value uint256 the amout of tokens to be transfered
|
* @param _value uint256 the amout of tokens to be transfered
|
||||||
*/
|
*/
|
||||||
function transferFrom(address _from, address _to, uint256 _value) {
|
function transferFrom(address _from, address _to, uint256 _value) {
|
||||||
var _allowance = allowed[_from][msg.sender];
|
uint256 _allowance = allowed[_from][msg.sender];
|
||||||
|
|
||||||
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
|
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
|
||||||
// if (_value > _allowance) throw;
|
// if (_value > _allowance) throw;
|
||||||
|
Loading…
Reference in New Issue
Block a user