Verified contractPartial
DSBalanceDB
Address0xbd5faeca7fd85f454b63ebc9f77659b4061f167f
- Balance
0 ETH
- Transactions
8
- Compiler
solc 0.1.7
- Same code
1 more contract
Details
- Compiler
- solc 0.1.7+commit.b4e666cc
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 572,727
- Creation transaction
- 0x264eed1f84…07312eca86
DSBalanceDB.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract DSAuthority {
function can_call( address caller
, address callee
, bytes4 sig )
returns (bool);
}
// @brief Mixin contract to enable standard authorization pattern.
contract DSAuth {
uint8 _ds_mode;
address _ds_authority;
function DSAuth() {
_ds_authority = msg.sender;
_ds_mode = 0; //DSAuthModes.Owned;
}
modifier auth() {
if( _ds_authenticated() ) {
_
}
}
function _ds_authenticated() internal returns (bool is_authenticated) {
if( _ds_mode == 0 && msg.sender == _ds_authority ) {
return true;
} else if ( _ds_mode == 1 ) {
if( msg.sender == _ds_authority ) {
return true;
}
var A = DSAuthority(_ds_authority);
return A.can_call( msg.sender, address(this), msg.sig );
} else {
return false;
}
}
function _ds_get_authority() constant returns (address authority, bool ok) {
return (_ds_authority, true);
}
function _ds_update_authority( address new_authority, uint8 mode )
auth()
returns (bool success)
{
_ds_authority = DSAuthority(new_authority);
_ds_mode = mode;
return true;
}
}
// Use the auth() pattern, but compile the address into code instead
// of into storage. This is useful if you need to use the entire address
// space, for example.
// @brief DSAuth-like mixin contract which puts the authority address
// into code instead of storage.
// @dev Optionally implement missing DSAuth functions with your constant address
contract DSStaticAuth {
function _ds_authenticated( address _ds_authority ) internal returns (bool is_authenticated) {
if( msg.sender == _ds_authority ) {
return true;
}
var A = DSAuthority(_ds_authority);
return A.can_call( msg.sender, address(this), msg.sig );
}
modifier static_auth( address _ds_authority ) {
if( _ds_authenticated( _ds_authority ) ) {
_
}
}
// Implement these with your constant address to make this into a proper DSAuth
// function _ds_get_authority() constant returns (address authority);
// function _ds_update_authority( address new_authority ) returns (bool success);
}
// NOTE: add_balance checks for overflow
contract DSBalanceDB is DSAuth {
uint _supply;
mapping( address => uint ) _balances;
function get_supply()
constant
returns (uint, bool)
{
return (_supply, true);
}
function get_balance( address who )
constant
returns (uint, bool)
{
return (_balances[who], true);
}
function add_balance( address to, uint amount )
auth()
returns (bool success)
{
if( _supply + amount < _supply ) {
return false;
}
_balances[to] += amount;
_supply += amount;
changed_balance( to, amount, true );
return true;
}
function sub_balance( address from, uint amount )
auth()
returns (bool success)
{
if( _balances[from] < amount ) {
return false;
}
_balances[from] -= amount;
_supply -= amount;
changed_balance( from, amount, false );
return true;
}
function move_balance( address from, address to, uint amount )
auth()
returns (bool success)
{
if( _balances[from] < amount ) {
return false;
}
_balances[from] -= amount;
_balances[to] += amount;
changed_balance( from, amount, false );
changed_balance( to, amount, true );
return true;
}
event changed_balance( address who, uint amount, bool positive);
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.