- This contract contains the implementation of functions to add and remove key holders w/ rBTC and BTC addresses. (MultiSigKeyHolders.sol)
View Source: contracts/multisig/MultiSigKeyHolders.sol
↗ Extends: Ownable
struct Data {
bool added,
uint248 index
}
Constants & Variables
//public members
uint256 public constant MAX_OWNER_COUNT;
uint256 public ethereumRequired;
uint256 public bitcoinRequired;
//private members
string private constant ERROR_INVALID_ADDRESS;
string private constant ERROR_INVALID_REQUIRED;
mapping(address => struct MultiSigKeyHolders.Data) private isEthereumAddressAdded;
address[] private ethereumAddresses;
mapping(string => struct MultiSigKeyHolders.Data) private isBitcoinAddressAdded;
string[] private bitcoinAddresses;
Events
event EthereumAddressAdded(address indexed account);
event EthereumAddressRemoved(address indexed account);
event EthereumRequirementChanged(uint256 required);
event BitcoinAddressAdded(string account);
event BitcoinAddressRemoved(string account);
event BitcoinRequirementChanged(uint256 required);
modifier validRequirement(uint256 ownerCount, uint256 _required) internal
Arguments
Name | Type | Description |
---|---|---|
ownerCount | uint256 | |
_required | uint256 |
- addEthereumAddress(address _address)
- addEthereumAddresses(address[] _address)
- _addEthereumAddress(address _address)
- removeEthereumAddress(address _address)
- removeEthereumAddresses(address[] _address)
- _removeEthereumAddress(address _address)
- isEthereumAddressOwner(address _address)
- getEthereumAddresses()
- changeEthereumRequirement(uint256 _required)
- addBitcoinAddress(string _address)
- addBitcoinAddresses(string[] _address)
- _addBitcoinAddress(string _address)
- removeBitcoinAddress(string _address)
- removeBitcoinAddresses(string[] _address)
- _removeBitcoinAddress(string _address)
- isBitcoinAddressOwner(string _address)
- getBitcoinAddresses()
- changeBitcoinRequirement(uint256 _required)
- addEthereumAndBitcoinAddresses(address[] _ethereumAddress, string[] _bitcoinAddress)
- removeEthereumAndBitcoinAddresses(address[] _ethereumAddress, string[] _bitcoinAddress)
Add rBTC address to the key holders.
function addEthereumAddress(address _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | address | The address to be added. |
Source Code
function addEthereumAddress(address _address) public onlyOwner {
_addEthereumAddress(_address);
}
Add rBTC addresses to the key holders.
function addEthereumAddresses(address[] _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | address[] | The addresses to be added. |
Source Code
function addEthereumAddresses(address[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
_addEthereumAddress(_address[i]);
}
}
Internal function to add rBTC address to the key holders.
function _addEthereumAddress(address _address) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
_address | address | The address to be added. |
Source Code
function _addEthereumAddress(address _address) internal {
require(_address != address(0), ERROR_INVALID_ADDRESS);
if (!isEthereumAddressAdded[_address].added) {
isEthereumAddressAdded[_address] = Data({
added: true,
index: uint248(ethereumAddresses.length)
});
ethereumAddresses.push(_address);
}
emit EthereumAddressAdded(_address);
}
Remove rBTC address to the key holders.
function removeEthereumAddress(address _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | address | The address to be removed. |
Source Code
function removeEthereumAddress(address _address) public onlyOwner {
_removeEthereumAddress(_address);
}
Remove rBTC addresses to the key holders.
function removeEthereumAddresses(address[] _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | address[] | The addresses to be removed. |
Source Code
function removeEthereumAddresses(address[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
_removeEthereumAddress(_address[i]);
}
}
Internal function to remove rBTC address to the key holders.
function _removeEthereumAddress(address _address) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
_address | address | The address to be removed. |
Source Code
function _removeEthereumAddress(address _address) internal {
require(_address != address(0), ERROR_INVALID_ADDRESS);
if (isEthereumAddressAdded[_address].added) {
uint248 index = isEthereumAddressAdded[_address].index;
if (index != ethereumAddresses.length - 1) {
ethereumAddresses[index] = ethereumAddresses[ethereumAddresses.length - 1];
isEthereumAddressAdded[ethereumAddresses[index]].index = index;
}
ethereumAddresses.length--;
delete isEthereumAddressAdded[_address];
}
emit EthereumAddressRemoved(_address);
}
Get whether rBTC address is a key holder.
function isEthereumAddressOwner(address _address) public view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_address | address | The rBTC address to be checked. |
Source Code
function isEthereumAddressOwner(address _address) public view returns (bool) {
return isEthereumAddressAdded[_address].added;
}
Get array of rBTC key holders.
function getEthereumAddresses() public view
returns(address[])
Source Code
function getEthereumAddresses() public view returns (address[] memory) {
return ethereumAddresses;
}
Set flag ethereumRequired to true/false.
function changeEthereumRequirement(uint256 _required) public nonpayable onlyOwner validRequirement
Arguments
Name | Type | Description |
---|---|---|
_required | uint256 | The new value of the ethereumRequired flag. |
Source Code
function changeEthereumRequirement(uint256 _required)
public
onlyOwner
validRequirement(ethereumAddresses.length, _required)
{
ethereumRequired = _required;
emit EthereumRequirementChanged(_required);
}
Add bitcoin address to the key holders.
function addBitcoinAddress(string _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | string | The address to be added. |
Source Code
function addBitcoinAddress(string memory _address) public onlyOwner {
_addBitcoinAddress(_address);
}
Add bitcoin addresses to the key holders.
function addBitcoinAddresses(string[] _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | string[] | The addresses to be added. |
Source Code
function addBitcoinAddresses(string[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
_addBitcoinAddress(_address[i]);
}
}
Internal function to add bitcoin address to the key holders.
function _addBitcoinAddress(string _address) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
_address | string | The address to be added. |
Source Code
function _addBitcoinAddress(string memory _address) internal {
require(bytes(_address).length != 0, ERROR_INVALID_ADDRESS);
if (!isBitcoinAddressAdded[_address].added) {
isBitcoinAddressAdded[_address] = Data({
added: true,
index: uint248(bitcoinAddresses.length)
});
bitcoinAddresses.push(_address);
}
emit BitcoinAddressAdded(_address);
}
Remove bitcoin address to the key holders.
function removeBitcoinAddress(string _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | string | The address to be removed. |
Source Code
function removeBitcoinAddress(string memory _address) public onlyOwner {
_removeBitcoinAddress(_address);
}
Remove bitcoin addresses to the key holders.
function removeBitcoinAddresses(string[] _address) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_address | string[] | The addresses to be removed. |
Source Code
function removeBitcoinAddresses(string[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
_removeBitcoinAddress(_address[i]);
}
}
Internal function to remove bitcoin address to the key holders.
function _removeBitcoinAddress(string _address) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
_address | string | The address to be removed. |
Source Code
function _removeBitcoinAddress(string memory _address) internal {
require(bytes(_address).length != 0, ERROR_INVALID_ADDRESS);
if (isBitcoinAddressAdded[_address].added) {
uint248 index = isBitcoinAddressAdded[_address].index;
if (index != bitcoinAddresses.length - 1) {
bitcoinAddresses[index] = bitcoinAddresses[bitcoinAddresses.length - 1];
isBitcoinAddressAdded[bitcoinAddresses[index]].index = index;
}
bitcoinAddresses.length--;
delete isBitcoinAddressAdded[_address];
}
emit BitcoinAddressRemoved(_address);
}
Get whether bitcoin address is a key holder.
function isBitcoinAddressOwner(string _address) public view
returns(bool)
Arguments
Name | Type | Description |
---|---|---|
_address | string | The bitcoin address to be checked. |
Source Code
function isBitcoinAddressOwner(string memory _address) public view returns (bool) {
return isBitcoinAddressAdded[_address].added;
}
Get array of bitcoin key holders.
function getBitcoinAddresses() public view
returns(string[])
Source Code
function getBitcoinAddresses() public view returns (string[] memory) {
return bitcoinAddresses;
}
Set flag bitcoinRequired to true/false.
function changeBitcoinRequirement(uint256 _required) public nonpayable onlyOwner validRequirement
Arguments
Name | Type | Description |
---|---|---|
_required | uint256 | The new value of the bitcoinRequired flag. |
Source Code
function changeBitcoinRequirement(uint256 _required)
public
onlyOwner
validRequirement(bitcoinAddresses.length, _required)
{
bitcoinRequired = _required;
emit BitcoinRequirementChanged(_required);
}
Add rBTC and bitcoin addresses to the key holders.
function addEthereumAndBitcoinAddresses(address[] _ethereumAddress, string[] _bitcoinAddress) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_ethereumAddress | address[] | the rBTC addresses to be added. |
_bitcoinAddress | string[] | the bitcoin addresses to be added. |
Source Code
function addEthereumAndBitcoinAddresses(
address[] memory _ethereumAddress,
string[] memory _bitcoinAddress
) public onlyOwner {
for (uint256 i = 0; i < _ethereumAddress.length; i++) {
_addEthereumAddress(_ethereumAddress[i]);
}
for (uint256 i = 0; i < _bitcoinAddress.length; i++) {
_addBitcoinAddress(_bitcoinAddress[i]);
}
}
Remove rBTC and bitcoin addresses to the key holders.
function removeEthereumAndBitcoinAddresses(address[] _ethereumAddress, string[] _bitcoinAddress) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_ethereumAddress | address[] | The rBTC addresses to be removed. |
_bitcoinAddress | string[] | The bitcoin addresses to be removed. |
Source Code
function removeEthereumAndBitcoinAddresses(
address[] memory _ethereumAddress,
string[] memory _bitcoinAddress
) public onlyOwner {
for (uint256 i = 0; i < _ethereumAddress.length; i++) {
_removeEthereumAddress(_ethereumAddress[i]);
}
for (uint256 i = 0; i < _bitcoinAddress.length; i++) {
_removeBitcoinAddress(_bitcoinAddress[i]);
}
}
- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC