Skip to content

Commit

Permalink
added version to tinlake (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmxanuel authored Oct 4, 2019
1 parent edbc5ba commit 42ccd1b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/reception.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,24 @@ contract Reception is TitleOwned {
modifier auth { require(wards[msg.sender] == 1); _; }

// --- Data ---

DeskLike desk;
ShelfLike shelf;
PileLike pile;

bytes32 public version;

constructor (address desk_, address title_, address shelf_, address pile_) TitleOwned(title_) public {
wards[msg.sender] = 1;
desk = DeskLike(desk_);
shelf = ShelfLike(shelf_);
pile = PileLike(pile_);
}

function file(bytes32 what, bytes32 data) public auth {
if (what == "version") version = data;
else revert();
}

// --- Reception ---
function borrow(uint loan, address deposit) public owner(loan) {
shelf.deposit(loan, msg.sender);
Expand Down
12 changes: 12 additions & 0 deletions src/test/reception.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ contract ReceptionTest is DSTest {
repay(loan, principal);
}

function testFileVersion() public {
bytes32 version = keccak256("1");
reception.file("version",version);
assertEq(version, reception.version());
}

function testFailFileVersion() public {
bytes32 version = keccak256("1");
reception.file("wrong",version);
assertEq(version, reception.version());
}

function testClose() public {
uint loan = 1;
uint principal = 500;
Expand Down

0 comments on commit 42ccd1b

Please sign in to comment.