diff --git a/src/reception.sol b/src/reception.sol index f55d5076..2246b8a3 100644 --- a/src/reception.sol +++ b/src/reception.sol @@ -45,11 +45,12 @@ 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_); @@ -57,6 +58,11 @@ contract Reception is TitleOwned { 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); diff --git a/src/test/reception.t.sol b/src/test/reception.t.sol index ca2c0feb..63653d96 100644 --- a/src/test/reception.t.sol +++ b/src/test/reception.t.sol @@ -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;