This contract is not yet documented
Know something about this contract? Switch to the History tab and suggest an edit to help preserve Ethereum history.
Key Facts
Homestead Era
The first planned hard fork. Removed the canary contract, adjusted gas costs.
Bytecode Overview
Verified Source Available
This contract has verified source code on Etherscan.
Show source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract DgxToken {
function approve(address _spender,uint256 _value) returns(bool success);
function totalSupply() constant returns(uint256 );
function transferFrom(address _from,address _to,uint256 _value) returns(bool success);
function balanceOf(address _owner) constant returns(uint256 balance);
function transfer(address _to,uint256 _value) returns(bool success);
function allowance(address _owner,address _spender) constant returns(uint256 remaining);
}
contract SwapContract {
address public seller;
address public dgxContract;
uint256 public weiPrice;
modifier ifSeller() {
if (seller != msg.sender) {
throw;
} else {
_
}
}
function SwapContract(address _seller, uint256 _weiPrice) {
dgxContract = 0x55b9a11c2e8351b4ffc7b11561148bfac9977855;
seller = _seller;
weiPrice = _weiPrice;
}
function () {
if (dgxBalance() == 0) throw;
if (msg.value < totalWeiPrice()) throw;
if (DgxToken(dgxContract).transfer(address(this), dgxBalance())) {
seller.send(msg.value);
}
}
function setWeiPrice(uint256 _newweiprice) ifSeller returns (bool _success) {
weiPrice = _newweiprice;
_success = true;
return _success;
}
function totalWeiPrice() public constant returns (uint256 _totalweiprice) {
_totalweiprice = dgxBalance() * weiPrice;
return _totalweiprice;
}
function dgxBalance() public constant returns (uint256 _dgxbalance) {
_dgxbalance = DgxToken(dgxContract).balanceOf(address(this));
return _dgxbalance;
}
function withdraw() ifSeller returns (bool _success) {
_success = DgxToken(dgxContract).transfer(seller, dgxBalance());
return _success;
}
}
contract DgxSwap {
uint256 public totalCount;
mapping (address => address) public swapContracts;
mapping (uint256 => address) public sellers;
function DgxSwap() {
totalCount = 0;
}
function createSwap(uint256 _weiprice) public returns (bool _success) {
address _swapcontract = new SwapContract(msg.sender, _weiprice);
swapContracts[msg.sender] = _swapcontract;
sellers[totalCount] = msg.sender;
totalCount++;
_success = true;
return _success;
}
function getSwap(uint256 _id) public constant returns (address _seller, address _contract, uint256 _dgxbalance, uint256 _weiprice, uint256 _totalweiprice) {
_seller = sellers[_id];
if (_seller == 0x0000000000000000000000000000000000000000) {
_contract = 0x0000000000000000000000000000000000000000;
_dgxbalance = 0;
_weiprice = 0;
_totalweiprice = 0;
} else {
_contract = swapContracts[_seller];
_dgxbalance = SwapContract(_contract).dgxBalance();
_weiprice = SwapContract(_contract).weiPrice();
_totalweiprice = SwapContract(_contract).totalWeiPrice();
}
return (_seller, _contract, _dgxbalance, _weiprice, _totalweiprice);
}
}External Links
Related contracts
Digix
Same deployerThe earliest known attempt to deploy a smart contract on Ethereum mainnet (Aug 7 2015, thanateros.eth). Ran out of gas before code deposit; creation bytecode reconstructed exactly.
0x9a049f...a977a0August 7, 2015Greeter (draft)
Same deployerA failed Greeter deployment, the first of three attempts where the gas limit was too low to store the runtime code on-chain.
0xf9c2a9...4273c2August 7, 2015Greeter (draft)
Same deployerA failed Greeter deployment, the second of three attempts where the gas limit was too low to store the runtime code on-chain.
0x26b151...e63c3aAugust 7, 2015Greeter (draft)
Same deployerA failed Greeter deployment, the third of three attempts where the gas limit was too low to store the runtime code on-chain.
0x235287...1c90a7August 7, 2015Greeter
Same deployerThe Frontier Greeter - Ethereum's Hello World tutorial deployed by a 2000 ETH genesis wallet on Day 1, with mortal() exposed as a callable function.
0xcde4de...bf7864August 7, 2015Digix
Same deployerDGX 1.0, the Digix gold token ledger, deployed 14 January 2016. Gold backed ERC-20 with demurrage and custodian roles.
0x55b9a1...977855January 14, 2016