Skip to content

Commit 2879144

Browse files
committed
updated interfaces
1 parent eefb76d commit 2879144

File tree

8 files changed

+101
-23
lines changed

8 files changed

+101
-23
lines changed

contracts/_interfaces/IAMPL.sol

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.6.12;
3+
4+
interface IAMPL {
5+
// ERC20
6+
function totalSupply() external view returns (uint256);
7+
8+
function balanceOf(address who) external view returns (uint256);
9+
10+
function allowance(address owner_, address spender) external view returns (uint256);
11+
12+
function transfer(address to, uint256 value) external returns (bool);
13+
14+
function approve(address spender, uint256 value) external returns (bool);
15+
16+
function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
17+
18+
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
19+
20+
function transferFrom(
21+
address from,
22+
address to,
23+
uint256 value
24+
) external returns (bool);
25+
26+
// EIP-2612
27+
function permit(
28+
address owner,
29+
address spender,
30+
uint256 value,
31+
uint256 deadline,
32+
uint8 v,
33+
bytes32 r,
34+
bytes32 s
35+
) external;
36+
37+
function nonces(address owner) external view returns (uint256);
38+
39+
function DOMAIN_SEPARATOR() external view returns (bytes32);
40+
41+
// Elastic token interface
42+
function scaledBalanceOf(address who) external view returns (uint256);
43+
44+
function scaledTotalSupply() external view returns (uint256);
45+
46+
function transferAll(address to) external returns (bool);
47+
48+
function transferAllFrom(address from, address to) external returns (bool);
49+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.6.12;
3+
4+
interface IAmpleforth {
5+
function epoch() external view returns (uint256);
6+
7+
function lastRebaseTimestampSec() external view returns (uint256);
8+
9+
function inRebaseWindow() external view returns (bool);
10+
11+
function globalAmpleforthEpochAndAMPLSupply() external view returns (uint256, uint256);
12+
}

contracts/_interfaces/IAmpleforthPolicy.sol

Lines changed: 0 additions & 6 deletions
This file was deleted.

contracts/_interfaces/IXCAmple.sol

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
pragma solidity 0.6.12;
33

4-
interface IXCAmple {
5-
function globalAMPLSupply() external returns (uint256);
4+
import "./IAMPL.sol";
65

7-
function mint(address who, uint256 value) external;
8-
9-
function burn(address who, uint256 value) external;
10-
11-
function rebase(uint256 globalAmpleforthEpoch_, uint256 globalAMPLSupply_)
12-
external
13-
returns (uint256);
6+
interface IXCAmple is IAMPL {
7+
function globalAMPLSupply() external view returns (uint256);
148
}

contracts/_interfaces/IXCAmpleController.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
pragma solidity 0.6.12;
33

44
interface IXCAmpleController {
5-
function globalAmpleforthEpoch() external returns (uint256);
5+
function rebase() external;
66

7-
function mint(address recipient, uint256 xcAmplAmount) external;
7+
function lastRebaseTimestampSec() external view returns (uint256);
88

9-
function burn(address depositor, uint256 xcAmplAmount) external;
9+
function globalAmpleforthEpoch() external view returns (uint256);
1010

11-
function reportRebase(uint256 nextGlobalAmpleforthEpoch, uint256 nextGlobalAMPLSupply) external;
11+
function globalAmpleforthEpochAndAMPLSupply() external view returns (uint256, uint256);
1212
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.6.12;
3+
4+
interface IXCAmpleControllerGateway {
5+
function nextGlobalAmpleforthEpoch() external view returns (uint256);
6+
7+
function nextGlobalAMPLSupply() external view returns (uint256);
8+
9+
function mint(address recipient, uint256 xcAmplAmount) external;
10+
11+
function burn(address depositor, uint256 xcAmplAmount) external;
12+
13+
function reportRebase(uint256 nextGlobalAmpleforthEpoch_, uint256 nextGlobalAMPLSupply_)
14+
external;
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
pragma solidity 0.6.12;
3+
4+
interface IXCAmpleSupplyPolicy {
5+
function rebase(uint256 globalAmpleforthEpoch_, uint256 globalAMPLSupply_)
6+
external
7+
returns (uint256);
8+
9+
function mint(address who, uint256 value) external;
10+
11+
function burn(address who, uint256 value) external;
12+
}

test/_helpers/ampl_helpers.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ async function setupAMPLContracts (deployer) {
8787
};
8888

8989
const getCurrentState = async () => {
90-
const epoch = await policy.epoch();
91-
const totalSupply = await ampl.totalSupply();
90+
const r = await policy.globalAmpleforthEpochAndAMPLSupply();
91+
const epoch = r[0];
92+
const totalSupply = r[1];
9293
return { epoch, totalSupply };
9394
};
9495

@@ -141,8 +142,9 @@ async function setupXCAMPLContracts (deployer) {
141142
await xcController.setRebaseRelayer(xcRebaseRelayer.address);
142143

143144
const getCurrentState = async () => {
144-
const epoch = await xcController.globalAmpleforthEpoch();
145-
const totalSupply = await xcAmple.globalAMPLSupply();
145+
const r = await xcController.globalAmpleforthEpochAndAMPLSupply();
146+
const epoch = r[0];
147+
const totalSupply = r[1];
146148
return { epoch, totalSupply };
147149
};
148150

0 commit comments

Comments
 (0)