make swap proxy pausable
This commit is contained in:
parent
071c5c0cca
commit
97e62c862d
|
@ -2,10 +2,10 @@ pragma solidity ^0.4.18;
|
||||||
|
|
||||||
import "./LiquidPledging.sol";
|
import "./LiquidPledging.sol";
|
||||||
import "./common/SafeToken.sol";
|
import "./common/SafeToken.sol";
|
||||||
import "./common/Ownable.sol";
|
import "./common/Pausable.sol";
|
||||||
import "./IKyberSwap.sol";
|
import "./IKyberSwap.sol";
|
||||||
|
|
||||||
contract SwapProxy is Ownable, SafeToken {
|
contract SwapProxy is Pausable, SafeToken {
|
||||||
address public ETH;
|
address public ETH;
|
||||||
address public vault;
|
address public vault;
|
||||||
uint public maxSlippage;
|
uint public maxSlippage;
|
||||||
|
@ -56,7 +56,7 @@ contract SwapProxy is Ownable, SafeToken {
|
||||||
* @param idReceiver receiver of donation
|
* @param idReceiver receiver of donation
|
||||||
* @param token token to convert from ETH
|
* @param token token to convert from ETH
|
||||||
*/
|
*/
|
||||||
function fundWithETH(uint64 idReceiver, address token) public payable {
|
function fundWithETH(uint64 idReceiver, address token) public payable whenNotPaused {
|
||||||
require(msg.value > 0);
|
require(msg.value > 0);
|
||||||
|
|
||||||
uint expectedRate;
|
uint expectedRate;
|
||||||
|
@ -80,7 +80,7 @@ contract SwapProxy is Ownable, SafeToken {
|
||||||
* @param amount being sent
|
* @param amount being sent
|
||||||
* @param receiverToken token being converted to
|
* @param receiverToken token being converted to
|
||||||
*/
|
*/
|
||||||
function fundWithToken(uint64 idReceiver, address token, uint amount, address receiverToken) public {
|
function fundWithToken(uint64 idReceiver, address token, uint amount, address receiverToken) public whenNotPaused {
|
||||||
Error err = doTransferIn(token, msg.sender, amount);
|
Error err = doTransferIn(token, msg.sender, amount);
|
||||||
require(err == Error.NO_ERROR);
|
require(err == Error.NO_ERROR);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
pragma solidity ^0.4.18;
|
||||||
|
|
||||||
|
import "./Ownable.sol";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Pausable
|
||||||
|
* @dev Makes contract functions pausable by the owner
|
||||||
|
*/
|
||||||
|
contract Pausable is Ownable {
|
||||||
|
|
||||||
|
event Paused();
|
||||||
|
event Unpaused();
|
||||||
|
|
||||||
|
bool public paused;
|
||||||
|
|
||||||
|
function Pausable() internal {
|
||||||
|
paused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier whenNotPaused() {
|
||||||
|
require(!paused);
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier whenPaused() {
|
||||||
|
require(paused);
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Disables contract functions marked with "whenNotPaused" and enables the use of functions marked with "whenPaused"
|
||||||
|
* Only the owner of the contract can invoke this function
|
||||||
|
*/
|
||||||
|
function pause() external onlyOwner whenNotPaused {
|
||||||
|
paused = true;
|
||||||
|
Paused();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Enables contract functions marked with "whenNotPaused" and disables the use of functions marked with "whenPaused"
|
||||||
|
* Only the owner of the contract can invoke this function
|
||||||
|
*/
|
||||||
|
function unpause() external onlyOwner whenPaused {
|
||||||
|
paused = false;
|
||||||
|
Unpaused();
|
||||||
|
}
|
||||||
|
}
|
|
@ -180,11 +180,12 @@ module.exports = {
|
||||||
address: "0x8aA3672a99C489E5Dc5dfDb40e607bE49970cbF7"
|
address: "0x8aA3672a99C489E5Dc5dfDb40e607bE49970cbF7"
|
||||||
},
|
},
|
||||||
SwapProxy: {
|
SwapProxy: {
|
||||||
|
address: "0x46A30Bf6D0E438E7EeaabD6c4B5fEBf481267722",
|
||||||
args: [
|
args: [
|
||||||
'$LiquidPledging',
|
'$LiquidPledging',
|
||||||
"0x818E6FECD516Ecc3849DAf6845e3EC868087B755",
|
"0x818E6FECD516Ecc3849DAf6845e3EC868087B755",
|
||||||
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
||||||
"0",
|
"0x0000000000000000000000000000000000000000",
|
||||||
20
|
20
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
"0xa9bac214a330fe3f2048f91b805d227afa147021ef497936a65911400cc3bdd5": {
|
"0xa9bac214a330fe3f2048f91b805d227afa147021ef497936a65911400cc3bdd5": {
|
||||||
"name": "SNT",
|
"name": "SNT",
|
||||||
"address": "0x8aA3672a99C489E5Dc5dfDb40e607bE49970cbF7"
|
"address": "0x8aA3672a99C489E5Dc5dfDb40e607bE49970cbF7"
|
||||||
|
},
|
||||||
|
"0xb573e81b6da869674bb2d8448581ed758b9dbf7e72b0879087d49620167778d4": {
|
||||||
|
"name": "SwapProxy",
|
||||||
|
"address": "0x46A30Bf6D0E438E7EeaabD6c4B5fEBf481267722"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue