Skip to content

Commit 293849a

Browse files
committed
feat: add interface contracts
1 parent 4e87e17 commit 293849a

Some content is hidden

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

43 files changed

+1480
-555
lines changed

bun.lockb

2.66 KB
Binary file not shown.

contracts/Greeter.sol

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

contracts/erc20/MyERC20Token.sol

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.4;
3+
4+
import { IFuelRouter } from "./IFuelRouter.sol";
5+
import { IEventImplementation } from "./IEventImplementation.sol";
6+
7+
interface IActionsProcessor {
8+
function primarySale(
9+
address _storageProxy,
10+
IEventImplementation.TicketAction[] calldata _ticketActions,
11+
uint64[] calldata _actionIds,
12+
IFuelRouter _router
13+
) external;
14+
15+
function secondarySale(
16+
address _storageProxy,
17+
IEventImplementation.TicketAction[] calldata _ticketActions,
18+
uint64[] calldata _actionIds,
19+
IFuelRouter _router
20+
) external;
21+
22+
function scan(
23+
address _storageProxy,
24+
IEventImplementation.TicketAction[] calldata _ticketActions,
25+
uint64[] calldata _actionIds
26+
) external;
27+
28+
function checkIn(
29+
address _storageProxy,
30+
IEventImplementation.TicketAction[] calldata _ticketActions,
31+
uint64[] calldata _actionIds
32+
) external;
33+
34+
function invalidate(
35+
address _storageProxy,
36+
IEventImplementation.TicketAction[] calldata _ticketActions,
37+
uint64[] calldata _actionIds
38+
) external;
39+
40+
function claim(
41+
address _storageProxy,
42+
IEventImplementation.TicketAction[] calldata _ticketActions,
43+
uint64[] calldata _actionIds
44+
) external;
45+
46+
function transfer(
47+
address _storageProxy,
48+
IEventImplementation.TicketAction[] calldata _ticketActions,
49+
uint64[] calldata _actionIds
50+
) external;
51+
}

contracts/interfaces/IAuth.sol

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.4;
3+
4+
import { IAccessControl } from "@openzeppelin/contracts/access/IAccessControl.sol";
5+
6+
interface IAuth is IAccessControl {
7+
function addIntegratorAdminToIndex(address, uint256) external;
8+
9+
function removeIntegratorAdmin(address) external;
10+
11+
function hasProtocolDAORole(address) external view;
12+
13+
function hasEconomicsConfigurationRole(address, uint256) external view;
14+
15+
function hasEventFinancingConfigurationRole(address, uint256) external view;
16+
17+
function hasIntegratorAdminRole(address) external view;
18+
19+
function hasEventFactoryRole(address) external view;
20+
21+
function hasEventRole(address) external view;
22+
23+
function hasRelayerRole(address) external view;
24+
25+
function hasTopUpRole(address) external view;
26+
27+
function hasCustodialTopUpRole(address) external view;
28+
29+
function hasPriceOracleRole(address) external view;
30+
31+
function hasStakingBalanceOracleRole(address) external view;
32+
33+
function grantEventRole(address) external;
34+
35+
function hasRouterRegistryRole(address) external view;
36+
37+
function hasFuelRouterRole(address) external view;
38+
39+
function hasEconomicsFactoryRole(address _sender) external view;
40+
41+
function hasActionsProcessorRole(address) external view;
42+
}

contracts/interfaces/IBaseRouter.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.4;
3+
4+
import { IEventImplementation } from "./IEventImplementation.sol";
5+
6+
interface IBaseRouter {
7+
function routeFuelForPrimarySale(
8+
IEventImplementation.TicketAction[] calldata _ticketActions
9+
) external returns (uint256 _totalFuelValue, uint256 _totalFuelTokens);
10+
11+
function routeFuelForSecondarySale(
12+
IEventImplementation.TicketAction[] calldata _ticketActions
13+
) external returns (uint256 _totalFuelValue, uint256 _totalFuelTokens);
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0 ^0.8.4;
3+
4+
interface ICreatorToken {
5+
event TransferValidatorUpdated(address oldValidator, address newValidator);
6+
function getTransferValidator() external view returns (address validator);
7+
function setTransferValidator(address validator) external;
8+
function getTransferValidationFunction() external view returns (bytes4 functionSignature, bool isViewFunction);
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0 ^0.8.4;
3+
4+
interface ICreatorTokenLegacy {
5+
event TransferValidatorUpdated(address oldValidator, address newValidator);
6+
function getTransferValidator() external view returns (address validator);
7+
function setTransferValidator(address validator) external;
8+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.4;
3+
4+
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5+
6+
interface IEconomicsFactory {
7+
// Data structure containing all the different rates for a particular relayer.
8+
// 100% (1) 1_000_000,
9+
// 10% (0.1) = 100_000,
10+
// 1% (0.01) = 10_000,
11+
// 0.1% (0.001) = 1_000,
12+
// 0.01% (0.0001) = 100,
13+
// 0.001% (0,00001) = 10,
14+
// 0.0001% = (0.000001) = 1
15+
// All scaled by 1_000_000.
16+
//
17+
// USD values (e.g. minFee, maxFee) are scaled by 1_000 (tenth of a cent).
18+
struct DynamicRates {
19+
uint24 minFeePrimary;
20+
uint24 maxFeePrimary;
21+
uint24 primaryRate;
22+
uint24 minFeeSecondary;
23+
uint24 maxFeeSecondary;
24+
uint24 secondaryRate;
25+
}
26+
27+
struct IntegratorData {
28+
uint32 index;
29+
bool isBillingEnabled;
30+
bool isConfigured;
31+
string name;
32+
bool onCredit;
33+
}
34+
35+
struct RelayerData {
36+
uint32 integratorIndex;
37+
}
38+
39+
// Used strictly for data migration between Economics and EconomicsFactory contracts
40+
struct IntegratorRelayerData {
41+
uint256 integratorIndex;
42+
address[] relayers;
43+
}
44+
45+
event UpdateIntegratorOnCredit(uint32 integratorIndex, bool onCredit);
46+
47+
event UpdateSalesTaxFuelDestination(address salesTaxFuelDestination);
48+
49+
event UpdateFuelToken(address old, address updated);
50+
51+
event EnableIntegratorBilling(uint32 integratorIndex);
52+
53+
event UpdateDynamicRates(uint32 indexed integratorIndex, DynamicRates dynamicRates);
54+
55+
event IntegratorToppedUp(
56+
uint32 indexed integratorIndex,
57+
address economicsContract,
58+
uint256 indexed total,
59+
uint256 topUpPrice
60+
);
61+
62+
event UpdateProtocolRates(DynamicRates protocolRates);
63+
64+
event IntegratorActivated(uint32 indexed integratorIndex);
65+
66+
event ConfigurationStatusUpdated(uint32 indexed integratorIndex, bool status);
67+
68+
event BillingStatusUpdated(uint32 indexed integratorIndex, bool status);
69+
70+
event IntegratorConfigured(
71+
uint256 indexed integratorIndex,
72+
string name,
73+
address relayerAddress,
74+
bool isDigitalTwin,
75+
DynamicRates dynamicRates
76+
);
77+
event IntegratorDisabled(uint32 indexed integratorIndex);
78+
79+
event RelayerRemoved(address indexed relayerAddress, uint256 indexed integratorIndex);
80+
81+
event EconomicsContractDeployed(address indexed economicsAddress, uint256 indexed integratorIndex);
82+
83+
event RelayerAdded(address indexed relayerAddress, uint256 indexed integratorIndex);
84+
85+
event DisableIntegratorBilling(uint32 integratorIndex);
86+
87+
event IntegratorNameSet(uint256 integratorIndex, string name);
88+
89+
event EventEmitterSet(address indexed eventEmitter);
90+
91+
function relayerToIndex(address relayerAddress) external returns (uint32 integratorIndex);
92+
93+
function isIntegratorDigitalTwin(address relayerAddress) external view returns (bool isDigitalTwin);
94+
95+
function fuelToken() external view returns (IERC20);
96+
97+
function wasUpgradeSuccessFull() external view returns (bool);
98+
99+
function economicsContracts(uint256 integratorIndex) external view returns (address);
100+
101+
function returnDynamicRatesOfIntegrator(
102+
uint256 integratorIndex
103+
) external view returns (DynamicRates memory dynamicRates);
104+
105+
function setupIntegrator(
106+
string calldata name,
107+
address relayerAddress,
108+
DynamicRates calldata dynamicRates,
109+
bool isDigitalTwin
110+
) external returns (address economicsAddress);
111+
112+
function topUpIntegrator(
113+
uint256 integratorIndex,
114+
address sender,
115+
uint256 total,
116+
uint256 price
117+
) external returns (uint256);
118+
119+
function setFuelToken(address _fuelToken) external;
120+
121+
function initialize() external;
122+
123+
function isIntegratorConfigured(uint256 integratorIndex) external view returns (bool isConfigured);
124+
125+
function isIntegratorEnabled(uint256 integratorIndex) external view returns (bool isEnabled);
126+
127+
function configuredIntegratorIndex(address relayerAddress) external view returns (uint256 integratorIndex);
128+
129+
function configuredIntegratorEconomics(uint256 integratorIndex) external view returns (address economicsAddress);
130+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.4;
3+
4+
import { IPricingFIFO } from "./IPricingFIFO.sol";
5+
import { IFuelRouter } from "./IFuelRouter.sol";
6+
7+
interface IEconomicsImplementation is IPricingFIFO {
8+
event OverdraftEnabledStatusSet(bool shouldEnableOverdraft);
9+
10+
event ToppedUp(uint256 price, uint256 amount);
11+
12+
event FuelReservedFromTicks(uint256 usdAmount, uint256 fuelAmount);
13+
14+
event OverdraftInterestSet(uint256 indexed interestPerYear);
15+
16+
function getFuelFromTicks(
17+
uint256 _usdAmount,
18+
IFuelRouter.FeeType _feeType
19+
) external returns (uint256 fuelTokenAmount_);
20+
21+
function topUpEconomics(uint256 _amount, uint256 _price) external returns (uint256 totalFuel_);
22+
23+
function setOverdraftEnabledStatus(bool shouldEnableOverdraft) external;
24+
25+
function transferFuelToCollector(
26+
uint256 _totalAmount,
27+
uint256 _protocolFuel,
28+
uint256 _treasuryFuel,
29+
uint256 _stakersFuel
30+
) external;
31+
32+
function fuelBalance() external view returns (uint256 fuelBalance_);
33+
34+
function setFuelCollector(address _newFuelCollector) external;
35+
36+
// Migration events
37+
38+
event TickUpdated(uint256 indexed tickIndex, IPricingFIFO.TickInfo tickInfo);
39+
40+
event UpdatedStorage(uint256 totalTokensToppedUp, uint256 totalTokensSpent);
41+
42+
event MigrationComplete(uint256 getBalance, uint256 migrateBalance);
43+
44+
struct MigrationData {
45+
TickInfo[] topUpTicks;
46+
uint256 activeTickIndex;
47+
uint256 totalTokensToppedUp;
48+
uint256 totalTokensSpent;
49+
uint256 totalUsdToppedUp;
50+
uint256 totalUsdSpent;
51+
bool overdraftEnabled;
52+
bool inOverdraft;
53+
uint256 currentOverdraftUsd;
54+
uint256 protocolOverdraft;
55+
uint256 treasuryOverdraft;
56+
uint256 stakersOverdraft;
57+
}
58+
}

0 commit comments

Comments
 (0)