Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x872005fd...4d407886F The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
GuardianStorage
Compiler Version
v0.5.4+commit.9549d8ff
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.5.4; //FIX: modified pragma, why was it 0.5.4?
import "./Storage.sol";
import "../../infrastructure/storage/IGuardianStorage.sol";
/**
* @title GuardianStorage
* @notice Contract storing the state of wallets related to guardians and lock.
* The contract only defines basic setters and getters with no logic. Only modules authorised
* for a wallet can modify its state.
*/
contract GuardianStorage is IGuardianStorage, Storage {
struct GuardianStorageConfig {
// the list of guardians
address[] guardians;
// the info about guardians
mapping (address => GuardianInfo) info;
// the lock's release timestamp
uint256 lock;
// the module that set the last lock
address locker;
}
struct GuardianInfo {
bool exists;
uint128 index;
}
// wallet specific storage
mapping (address => GuardianStorageConfig) internal configs;
// *************** External Functions ********************* //
/**
* @notice Lets an authorised module add a guardian to a wallet.
* @param _wallet The target wallet.
* @param _guardian The guardian to add.
*/
function addGuardian(address _wallet, address _guardian) external onlyModule(_wallet) {
GuardianStorageConfig storage config = configs[_wallet];
config.info[_guardian].exists = true;
config.info[_guardian].index = uint128(config.guardians.push(_guardian) - 1);
}
/**
* @notice Lets an authorised module revoke a guardian from a wallet.
* @param _wallet The target wallet.
* @param _guardian The guardian to revoke.
*/
function revokeGuardian(address _wallet, address _guardian) external onlyModule(_wallet) {
GuardianStorageConfig storage config = configs[_wallet];
address lastGuardian = config.guardians[config.guardians.length - 1];
if (_guardian != lastGuardian) {
uint128 targetIndex = config.info[_guardian].index;
config.guardians[targetIndex] = lastGuardian;
config.info[lastGuardian].index = targetIndex;
}
config.guardians.length--;
delete config.info[_guardian];
}
/**
* @notice Returns the number of guardians for a wallet.
* @param _wallet The target wallet.
* @return the number of guardians.
*/
function guardianCount(address _wallet) external view returns (uint256) {
return configs[_wallet].guardians.length;
}
/**
* @notice Gets the list of guaridans for a wallet.
* @param _wallet The target wallet.
* @return the list of guardians.
*/
function getGuardians(address _wallet) external view returns (address[] memory) {
GuardianStorageConfig storage config = configs[_wallet];
address[] memory guardians = new address[](config.guardians.length);
for (uint256 i = 0; i < config.guardians.length; i++) {
guardians[i] = config.guardians[i];
}
return guardians;
}
/**
* @notice Checks if an account is a guardian for a wallet.
* @param _wallet The target wallet.
* @param _guardian The account.
* @return true if the account is a guardian for a wallet.
*/
function isGuardian(address _wallet, address _guardian) external view returns (bool) {
return configs[_wallet].info[_guardian].exists;
}
/**
* @notice Lets an authorised module set the lock for a wallet.
* @param _wallet The target wallet.
* @param _releaseAfter The epoch time at which the lock should automatically release.
*/
function setLock(address _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[_wallet].lock = _releaseAfter;
if (_releaseAfter != 0 && msg.sender != configs[_wallet].locker) {
configs[_wallet].locker = msg.sender;
}
}
/**
* @notice Checks if the lock is set for a wallet.
* @param _wallet The target wallet.
* @return true if the lock is set for the wallet.
*/
function isLocked(address _wallet) external view returns (bool) {
return configs[_wallet].lock > block.timestamp;
}
/**
* @notice Gets the time at which the lock of a wallet will release.
* @param _wallet The target wallet.
* @return the time at which the lock of a wallet will release, or zero if there is no lock set.
*/
function getLock(address _wallet) external view returns (uint256) {
return configs[_wallet].lock;
}
/**
* @notice Gets the address of the last module that modified the lock for a wallet.
* @param _wallet The target wallet.
* @return the address of the last module that modified the lock for a wallet.
*/
function getLocker(address _wallet) external view returns (address) {
return configs[_wallet].locker;
}
}// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz>
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.4 <0.9.0;
interface IGuardianStorage {
/**
* @notice Lets an authorised module add a guardian to a wallet.
* @param _wallet The target wallet.
* @param _guardian The guardian to add.
*/
function addGuardian(address _wallet, address _guardian) external;
/**
* @notice Lets an authorised module revoke a guardian from a wallet.
* @param _wallet The target wallet.
* @param _guardian The guardian to revoke.
*/
function revokeGuardian(address _wallet, address _guardian) external;
/**
* @notice Checks if an account is a guardian for a wallet.
* @param _wallet The target wallet.
* @param _guardian The account.
* @return true if the account is a guardian for a wallet.
*/
function isGuardian(address _wallet, address _guardian) external view returns (bool);
function isLocked(address _wallet) external view returns (bool);
function getLock(address _wallet) external view returns (uint256);
function getLocker(address _wallet) external view returns (address);
function setLock(address _wallet, uint256 _releaseAfter) external;
function getGuardians(address _wallet) external view returns (address[] memory);
function guardianCount(address _wallet) external view returns (uint256);
}// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.5.4; import "../../../wallet/IWallet.sol"; /** * @title Storage * @notice Base contract for the storage of a wallet. * @author Julien Niset - <[email protected]> */ contract Storage { /** * @notice Throws if the caller is not an authorised module. */ modifier onlyModule(address _wallet) { // solhint-disable-next-line reason-string require(IWallet(_wallet).authorised(msg.sender), "TS: must be an authorized module to call this method"); _; } }
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.4 <0.9.0;
/**
* @title IWallet
* @notice Interface for the BaseWallet
*/
interface IWallet {
/**
* @notice Returns the wallet owner.
* @return The wallet owner address.
*/
function owner() external view returns (address);
/**
* @notice Returns the number of authorised modules.
* @return The number of authorised modules.
*/
function modules() external view returns (uint);
/**
* @notice Sets a new owner for the wallet.
* @param _newOwner The new owner.
*/
function setOwner(address _newOwner) external;
/**
* @notice Checks if a module is authorised on the wallet.
* @param _module The module address to check.
* @return `true` if the module is authorised, otherwise `false`.
*/
function authorised(address _module) external view returns (bool);
/**
* @notice Returns the module responsible for a static call redirection.
* @param _sig The signature of the static call.
* @return the module doing the redirection
*/
function enabled(bytes4 _sig) external view returns (address);
/**
* @notice Enables/Disables a module.
* @param _module The target module.
* @param _value Set to `true` to authorise the module.
*/
function authoriseModule(address _module, bool _value) external;
/**
* @notice Enables a static method by specifying the target module to which the call must be delegated.
* @param _module The target module.
* @param _method The static method signature.
*/
function enableStaticCall(address _module, bytes4 _method) external;
}{
"optimizer": {
"enabled": true,
"runs": 1000000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract ABI
API[{"constant":false,"inputs":[{"name":"_wallet","type":"address"},{"name":"_guardian","type":"address"}],"name":"revokeGuardian","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_wallet","type":"address"}],"name":"isLocked","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_wallet","type":"address"}],"name":"guardianCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_wallet","type":"address"}],"name":"getLock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_wallet","type":"address"}],"name":"getLocker","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_wallet","type":"address"},{"name":"_releaseAfter","type":"uint256"}],"name":"setLock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_wallet","type":"address"},{"name":"_guardian","type":"address"}],"name":"addGuardian","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_wallet","type":"address"},{"name":"_guardian","type":"address"}],"name":"isGuardian","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_wallet","type":"address"}],"name":"getGuardians","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"}]Contract Creation Code
0x608060405234801561001057600080fd5b50610c26806100206000396000f3fe608060405234801561001057600080fd5b50600436106100c0576000357c010000000000000000000000000000000000000000000000000000000090048063919884bf11610093578063c684521011610078578063c684521014610256578063d4ee973414610291578063f18858ab146102cc576100c0565b8063919884bf146101c1578063b0fc29e61461021d576100c0565b80631d97d8cc146100c55780634a4fbeec146101025780635040fb76146101495780636b9db4e61461018e575b600080fd5b610100600480360360408110156100db57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661034f565b005b6101356004803603602081101561011857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661063e565b604080519115158252519081900360200190f35b61017c6004803603602081101561015f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661066b565b60408051918252519081900360200190f35b61017c600480360360208110156101a457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610693565b6101f4600480360360208110156101d757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106be565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101006004803603604081101561023357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356106ec565b6101006004803603604081101561026c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661089d565b610135600480360360408110156102a757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610a6f565b6102ff600480360360208110156102e257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610aac565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561033b578181015183820152602001610323565b505050509050019250505060405180910390f35b604080517fd6eb1bbf0000000000000000000000000000000000000000000000000000000081523360048201529051839173ffffffffffffffffffffffffffffffffffffffff83169163d6eb1bbf91602480820192602092909190829003018186803b1580156103be57600080fd5b505afa1580156103d2573d6000803e3d6000fd5b505050506040513d60208110156103e857600080fd5b50511515610441576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bc76034913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120805490919082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061049957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff9081169150841681146105bb5773ffffffffffffffffffffffffffffffffffffffff8416600090815260018301602052604090205482546101009091046fffffffffffffffffffffffffffffffff1690829084908390811061051857fe5b60009182526020808320909101805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790559184168152600185019091526040902080546fffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff9092169190911790555b81546105e9837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301610b86565b505073ffffffffffffffffffffffffffffffffffffffff90921660009081526001909201602052506040902080547fffffffffffffffffffffffffffffff000000000000000000000000000000000016905550565b73ffffffffffffffffffffffffffffffffffffffff16600090815260208190526040902060020154421090565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090206002015490565b73ffffffffffffffffffffffffffffffffffffffff9081166000908152602081905260409020600301541690565b604080517fd6eb1bbf0000000000000000000000000000000000000000000000000000000081523360048201529051839173ffffffffffffffffffffffffffffffffffffffff83169163d6eb1bbf91602480820192602092909190829003018186803b15801561075b57600080fd5b505afa15801561076f573d6000803e3d6000fd5b505050506040513d602081101561078557600080fd5b505115156107de576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bc76034913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090206002018290558115801590610842575073ffffffffffffffffffffffffffffffffffffffff838116600090815260208190526040902060030154163314155b156108985773ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902060030180547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790555b505050565b604080517fd6eb1bbf0000000000000000000000000000000000000000000000000000000081523360048201529051839173ffffffffffffffffffffffffffffffffffffffff83169163d6eb1bbf91602480820192602092909190829003018186803b15801561090c57600080fd5b505afa158015610920573d6000803e3d6000fd5b505050506040513d602081101561093657600080fd5b5051151561098f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bc76034913960400191505060405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff918216600090815260208181526040808320939094168083526001808501835294832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168617815584549586018555938352908220840180547fffffffffffffffffffffffff00000000000000000000000000000000000000001682179055905280546fffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152602081815260408083209390941682526001909201909152205460ff1690565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020818152604091829020805483518181528184028101909301909352606092909183918015610b02578160200160208202803883390190505b50905060005b8254811015610b7e578254839082908110610b1f57fe5b600091825260209091200154825173ffffffffffffffffffffffffffffffffffffffff90911690839083908110610b5257fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101610b08565b509392505050565b81548183558181111561089857600083815260209020610898918101908301610bc391905b80821115610bbf5760008155600101610bab565b5090565b9056fe54533a206d75737420626520616e20617574686f72697a6564206d6f64756c6520746f2063616c6c2074686973206d6574686f64a165627a7a7230582099cd809bad3ef54a55cb75b056d6eb38200a5def5c35e7b3580a6822d84b794d0029
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c0576000357c010000000000000000000000000000000000000000000000000000000090048063919884bf11610093578063c684521011610078578063c684521014610256578063d4ee973414610291578063f18858ab146102cc576100c0565b8063919884bf146101c1578063b0fc29e61461021d576100c0565b80631d97d8cc146100c55780634a4fbeec146101025780635040fb76146101495780636b9db4e61461018e575b600080fd5b610100600480360360408110156100db57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661034f565b005b6101356004803603602081101561011857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661063e565b604080519115158252519081900360200190f35b61017c6004803603602081101561015f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661066b565b60408051918252519081900360200190f35b61017c600480360360208110156101a457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610693565b6101f4600480360360208110156101d757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106be565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101006004803603604081101561023357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356106ec565b6101006004803603604081101561026c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661089d565b610135600480360360408110156102a757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610a6f565b6102ff600480360360208110156102e257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610aac565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561033b578181015183820152602001610323565b505050509050019250505060405180910390f35b604080517fd6eb1bbf0000000000000000000000000000000000000000000000000000000081523360048201529051839173ffffffffffffffffffffffffffffffffffffffff83169163d6eb1bbf91602480820192602092909190829003018186803b1580156103be57600080fd5b505afa1580156103d2573d6000803e3d6000fd5b505050506040513d60208110156103e857600080fd5b50511515610441576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bc76034913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120805490919082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061049957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff9081169150841681146105bb5773ffffffffffffffffffffffffffffffffffffffff8416600090815260018301602052604090205482546101009091046fffffffffffffffffffffffffffffffff1690829084908390811061051857fe5b60009182526020808320909101805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790559184168152600185019091526040902080546fffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff9092169190911790555b81546105e9837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301610b86565b505073ffffffffffffffffffffffffffffffffffffffff90921660009081526001909201602052506040902080547fffffffffffffffffffffffffffffff000000000000000000000000000000000016905550565b73ffffffffffffffffffffffffffffffffffffffff16600090815260208190526040902060020154421090565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090206002015490565b73ffffffffffffffffffffffffffffffffffffffff9081166000908152602081905260409020600301541690565b604080517fd6eb1bbf0000000000000000000000000000000000000000000000000000000081523360048201529051839173ffffffffffffffffffffffffffffffffffffffff83169163d6eb1bbf91602480820192602092909190829003018186803b15801561075b57600080fd5b505afa15801561076f573d6000803e3d6000fd5b505050506040513d602081101561078557600080fd5b505115156107de576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bc76034913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090206002018290558115801590610842575073ffffffffffffffffffffffffffffffffffffffff838116600090815260208190526040902060030154163314155b156108985773ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902060030180547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790555b505050565b604080517fd6eb1bbf0000000000000000000000000000000000000000000000000000000081523360048201529051839173ffffffffffffffffffffffffffffffffffffffff83169163d6eb1bbf91602480820192602092909190829003018186803b15801561090c57600080fd5b505afa158015610920573d6000803e3d6000fd5b505050506040513d602081101561093657600080fd5b5051151561098f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610bc76034913960400191505060405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff918216600090815260208181526040808320939094168083526001808501835294832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168617815584549586018555938352908220840180547fffffffffffffffffffffffff00000000000000000000000000000000000000001682179055905280546fffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152602081815260408083209390941682526001909201909152205460ff1690565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020818152604091829020805483518181528184028101909301909352606092909183918015610b02578160200160208202803883390190505b50905060005b8254811015610b7e578254839082908110610b1f57fe5b600091825260209091200154825173ffffffffffffffffffffffffffffffffffffffff90911690839083908110610b5257fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101610b08565b509392505050565b81548183558181111561089857600083815260209020610898918101908301610bc391905b80821115610bbf5760008155600101610bab565b5090565b9056fe54533a206d75737420626520616e20617574686f72697a6564206d6f64756c6520746f2063616c6c2074686973206d6574686f64a165627a7a7230582099cd809bad3ef54a55cb75b056d6eb38200a5def5c35e7b3580a6822d84b794d0029
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.