Skip to content

Commit 5712605

Browse files
Merge pull request #114 from DistributedCollective/feat/rename-eth
Rename ETH to RBTC
2 parents ee367aa + 288b9cb commit 5712605

File tree

90 files changed

+3284
-3284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3284
-3284
lines changed

packages/contracts/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Buidler compilation cache
1010
/cache
1111

12-
# Ethereum accounts for testing
12+
# RBtcereum accounts for testing
1313
/accountsList.js
1414

1515
# Exported function gas costs and test outputs

packages/contracts/contracts/ActivePool.sol

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import "./ActivePoolStorage.sol";
1010

1111
/**
1212
* @title Active Pool
13-
* @notice The Active Pool holds the ETH collateral and ZUSD debt (but not ZUSD tokens) for all active troves.
13+
* @notice The Active Pool holds the RBTC collateral and ZUSD debt (but not ZUSD tokens) for all active troves.
1414
*
15-
* When a trove is liquidated, it's ETH and ZUSD debt are transferred from the Active Pool, to either the
15+
* When a trove is liquidated, it's RBTC and ZUSD debt are transferred from the Active Pool, to either the
1616
* Stability Pool, the Default Pool, or both, depending on the liquidation conditions.
1717
*/
1818
contract ActivePool is CheckContract, IActivePool, ActivePoolStorage {
@@ -21,7 +21,7 @@ contract ActivePool is CheckContract, IActivePool, ActivePoolStorage {
2121
event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress);
2222
event TroveManagerAddressChanged(address _newTroveManagerAddress);
2323
event ActivePoolZUSDDebtUpdated(uint _ZUSDDebt);
24-
event ActivePoolETHBalanceUpdated(uint _ETH);
24+
event ActivePoolRBTCBalanceUpdated(uint _RBTC);
2525

2626
// --- Contract setters ---
2727
/// @notice initializer function that sets required addresses
@@ -57,10 +57,10 @@ contract ActivePool is CheckContract, IActivePool, ActivePoolStorage {
5757
// --- Getters for public variables. Required by IPool interface ---
5858

5959

60-
/// @notice Not necessarily equal to the the contract's raw ETH balance - ether can be forcibly sent to contracts.
61-
/// @return the ETH state variable.
62-
function getETH() external view override returns (uint) {
63-
return ETH;
60+
/// @notice Not necessarily equal to the the contract's raw RBTC balance - ether can be forcibly sent to contracts.
61+
/// @return the RBTC state variable.
62+
function getRBTC() external view override returns (uint) {
63+
return RBTC;
6464
}
6565

6666
/// @return the ZUSD debt state variable
@@ -70,17 +70,17 @@ contract ActivePool is CheckContract, IActivePool, ActivePoolStorage {
7070

7171
// --- Pool functionality ---
7272

73-
/// @notice Send ETH amount to given account. Updates ActivePool balance. Only callable by BorrowerOperations, TroveManager or StabilityPool.
74-
/// @param _account account to receive the ETH amount
75-
/// @param _amount ETH amount to send
76-
function sendETH(address _account, uint _amount) external override {
73+
/// @notice Send RBTC amount to given account. Updates ActivePool balance. Only callable by BorrowerOperations, TroveManager or StabilityPool.
74+
/// @param _account account to receive the RBTC amount
75+
/// @param _amount RBTC amount to send
76+
function sendRBTC(address _account, uint _amount) external override {
7777
_requireCallerIsBOorTroveMorSP();
78-
ETH = ETH.sub(_amount);
79-
emit ActivePoolETHBalanceUpdated(ETH);
80-
emit EtherSent(_account, _amount);
78+
RBTC = RBTC.sub(_amount);
79+
emit ActivePoolRBTCBalanceUpdated(RBTC);
80+
emit RBtcerSent(_account, _amount);
8181

8282
(bool success, ) = _account.call{value: _amount}("");
83-
require(success, "ActivePool: sending ETH failed");
83+
require(success, "ActivePool: sending RBTC failed");
8484
}
8585

8686
/// @notice Increases ZUSD debt of the active pool. Only callable by BorrowerOperations, TroveManager or StabilityPool.
@@ -128,7 +128,7 @@ contract ActivePool is CheckContract, IActivePool, ActivePoolStorage {
128128

129129
receive() external payable {
130130
_requireCallerIsBorrowerOperationsOrDefaultPool();
131-
ETH = ETH.add(msg.value);
132-
emit ActivePoolETHBalanceUpdated(ETH);
131+
RBTC = RBTC.add(msg.value);
132+
emit ActivePoolRBTCBalanceUpdated(RBTC);
133133
}
134134
}

packages/contracts/contracts/ActivePoolStorage.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "./Dependencies/Ownable.sol";
55

66
/**
77
* @title Active Pool Storage
8-
* @dev Stores Active Pool required addresses and internal ETH and ZUSD debt states
8+
* @dev Stores Active Pool required addresses and internal RBTC and ZUSD debt states
99
* Extends Ownable
1010
*/
1111
contract ActivePoolStorage is Ownable {
@@ -15,6 +15,6 @@ contract ActivePoolStorage is Ownable {
1515
address public troveManagerAddress;
1616
address public stabilityPoolAddress;
1717
address public defaultPoolAddress;
18-
uint256 internal ETH; // deposited ether tracker
18+
uint256 internal RBTC; // deposited ether tracker
1919
uint256 internal ZUSDDebt;
2020
}

packages/contracts/contracts/BorrowerOperations.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,18 @@ contract BorrowerOperations is LiquityBase, BorrowerOperationsStorage, CheckCont
213213
emit ZUSDBorrowingFeePaid(_sender, vars.ZUSDFee);
214214
}
215215

216-
/// Send ETH as collateral to a trove
216+
/// Send RBTC as collateral to a trove
217217
function addColl(address _upperHint, address _lowerHint) external payable override {
218218
_adjustTrove(msg.sender, 0, 0, false, _upperHint, _lowerHint, 0);
219219
}
220220

221-
/// Send ETH as collateral to a trove. Called by only the Stability Pool.
222-
function moveETHGainToTrove(address _borrower, address _upperHint, address _lowerHint) external payable override {
221+
/// Send RBTC as collateral to a trove. Called by only the Stability Pool.
222+
function moveRBTCGainToTrove(address _borrower, address _upperHint, address _lowerHint) external payable override {
223223
_requireCallerIsStabilityPool();
224224
_adjustTrove(_borrower, 0, 0, false, _upperHint, _lowerHint, 0);
225225
}
226226

227-
/// Withdraw ETH collateral from a trove
227+
/// Withdraw RBTC collateral from a trove
228228
function withdrawColl(uint _collWithdrawal, address _upperHint, address _lowerHint) external override {
229229
_adjustTrove(msg.sender, _collWithdrawal, 0, false, _upperHint, _lowerHint, 0);
230230
}
@@ -282,12 +282,12 @@ contract BorrowerOperations is LiquityBase, BorrowerOperationsStorage, CheckCont
282282
_requireNonZeroAdjustment(_collWithdrawal, _ZUSDChange);
283283
_requireTroveisActive(contractsCache.troveManager, _borrower);
284284

285-
// Confirm the operation is either a borrower adjusting their own trove, or a pure ETH transfer from the Stability Pool to a trove
285+
// Confirm the operation is either a borrower adjusting their own trove, or a pure RBTC transfer from the Stability Pool to a trove
286286
assert(_sender == _borrower || (_sender == stabilityPoolAddress && _value > 0 && _ZUSDChange == 0));
287287

288288
contractsCache.troveManager.applyPendingRewards(_borrower);
289289

290-
// Get the collChange based on whether or not ETH was sent in the transaction
290+
// Get the collChange based on whether or not RBTC was sent in the transaction
291291
(vars.collChange, vars.isCollIncrease) = _getCollChange(_value, _collWithdrawal);
292292

293293
vars.netDebtChange = _ZUSDChange;
@@ -327,7 +327,7 @@ contract BorrowerOperations is LiquityBase, BorrowerOperationsStorage, CheckCont
327327
emit ZUSDBorrowingFeePaid(_sender, vars.ZUSDFee);
328328

329329
// Use the unmodified _ZUSDChange here, as we don't send the fee to the user
330-
_moveTokensAndETHfromAdjustment(
330+
_moveTokensAndRBTCfromAdjustment(
331331
contractsCache.activePool,
332332
contractsCache.zusdToken,
333333
_sender,
@@ -382,14 +382,14 @@ contract BorrowerOperations is LiquityBase, BorrowerOperationsStorage, CheckCont
382382
_repayZUSD(activePoolCached, zusdTokenCached, gasPoolAddress, ZUSD_GAS_COMPENSATION);
383383

384384
// Send the collateral back to the user
385-
activePoolCached.sendETH(msg.sender, coll);
385+
activePoolCached.sendRBTC(msg.sender, coll);
386386
}
387387

388388
/**
389389
* Claim remaining collateral from a redemption or from a liquidation with ICR > MCR in Recovery Mode
390390
*/
391391
function claimCollateral() external override {
392-
// send ETH from CollSurplus Pool to owner
392+
// send RBTC from CollSurplus Pool to owner
393393
collSurplusPool.claimColl(msg.sender);
394394
}
395395

@@ -449,7 +449,7 @@ contract BorrowerOperations is LiquityBase, BorrowerOperationsStorage, CheckCont
449449
return (newColl, newDebt);
450450
}
451451

452-
function _moveTokensAndETHfromAdjustment
452+
function _moveTokensAndRBTCfromAdjustment
453453
(
454454
IActivePool _activePool,
455455
IZUSDToken _zusdToken,
@@ -472,14 +472,14 @@ contract BorrowerOperations is LiquityBase, BorrowerOperationsStorage, CheckCont
472472
if (_isCollIncrease) {
473473
_activePoolAddColl(_activePool, _collChange);
474474
} else {
475-
_activePool.sendETH(_borrower, _collChange);
475+
_activePool.sendRBTC(_borrower, _collChange);
476476
}
477477
}
478478

479-
/// Send ETH to Active Pool and increase its recorded ETH balance
479+
/// Send RBTC to Active Pool and increase its recorded RBTC balance
480480
function _activePoolAddColl(IActivePool _activePool, uint _amount) internal {
481481
(bool success, ) = address(_activePool).call{value: _amount}("");
482-
require(success, "BorrowerOps: Sending ETH to ActivePool failed");
482+
require(success, "BorrowerOps: Sending RBTC to ActivePool failed");
483483
}
484484

485485
/// Issue the specified amount of ZUSD to _account and increases the total active debt (_netDebtIncrease potentially includes a ZUSDFee)

packages/contracts/contracts/CollSurplusPool.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract CollSurplusPool is CollSurplusPoolStorage, CheckContract, ICollSurplusP
1818
event ActivePoolAddressChanged(address _newActivePoolAddress);
1919

2020
event CollBalanceUpdated(address indexed _account, uint _newBalance);
21-
event EtherSent(address _to, uint _amount);
21+
event RBtcerSent(address _to, uint _amount);
2222

2323
// --- Contract setters ---
2424

@@ -46,10 +46,10 @@ contract CollSurplusPool is CollSurplusPoolStorage, CheckContract, ICollSurplusP
4646

4747
}
4848

49-
/** Returns the ETH state variable at ActivePool address.
49+
/** Returns the RBTC state variable at ActivePool address.
5050
Not necessarily equal to the raw ether balance - ether can be forcibly sent to contracts. */
51-
function getETH() external view override returns (uint) {
52-
return ETH;
51+
function getRBTC() external view override returns (uint) {
52+
return RBTC;
5353
}
5454

5555
function getCollateral(address _account) external view override returns (uint) {
@@ -75,11 +75,11 @@ contract CollSurplusPool is CollSurplusPoolStorage, CheckContract, ICollSurplusP
7575
balances[_account] = 0;
7676
emit CollBalanceUpdated(_account, 0);
7777

78-
ETH = ETH.sub(claimableColl);
79-
emit EtherSent(_account, claimableColl);
78+
RBTC = RBTC.sub(claimableColl);
79+
emit RBtcerSent(_account, claimableColl);
8080

8181
(bool success, ) = _account.call{ value: claimableColl }("");
82-
require(success, "CollSurplusPool: sending ETH failed");
82+
require(success, "CollSurplusPool: sending RBTC failed");
8383
}
8484

8585
// --- 'require' functions ---
@@ -106,6 +106,6 @@ contract CollSurplusPool is CollSurplusPoolStorage, CheckContract, ICollSurplusP
106106

107107
receive() external payable {
108108
_requireCallerIsActivePool();
109-
ETH = ETH.add(msg.value);
109+
RBTC = RBTC.add(msg.value);
110110
}
111111
}

packages/contracts/contracts/CollSurplusPoolStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ contract CollSurplusPoolStorage is Ownable {
1212
address public activePoolAddress;
1313

1414
// deposited ether tracker
15-
uint256 internal ETH;
15+
uint256 internal RBTC;
1616
// Collateral surplus claimable by trove owners
1717
mapping(address => uint256) internal balances;
1818
}

packages/contracts/contracts/DefaultPool.sol

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import "./Dependencies/console.sol";
99
import "./DefaultPoolStorage.sol";
1010

1111
/**
12-
* The Default Pool holds the ETH and ZUSD debt (but not ZUSD tokens) from liquidations that have been redistributed
12+
* The Default Pool holds the RBTC and ZUSD debt (but not ZUSD tokens) from liquidations that have been redistributed
1313
* to active troves but not yet "applied", i.e. not yet recorded on a recipient active trove's struct.
1414
*
15-
* When a trove makes an operation that applies its pending ETH and ZUSD debt, its pending ETH and ZUSD debt is moved
15+
* When a trove makes an operation that applies its pending RBTC and ZUSD debt, its pending RBTC and ZUSD debt is moved
1616
* from the Default Pool to the Active Pool.
1717
*/
1818
contract DefaultPool is DefaultPoolStorage, CheckContract, IDefaultPool {
1919
using SafeMath for uint256;
2020

2121
event TroveManagerAddressChanged(address _newTroveManagerAddress);
2222
event DefaultPoolZUSDDebtUpdated(uint _ZUSDDebt);
23-
event DefaultPoolETHBalanceUpdated(uint _ETH);
23+
event DefaultPoolRBTCBalanceUpdated(uint _RBTC);
2424

2525
// --- Dependency setters ---
2626

@@ -46,12 +46,12 @@ contract DefaultPool is DefaultPoolStorage, CheckContract, IDefaultPool {
4646
// --- Getters for public variables. Required by IPool interface ---
4747

4848
/**
49-
* @return the ETH state variable.
49+
* @return the RBTC state variable.
5050
*
51-
* Not necessarily equal to the the contract's raw ETH balance - ether can be forcibly sent to contracts.
51+
* Not necessarily equal to the the contract's raw RBTC balance - ether can be forcibly sent to contracts.
5252
*/
53-
function getETH() external view override returns (uint) {
54-
return ETH;
53+
function getRBTC() external view override returns (uint) {
54+
return RBTC;
5555
}
5656

5757
function getZUSDDebt() external view override returns (uint) {
@@ -60,15 +60,15 @@ contract DefaultPool is DefaultPoolStorage, CheckContract, IDefaultPool {
6060

6161
// --- Pool functionality ---
6262

63-
function sendETHToActivePool(uint _amount) external override {
63+
function sendRBTCToActivePool(uint _amount) external override {
6464
_requireCallerIsTroveManager();
6565
address activePool = activePoolAddress; // cache to save an SLOAD
66-
ETH = ETH.sub(_amount);
67-
emit DefaultPoolETHBalanceUpdated(ETH);
68-
emit EtherSent(activePool, _amount);
66+
RBTC = RBTC.sub(_amount);
67+
emit DefaultPoolRBTCBalanceUpdated(RBTC);
68+
emit RBtcerSent(activePool, _amount);
6969

7070
(bool success, ) = activePool.call{ value: _amount }("");
71-
require(success, "DefaultPool: sending ETH failed");
71+
require(success, "DefaultPool: sending RBTC failed");
7272
}
7373

7474
function increaseZUSDDebt(uint _amount) external override {
@@ -97,7 +97,7 @@ contract DefaultPool is DefaultPoolStorage, CheckContract, IDefaultPool {
9797

9898
receive() external payable {
9999
_requireCallerIsActivePool();
100-
ETH = ETH.add(msg.value);
101-
emit DefaultPoolETHBalanceUpdated(ETH);
100+
RBTC = RBTC.add(msg.value);
101+
emit DefaultPoolRBTCBalanceUpdated(RBTC);
102102
}
103103
}

packages/contracts/contracts/DefaultPoolStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ contract DefaultPoolStorage is Ownable {
1010

1111
address public troveManagerAddress;
1212
address public activePoolAddress;
13-
uint256 internal ETH; // deposited ETH tracker
13+
uint256 internal RBTC; // deposited RBTC tracker
1414
uint256 internal ZUSDDebt; // debt
1515
}

packages/contracts/contracts/Dependencies/IERC2612.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pragma solidity 0.6.11;
77
*
88
* Adds the {permit} method, which can be used to change one's
99
* {IERC20-allowance} without having to send a transaction, by signing a
10-
* message. This allows users to spend tokens without having to hold Ether.
10+
* message. This allows users to spend tokens without having to hold RBtcer.
1111
*
1212
* See https://eips.ethereum.org/EIPS/eip-2612.
1313
*

packages/contracts/contracts/Dependencies/LiquityBase.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ contract LiquityBase is BaseMath, ILiquityBase {
4444
return _debt.sub(ZUSD_GAS_COMPENSATION);
4545
}
4646

47-
/// Return the amount of ETH to be drawn from a trove's collateral and sent as gas compensation.
47+
/// Return the amount of RBTC to be drawn from a trove's collateral and sent as gas compensation.
4848
function _getCollGasCompensation(uint256 _entireColl) internal view returns (uint256) {
4949
return _entireColl / liquityBaseParams.PERCENT_DIVISOR();
5050
}
5151

5252
function getEntireSystemColl() public view returns (uint256 entireSystemColl) {
53-
uint256 activeColl = activePool.getETH();
54-
uint256 liquidatedColl = defaultPool.getETH();
53+
uint256 activeColl = activePool.getRBTC();
54+
uint256 liquidatedColl = defaultPool.getRBTC();
5555

5656
return activeColl.add(liquidatedColl);
5757
}

0 commit comments

Comments
 (0)