Skip to content

Commit dd0465a

Browse files
authored
Public Contract interfaces (#190)
* checked in standard interface * multichain ampl interface methods
1 parent 4aba740 commit dd0465a

File tree

5 files changed

+73
-6
lines changed

5 files changed

+73
-6
lines changed

contracts/UFragmentsPolicy.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ contract UFragmentsPolicy is Ownable {
212212

213213
/**
214214
* @notice A multi-chain AMPL interface method. The Ampleforth monetary policy contract
215-
* on the base-chain and XCAmpleController contracts on the satellite-chains
215+
* on the base-chain and XC-AmpleController contracts on the satellite-chains
216216
* implement this method. It atomically returns two values:
217217
* what the current contract believes to be,
218218
* the globalAmpleforthEpoch and globalAMPLSupply.
219219
* @return globalAmpleforthEpoch The current epoch number.
220220
* @return globalAMPLSupply The total supply at the current epoch.
221221
*/
222-
function getGlobalAmpleforthEpochAndAMPLSupply() external view returns (uint256, uint256) {
222+
function globalAmpleforthEpochAndAMPLSupply() external view returns (uint256, uint256) {
223223
return (epoch, uFrags.totalSupply());
224224
}
225225

contracts/interfaces/IAMPL.sol

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
pragma solidity 0.4.24;
2+
3+
// Public interface definition for the AMPL - ERC20 token on Ethereum (the base-chain)
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+
pragma solidity 0.4.24;
2+
3+
// Public interface definition for the Ampleforth supply policy on Ethereum (the base-chain)
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+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pragma solidity 0.4.24;
2+
3+
// Public interface definition for the Ampleforth Orchestrator on Ethereum (the base-chain)
4+
interface IOrchestrator {
5+
function rebase() external;
6+
}

test/unit/UFragmentsPolicy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ describe('UFragmentsPolicy:initialize', async function () {
164164
it('epoch', async function () {
165165
expect(await uFragmentsPolicy.epoch()).to.eq(0)
166166
})
167-
it('getGlobalAmpleforthEpochAndAMPLSupply', async function () {
168-
const r = await uFragmentsPolicy.getGlobalAmpleforthEpochAndAMPLSupply()
167+
it('globalAmpleforthEpochAndAMPLSupply', async function () {
168+
const r = await uFragmentsPolicy.globalAmpleforthEpochAndAMPLSupply()
169169
expect(r[0]).to.eq(0)
170170
expect(r[1]).to.eq(0)
171171
})
@@ -833,9 +833,9 @@ describe('UFragmentsPolicy:Rebase', async function () {
833833
expect(await uFragmentsPolicy.epoch()).to.eq(prevEpoch.add(1))
834834
})
835835

836-
it('should update getGlobalAmpleforthEpochAndAMPLSupply', async function () {
836+
it('should update globalAmpleforthEpochAndAMPLSupply', async function () {
837837
await uFragmentsPolicy.connect(orchestrator).rebase()
838-
const r = await uFragmentsPolicy.getGlobalAmpleforthEpochAndAMPLSupply()
838+
const r = await uFragmentsPolicy.globalAmpleforthEpochAndAMPLSupply()
839839
expect(r[0]).to.eq(prevEpoch.add(1))
840840
expect(r[1]).to.eq('1010')
841841
})

0 commit comments

Comments
 (0)