KyberNetwork

SanityRates

0xdfc85C08d5e5924aB49750E006CF8a826ffb7B13
PermissionGroups
function

removeOperator

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
operatoraddress

Outputs

(void)
     function removeOperator (address operator) public onlyAdmin {
         require(operators[operator]);
         operators[operator] = false;
 
         for (uint i = 0; i < operatorsGroup.length; ++i) {
             if (operatorsGroup[i] == operator) {
                 operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1];
                 operatorsGroup.length -= 1;
                 OperatorAdded(operator, false);
                 break;
             }
         }
     }
 
function

addOperator

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
newOperatoraddress

Outputs

(void)
     function addOperator(address newOperator) public onlyAdmin {
         require(!operators[newOperator]); // prevent duplicates.
         require(operatorsGroup.length < MAX_GROUP_SIZE);
 
         OperatorAdded(newOperator, true);
         operators[newOperator] = true;
         operatorsGroup.push(newOperator);
     }
 
function

transferAdminQuickly

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
newAdminaddress

Outputs

(void)
     function transferAdminQuickly(address newAdmin) public onlyAdmin {
         require(newAdmin != address(0));
         TransferAdminPending(newAdmin);
         AdminClaimed(newAdmin, admin);
         admin = newAdmin;
     }
 
function

transferAdmin

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
newAdminaddress

Outputs

(void)
     function transferAdmin(address newAdmin) public onlyAdmin {
         require(newAdmin != address(0));
         TransferAdminPending(pendingAdmin);
         pendingAdmin = newAdmin;
     }
 
function

addAlerter

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
newAlerteraddress

Outputs

(void)
     function addAlerter(address newAlerter) public onlyAdmin {
         require(!alerters[newAlerter]); // prevent duplicates.
         require(alertersGroup.length < MAX_GROUP_SIZE);
 
         AlerterAdded(newAlerter, true);
         alerters[newAlerter] = true;
         alertersGroup.push(newAlerter);
     }
 
function

removeAlerter

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
alerteraddress

Outputs

(void)
     function removeAlerter (address alerter) public onlyAdmin {
         require(alerters[alerter]);
         alerters[alerter] = false;
 
         for (uint i = 0; i < alertersGroup.length; ++i) {
             if (alertersGroup[i] == alerter) {
                 alertersGroup[i] = alertersGroup[alertersGroup.length - 1];
                 alertersGroup.length--;
                 AlerterAdded(alerter, false);
                 break;
             }
         }
     }
 
function

claimAdmin

nonpayable

Inputs

(void)

Outputs

(void)
     function claimAdmin() public {
         require(pendingAdmin == msg.sender);
         AdminClaimed(pendingAdmin, admin);
         admin = pendingAdmin;
         pendingAdmin = address(0);
     }
 
function

getAlerters

view

Inputs

(void)

Outputs

TypeDescription
address[]
     function getAlerters () external view returns(address[]) {
         return alertersGroup;
     }
 
function

getOperators

view

Inputs

(void)

Outputs

TypeDescription
address[]
     function getOperators () external view returns(address[]) {
         return operatorsGroup;
     }
 
event

OperatorAdded

Inputs

ParameterTypeDescription
newOperatoraddress
isAddbool

Outputs

(void)
     event OperatorAdded(address newOperator, bool isAdd);
 
event

AlerterAdded

Inputs

ParameterTypeDescription
newAlerteraddress
isAddbool

Outputs

(void)
     event AlerterAdded (address newAlerter, bool isAdd);
 
event

AdminClaimed

Inputs

ParameterTypeDescription
newAdminaddress
previousAdminaddress

Outputs

(void)
     event AdminClaimed( address newAdmin, address previousAdmin);
 
event

TransferAdminPending

Inputs

ParameterTypeDescription
pendingAdminaddress

Outputs

(void)
     event TransferAdminPending(address pendingAdmin);
 
SanityRates
function

setReasonableDiff

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
srcsaddress[]
diffuint256[]

Outputs

(void)
     function setReasonableDiff(ERC20[] srcs, uint[] diff) public onlyAdmin {
         require(srcs.length == diff.length);
         for (uint i = 0; i < srcs.length; i++) {
             require(diff[i] <= 100 * 100);
             reasonableDiffInBps[srcs[i]] = diff[i];
         }
     }
 
function

setSanityRates

nonpayable
Restricted (onlyOperator)

Inputs

ParameterTypeDescription
srcsaddress[]
ratesuint256[]

Outputs

(void)
     function setSanityRates(ERC20[] srcs, uint[] rates) public onlyOperator {
         require(srcs.length == rates.length);
 
         for (uint i = 0; i < srcs.length; i++) {
             require(rates[i] <= MAX_RATE);
             tokenRate[srcs[i]] = rates[i];
         }
     }
 
function

getSanityRate

view

Inputs

ParameterTypeDescription
srcaddress
destaddress

Outputs

TypeDescription
uint256
     function getSanityRate(ERC20 src, ERC20 dest) public view returns(uint) {
         if (src != ETH_TOKEN_ADDRESS && dest != ETH_TOKEN_ADDRESS) return 0;
 
         uint rate;
         address token;
         if (src == ETH_TOKEN_ADDRESS) {
             rate = (PRECISION*PRECISION)/tokenRate[dest];
             token = dest;
         } else {
             rate = tokenRate[src];
             token = src;
         }
 
         return rate * (10000 + reasonableDiffInBps[token])/10000;
     }
 
constructor

SanityRates

nonpayable

Inputs

ParameterTypeDescription
_adminaddress

Outputs

(void)
     function SanityRates(address _admin) public {
         require(_admin != address(0));
         admin = _admin;
     }
 
Withdrawable
function

withdrawEther

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
amountuint256
sendToaddress

Outputs

(void)
     function withdrawEther(uint amount, address sendTo) external onlyAdmin {
         sendTo.transfer(amount);
         EtherWithdraw(amount, sendTo);
     }
 
function

withdrawToken

nonpayable
Restricted (onlyAdmin)

Inputs

ParameterTypeDescription
tokenaddress
amountuint256
sendToaddress

Outputs

(void)
     function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
         require(token.transfer(sendTo, amount));
         TokenWithdraw(token, amount, sendTo);
     }
 
event

EtherWithdraw

Inputs

ParameterTypeDescription
amountuint256
sendToaddress

Outputs

(void)
     event EtherWithdraw(uint amount, address sendTo);
 
event

TokenWithdraw

Inputs

ParameterTypeDescription
tokenaddress
amountuint256
sendToaddress

Outputs

(void)
     event TokenWithdraw(ERC20 token, uint amount, address sendTo);
 
function

admin

view

Inputs

(void)

Outputs

TypeDescription
address
     address public admin;
 
function

tokenRate

view

Inputs

ParameterTypeDescription
address

Outputs

TypeDescription
uint256
     mapping(address=>uint) public tokenRate;
 
function

reasonableDiffInBps

view

Inputs

ParameterTypeDescription
address

Outputs

TypeDescription
uint256
     mapping(address=>uint) public reasonableDiffInBps;
 
function

pendingAdmin

view

Inputs

(void)

Outputs

TypeDescription
address
     address public pendingAdmin;