Your question is slightly ambiguous but I'll attempt to answer using my own interpretation of the question "how can contracts be designed to use gas refunds". The answer is they can't; they can't because refunds are always returned to the
ORIGIN (i.e. the initial executor). Contract don't have access to this refund pool and renders it therefore useless (apart from the ability to make execution cheaper).
the gas refund is not converted to ether and refunded to the sender's account.
Refunds are actually converted to ether (go-ethereum/core/state_transition.go):
sender, _ := self.from() // err already checked
remaining := new(big.Int).Mul(self.gas, self.gasPrice)
What happens during the state transition:
tx.gas and make sure
tx.sender has enough funds;
- Reduce execution gas (amount of gas required for the execution);
- Add refund to
R * tx.gasPrice where
R is gas refund)