mirror of
git://holbrook.no/eth-accounts-index
synced 2024-12-23 12:47:32 +01:00
Add error messages to revert
This commit is contained in:
parent
6061c8244e
commit
e6a8140d2d
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"compiler":{"version":"0.8.18+commit.87f61d96"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"bool","name":"_active","type":"bool"}],"name":"AddressActive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"WriterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"WriterDeleted","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"activate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"deactivate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_i","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"remove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"AccountsIndex.sol":"AccountsIndex"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"AccountsIndex.sol":{"keccak256":"0x29486989a6ef2c1dc0f2ea6fc88f793478b02014ea57da4da592cca7d2aec1f6","license":"AGPL-3.0-or-later","urls":["bzz-raw://5048dc60210f008f6fb46fe79a9d1aaa7a39c2947b4cc11a723fea918b993174","dweb:/ipfs/QmVbVeHc4uRE4T6gHKEr6fCWPpcQDtVGhfs2XC5P6AG4BD"]}},"version":1}
|
||||
{"compiler":{"version":"0.8.18+commit.87f61d96"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"bool","name":"_active","type":"bool"}],"name":"AddressActive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"AddressRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"WriterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"WriterDeleted","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"activate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"deactivate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_i","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"remove","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"AccountsIndex.sol":"AccountsIndex"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"AccountsIndex.sol":{"keccak256":"0xd889ca99f06c6854bb0b347a3661421b9eb7726bf0940507a51ccc0e71895a5f","license":"AGPL-3.0-or-later","urls":["bzz-raw://fa6834759f7015ad9eec0b636e0c688fb1aaa9a2ccaacae8f4335e0d4da75e17","dweb:/ipfs/QmSs2ZNLNkFLiZeAFqs3S9mGW8BfuhZjgNMw5gzMwdveUg"]}},"version":1}
|
||||
|
@ -39,7 +39,7 @@ contract AccountsIndex {
|
||||
|
||||
// Implements Writer
|
||||
function addWriter(address _writer) public returns (bool) {
|
||||
require(owner == msg.sender);
|
||||
require(owner == msg.sender, 'ERR_AXX');
|
||||
isWriter[_writer] = true;
|
||||
emit WriterAdded(_writer);
|
||||
return true;
|
||||
@ -47,7 +47,7 @@ contract AccountsIndex {
|
||||
|
||||
// Implements Writer
|
||||
function deleteWriter(address _writer) public returns (bool) {
|
||||
require(owner == msg.sender);
|
||||
require(owner == msg.sender, 'ERR_AXX');
|
||||
delete isWriter[_writer];
|
||||
emit WriterDeleted(_writer);
|
||||
return true;
|
||||
@ -75,8 +75,8 @@ contract AccountsIndex {
|
||||
uint256 i;
|
||||
uint256 l;
|
||||
|
||||
require(isWriter[msg.sender]);
|
||||
require(this.have(_account));
|
||||
require(isWriter[msg.sender], 'ERR_AXX');
|
||||
require(this.have(_account), 'ERR_ACL');
|
||||
|
||||
l = entryList.length - 1;
|
||||
|
||||
@ -92,8 +92,9 @@ contract AccountsIndex {
|
||||
|
||||
// Implements AccountsIndexMutable
|
||||
function activate(address _account) external returns (bool) {
|
||||
require(isWriter[msg.sender]);
|
||||
require(entryIndex[_account] > 0 && entryIndex[_account] & blockedField == blockedField);
|
||||
require(isWriter[msg.sender], 'ERR_AXX');
|
||||
require(entryIndex[_account] > 0, 'ERR_NOT_FOUND');
|
||||
require(entryIndex[_account] & blockedField == blockedField, 'ERR_NOT_BLOCKED');
|
||||
entryIndex[_account] >>= 129;
|
||||
emit AddressActive(_account, true);
|
||||
return true;
|
||||
@ -102,7 +103,8 @@ contract AccountsIndex {
|
||||
// Implements AccountsIndexMutable
|
||||
function deactivate(address _account) external returns (bool) {
|
||||
require(isWriter[msg.sender]);
|
||||
require(entryIndex[_account] > 0 && entryIndex[_account] & blockedField == 0);
|
||||
require(entryIndex[_account] > 0, 'ERR_NOT_FOUND');
|
||||
require(entryIndex[_account] & blockedField == 0, 'ERR_NOT_ACTIVE');
|
||||
entryIndex[_account] <<= 129;
|
||||
entryIndex[_account] |= blockedField;
|
||||
emit AddressActive(_account, false);
|
||||
@ -134,7 +136,7 @@ contract AccountsIndex {
|
||||
// Implements EIP173
|
||||
function transferOwnership(address _newOwner) public returns (bool) {
|
||||
address oldOwner;
|
||||
require(msg.sender == owner);
|
||||
require(msg.sender == owner, 'ERR_AXX');
|
||||
|
||||
oldOwner = owner;
|
||||
owner = _newOwner;
|
||||
|
Loading…
Reference in New Issue
Block a user