mirror of
git://holbrook.no/eth-address-index
synced 2024-11-30 11:56:45 +01:00
Move test to python unittest
This commit is contained in:
parent
ba2c5ad5a3
commit
a60e9383a5
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":true,"internalType":"address","name":"_adder","type":"address"},{"indexed":true,"internalType":"uint256","name":"_index","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"EndorsementAdded","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"endorsement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"endorsers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
|
@ -8,6 +8,7 @@ contract TokenEndorsement {
|
||||
mapping ( bytes32 => bytes32 ) public endorsement;
|
||||
mapping ( address => uint256 ) public tokenIndex;
|
||||
mapping ( address => uint256[] ) public endorsers;
|
||||
mapping ( string => address ) public tokenSymbolIndex;
|
||||
address[] public tokens;
|
||||
|
||||
event EndorsementAdded(address indexed _token, address indexed _adder, uint256 indexed _index, bytes32 _data);
|
||||
@ -21,8 +22,12 @@ contract TokenEndorsement {
|
||||
if (tokenIndex[_token] > 0) {
|
||||
return false;
|
||||
}
|
||||
string memory token_symbol = _token.call(abi.encodeWithSignature('symbol()'));
|
||||
require(tokenSymbolIndex[token_symbol] = address(0));
|
||||
|
||||
tokens.push(_token);
|
||||
tokenIndex[_token] = count;
|
||||
tokenSymbolIndex[token_symbol] = _token;
|
||||
count++;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user