Populous platform deposit contract: one per client, holding invoice-financing tokens that only the platform server or the Populous bank contract may move.
Historical Significance
The shape is an exchange deposit address, but the purpose is not an exchange. Populous was financing real invoices, so a client's deposit address had to be movable by the platform's operational key and by the bank contract, and by nobody else, including the client. Putting both roles behind one AccessManager rather than storing an owner per contract is what made that governable at scale: one contract to rotate, and every client address follows.
Key Facts
Description
Populous ran invoice financing on Ethereum, and gave every client an address of their own. This is that address. It holds no logic beyond custody: a single storage slot points at an AccessManager, and every decision about who may act is delegated to it.
transfer takes the token contract, a destination and an amount, and is gated on the AccessManager answering true to isServer or isPopulous. Neither the client nor the deployer is privileged here; authority lives in two roles the platform controls, and the deposit contract simply asks. balanceOf is the read side, reporting this contract's holding of any token passed to it, so the platform can reconcile without knowing which tokens a client has been sent.
updateAccessManager is restricted to the server alone, which is the one lever that matters: rotating the access manager re-points authority for every deposit contract that references it, without redeploying any of them.
The source is Populous's own, from the platform's published contracts: DepositContract inheriting withAccessManager, against the iERC20Token interface.
Source Verified
Byzantium Era
First Metropolis hard fork. Added zk-SNARK precompiles, REVERT opcode, and staticcall.
Bytecode Overview
Verified Source Available
This contract has verified source code.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
pragma solidity ^0.4.17;
/// @title iERC20Token contract
contract iERC20Token {
function transfer(address _to, uint256 _value) public returns (bool success);
function balanceOf(address _owner) public view returns (uint256 balance);
}
/// @title AccessManager contract
/// Only the two predicates DepositContract depends on are declared here; the
/// deployed AccessManager also carries the server and populous addresses and
/// the methods to rotate them.
contract AccessManager {
function isServer(address sender) public view returns (bool);
function isPopulous(address sender) public view returns (bool);
}
/// @title withAccessManager contract
contract withAccessManager {
AccessManager public AM;
modifier onlyServer {
require(AM.isServer(msg.sender) == true);
_;
}
modifier onlyServerOrOnlyPopulous {
require(AM.isServer(msg.sender) == true || AM.isPopulous(msg.sender) == true);
_;
}
function withAccessManager(address _accessManager) public {
AM = AccessManager(_accessManager);
}
function updateAccessManager(address _accessManager) public onlyServer {
AM = AccessManager(_accessManager);
}
}
/// @title DepositContract contract
contract DepositContract is withAccessManager {
function DepositContract(address accessManager) public withAccessManager(accessManager) { }
function transfer(address populousTokenContract, address _to, uint256 _value) public
onlyServerOrOnlyPopulous returns (bool success)
{
return iERC20Token(populousTokenContract).transfer(_to, _value);
}
function balanceOf(address populousTokenContract) public view returns (uint256) {
return iERC20Token(populousTokenContract).balanceOf(this);
}
}