Graphite Testnet

Contract Address Details

Contract
0x0000000000000000000000000000000000001008
Balance
0.0 @G
Tokens
0 Tokens
Transactions
Gas Used
0
Contract Source Code Verified
Contract NameReputation
Compiler Versionv0.8.17+commit.8df45f5f
Optimization EnabledYes
Other SettingsDefault evmVersion
Contract Source Code (Solidity)
1
// SPDX-License-Identifier: UNLICENSED
2
 
3
pragma solidity ^0.8.0;
4
 
5
interface IKYCContract {
6
function level(address addr) external view returns (uint);
7
}
8
 
9
interface IFeeContract {
10
function paidFee(address addr) external view returns (bool);
11
 
12
function paidFeeBlock(address addr) external view returns (uint);
13
}
14
 
15
library System {
16
IKYCContract constant kyc = IKYCContract(0x0000000000000000000000000000000000001001);
17
IFeeContract constant fee = IFeeContract(0x0000000000000000000000000000000000001000);
18
 
19
function nonce(address addr) internal view returns (uint64) {
20
// 0xc8 - nonce precompiled contract address
21
(bool success, bytes memory output) = address(0xc8).staticcall(abi.encodePacked(addr));
22
require(success);
23
return uint64(bytes8(output));
24
}
25
}
26
 
27
contract Reputation {
28
/**
29
* @dev Returns reputation x 100 for provided account.
30
*/
31
function getReputation(address addr) external view returns (uint) {
32
uint reputation = 0;
33
 
34
// activation
35
if (System.fee.paidFee(addr)) {
36
reputation += 100;
37
// creation date = activation block number, make sense only if activation already happened
38
uint creationBlock = System.fee.paidFeeBlock(addr);
39
uint d = block.number - creationBlock;
40
if (d >= 100000) {
41
reputation += 100;
42
} else if (d >= 50000) {
43
reputation += 70;
44
} else if (d >= 10000) {
45
reputation += 50;
46
}
47
}
48
 
49
// kyc level
50
uint kycLevel = System.kyc.level(addr);
51
if (kycLevel >= 2) {
52
reputation += 300;
53
} else if (kycLevel >= 1) {
54
reputation += 100;
55
}
56
 
57
// quantity of transactions = nonce
58
uint qTx = System.nonce(addr);
59
if (qTx >= 1000) {
60
reputation += 100;
61
} else if (qTx >= 500) {
62
reputation += 80;
63
} else if (qTx >= 100) {
64
reputation += 50;
65
} else if (qTx >= 10) {
66
reputation += 30;
67
} else if (qTx >= 1) {
68
reputation += 5;
69
}
70
 
71
// diff = all_in - all_out = balance
72
uint diff = addr.balance;
73
if (diff >= 1 ether / 10) {
74
reputation += 50;
75
}
76
 
77
return reputation;
78
}
79
}
Contract ABI
[
{
"name": "getReputation",
"type": "function",
"inputs": [
{
"name": "addr",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
}
]
Contract Creation Code
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639c89a0e214610030575b600080fd5b61004361003e366004610398565b610055565b60405190815260200160405180910390f35b60405163591a726f60e01b81526001600160a01b038216600482015260009081906110009063591a726f90602401602060405180830381865afa1580156100a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c491906103c8565b1561019e576100d4606482610400565b6040516385cb046560e01b81526001600160a01b0385166004820152909150600090611000906385cb046590602401602060405180830381865afa158015610120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101449190610419565b905060006101528243610432565b9050620186a0811061017057610169606484610400565b925061019b565b61c350811061018457610169604684610400565b612710811061019b57610198603284610400565b92505b50505b604051636a0db6db60e11b81526001600160a01b03841660048201526000906110019063d41b6db690602401602060405180830381865afa1580156101e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020b9190610419565b9050600281106102285761022161012c83610400565b915061023e565b6001811061023e5761023b606483610400565b91505b6000610249856102f2565b67ffffffffffffffff1690506103e8811061027057610269606484610400565b92506102c0565b6101f4811061028457610269605084610400565b6064811061029757610269603284610400565b600a81106102aa57610269601e84610400565b600181106102c0576102bd600584610400565b92505b6001600160a01b0385163167016345785d8a000081106102e8576102e5603285610400565b93505b5091949350505050565b6040516bffffffffffffffffffffffff19606083901b1660208201526000908190819060c89060340160408051601f198184030181529082905261033591610445565b600060405180830381855afa9150503d8060008114610370576040519150601f19603f3d011682016040523d82523d6000602084013e610375565b606091505b50915091508161038457600080fd5b61038d81610474565b60c01c949350505050565b6000602082840312156103aa57600080fd5b81356001600160a01b03811681146103c157600080fd5b9392505050565b6000602082840312156103da57600080fd5b815180151581146103c157600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610413576104136103ea565b92915050565b60006020828403121561042b57600080fd5b5051919050565b81810381811115610413576104136103ea565b6000825160005b81811015610466576020818601810151858301520161044c565b506000920191825250919050565b805160208201516001600160c01b031980821692919060088310156104a35780818460080360031b1b83161693505b50505091905056fea2646970667358221220d150e226bd6a7cc69a3aa0305207711837d4d85a47798b2d3188e069b99f5d2a64736f6c63430008130033
©2022-now by Graphite