Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/proxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import "ds-note/note.sol";
// i.e. a multisig
contract DSProxy is DSAuth, DSNote {
DSProxyCache public cache; // global cache for contracts
uint128 public reserve = 5000; // reserve gas after delegatecall

function DSProxy(address _cacheAddr) public {
require(setCache(_cacheAddr));
Expand Down Expand Up @@ -61,7 +62,7 @@ contract DSProxy is DSAuth, DSNote {

// call contract in current context
assembly {
let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 32)
let succeeded := delegatecall(sub(gas, reserve), _target, add(_data, 0x20), mload(_data), 0, 32)
response := mload(0) // load delegatecall output
switch iszero(succeeded)
case 1 {
Expand All @@ -82,6 +83,17 @@ contract DSProxy is DSAuth, DSNote {
cache = DSProxyCache(_cacheAddr); // overwrite cache
return true;
}

//set the reserve gas for contract after delegatecall
function setReserve(uint128 _gas)
public
auth
note
returns(bool)
{
reserve = _gas;
return true;
}
}

// DSProxyFactory
Expand Down