Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer Ownership of contract from multisig to governance #279

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions contracts/farm/LiquidityMining.sol
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ contract LiquidityMining is LiquidityMiningStorage {
* @param _user the address of user, tokens will be deposited to it
* @param alreadyTransferred true if the pool tokens have already been transferred
*/
function _deposit(address _poolToken, uint256 _amount, address _user, bool alreadyTransferred) internal{
function _deposit(
address _poolToken,
uint256 _amount,
address _user,
bool alreadyTransferred
) internal {
require(poolIdList[_poolToken] != 0, "Pool token not found");
address userAddress = _user != address(0) ? _user : msg.sender;

Expand All @@ -371,8 +376,7 @@ contract LiquidityMining is LiquidityMiningStorage {

if (_amount > 0) {
//receives pool tokens from msg.sender, it can be user or WrapperProxy contract
if(!alreadyTransferred)
pool.poolToken.safeTransferFrom(address(msg.sender), address(this), _amount);
if (!alreadyTransferred) pool.poolToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
}
_updateRewardDebt(pool, user);
Expand Down Expand Up @@ -605,10 +609,8 @@ contract LiquidityMining is LiquidityMiningStorage {
* @param _poolToken the address of pool token
* @param _user the address of the user
*/
function getUserPoolTokenBalance(address _poolToken, address _user) external view returns (uint256){
function getUserPoolTokenBalance(address _poolToken, address _user) external view returns (uint256) {
UserInfo memory ui = getUserInfo(_poolToken, _user);
return ui.amount;
}


}
58 changes: 28 additions & 30 deletions contracts/farm/LiquidityMiningConfigToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,31 @@ import "../openzeppelin/IERC20_.sol";
* @dev We need this token for having a flexibility with LiquidityMining configuration
*/
contract LiquidityMiningConfigToken is IERC20_ {

function totalSupply() external view returns (uint256) {
return 0;
}

function balanceOf(address account) external view returns (uint256) {
return 0;
}

function transfer(address recipient, uint256 amount) external returns (bool) {
return false;
}

function allowance(address owner, address spender) external view returns (uint256) {
return 0;
}

function approve(address spender, uint256 amount) external returns (bool) {
return false;
}

function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
return false;
}

}
function totalSupply() external view returns (uint256) {
return 0;
}

function balanceOf(address account) external view returns (uint256) {
return 0;
}

function transfer(address recipient, uint256 amount) external returns (bool) {
return false;
}

function allowance(address owner, address spender) external view returns (uint256) {
return 0;
}

function approve(address spender, uint256 amount) external returns (bool) {
return false;
}

function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
return false;
}
}
13 changes: 12 additions & 1 deletion contracts/feeds/PriceFeeds.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ contract PriceFeeds is Constants, Ownable {
/// Flag to pause pricings.
bool public globalPricingPaused = false;

address public pauser;

/* Functions */

/**
Expand All @@ -69,6 +71,14 @@ contract PriceFeeds is Constants, Ownable {
_setBaseToken(_baseTokenAddress);
}

/**
* @notice Set pauser account.
* @param _pauser The address of the account to grant pause permissions.
* */
function setPauser(address _pauser) public onlyOwner {
pauser = _pauser;
}

/**
* @notice Calculate the price ratio between two tokens.
*
Expand Down Expand Up @@ -352,7 +362,8 @@ contract PriceFeeds is Constants, Ownable {
*
* @param isPaused The new status of pause (true/false).
* */
function setGlobalPricingPaused(bool isPaused) external onlyOwner {
function setGlobalPricingPaused(bool isPaused) external {
require(msg.sender == pauser, "onlyPauser");
globalPricingPaused = isPaused;

emit GlobalPricingPaused(msg.sender, isPaused);
Expand Down
1 change: 0 additions & 1 deletion contracts/governance/Staking/WeightedStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -444,5 +444,4 @@ contract WeightedStaking is Checkpoints {
}
return codeHash;
}

}
4 changes: 4 additions & 0 deletions contracts/interfaces/ISovryn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ contract ISovryn is

////// Protocol Settings //////

function setAdmin(address newAdmin) external;

function getAdmin() external view returns (address);

function setPriceFeedContract(address newContract) external;

function setSwapsImplContract(address newContract) external;
Expand Down
5 changes: 2 additions & 3 deletions contracts/mockup/StakingMockup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ contract StakingMockup is Staking {
}

/**
* @dev We need this function to simulate zero delegate checkpoint value.
*/
* @dev We need this function to simulate zero delegate checkpoint value.
*/
function setDelegateStake(
address delegatee,
uint256 lockedTS,
Expand All @@ -60,5 +60,4 @@ contract StakingMockup is Staking {
bytes32 codeHash = _getCodeHash(_contract);
return vestingCodeHashes[codeHash];
}

}
30 changes: 14 additions & 16 deletions contracts/mockup/VestingLogicMockup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ pragma experimental ABIEncoderV2;
import "../governance/Vesting/VestingLogic.sol";

contract VestingLogicMockup is VestingLogic {
/**
* @dev we had a bug in a loop: "i < endDate" instead of "i <= endDate"
*/
function delegate(address _delegatee) public onlyTokenOwner {
require(_delegatee != address(0), "delegatee address invalid");

/**
* @dev we had a bug in a loop: "i < endDate" instead of "i <= endDate"
*/
function delegate(address _delegatee) public onlyTokenOwner {
require(_delegatee != address(0), "delegatee address invalid");

/// @dev Withdraw for each unlocked position.
/// @dev Don't change FOUR_WEEKS to TWO_WEEKS, a lot of vestings already deployed with FOUR_WEEKS
/// workaround found, but it doesn't work with TWO_WEEKS
for (uint256 i = startDate + cliff; i < endDate; i += FOUR_WEEKS) {
staking.delegate(_delegatee, i);
}
emit VotesDelegated(msg.sender, _delegatee);
}

}
/// @dev Withdraw for each unlocked position.
/// @dev Don't change FOUR_WEEKS to TWO_WEEKS, a lot of vestings already deployed with FOUR_WEEKS
/// workaround found, but it doesn't work with TWO_WEEKS
for (uint256 i = startDate + cliff; i < endDate; i += FOUR_WEEKS) {
staking.delegate(_delegatee, i);
}
emit VotesDelegated(msg.sender, _delegatee);
}
}
Loading