Skip to content

Commit

Permalink
doc and clearer interfaces for adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbreak committed Feb 21, 2019
1 parent 8ae9a44 commit 425883b
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/join.sol
Expand Up @@ -22,6 +22,9 @@ import "ds-note/note.sol";
contract GemLike {
function transfer(address,uint) public returns (bool);
function transferFrom(address,address,uint) public returns (bool);
}

contract DSToken {
function mint(address,uint) public;
function burn(address,uint) public;
}
Expand All @@ -32,6 +35,25 @@ contract VatLike {
function flux(bytes32,bytes32,bytes32,int) public;
}

/*
Here we provide *adapters* to connect the Vat to arbitrary external
token implementations, creating a bounded context for the Vat. The
adapters here are provided as working examples:
- `GemJoin`: For well behaved ERC20 tokens, with simple transfer
semantics.
- `ETHJoin`: For native Ether.
- `DaiJoin`: For connecting internal Dai balances to an external
`DSToken` implementation.
In practice, adapter implementations will be varied and specific to
individual collateral types, accounting for different transfer
semantics and token standards.
*/

contract GemJoin is DSNote {
VatLike public vat;
bytes32 public ilk;
Expand Down Expand Up @@ -83,10 +105,10 @@ contract ETHJoin is DSNote {

contract DaiJoin is DSNote {
VatLike public vat;
GemLike public dai;
DSToken public dai;
constructor(address vat_, address dai_) public {
vat = VatLike(vat_);
dai = GemLike(dai_);
dai = DSToken(dai_);
}
uint constant ONE = 10 ** 27;
function mul(uint x, uint y) internal pure returns (int z) {
Expand Down

0 comments on commit 425883b

Please sign in to comment.