Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename MintGoldSchedule #11040

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/protocol/contractPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export const SOLIDITY_08_PACKAGE = {
proxiesPath: '/', // Proxies are still with 0.5 contracts
// Proxies shouldn't have to be added to a list manually
// https://github.com/celo-org/celo-monorepo/issues/10555
contracts: ['GasPriceMinimum', 'FeeCurrencyDirectory', 'MintGoldSchedule'],
contracts: ['GasPriceMinimum', 'FeeCurrencyDirectory', 'MintCeloSchedule'],
proxyContracts: [
'GasPriceMinimumProxy',
'FeeCurrencyDirectoryProxy',
'MentoFeeCurrencyAdapterV1',
'MintGoldScheduleProxy',
'MintCeloScheduleProxy',
],
truffleConfig: 'truffle-config0.8.js',
} satisfies ContractPackage
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "../../contracts-0.8/common/interfaces/IGoldToken.sol";
/**
* @title Contract for minting new CELO token based on a schedule.
*/
contract MintGoldSchedule is UsingRegistry, ReentrancyGuard, Initializable, IsL2Check {
contract MintCeloSchedule is UsingRegistry, ReentrancyGuard, Initializable, IsL2Check {
using FixidityLib for FixidityLib.Fraction;

uint256 constant GENESIS_GOLD_SUPPLY = 600000000 ether; // 600 million Gold
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -49,7 +49,7 @@ contract MintGoldSchedule is UsingRegistry, ReentrancyGuard, Initializable, IsL2
constructor(bool test) public Initializable(test) {}

/**
* @notice A constructor for initialising a new instance of a MintGoldSchedule contract.
* @notice A constructor for initialising a new instance of a MintCeloSchedule contract.
*/
function initialize() external initializer {
_transferOwnership(msg.sender);
Expand Down Expand Up @@ -208,7 +208,7 @@ contract MintGoldSchedule is UsingRegistry, ReentrancyGuard, Initializable, IsL2
}

/**
* @return The total balance minted by the MintGoldSchedule contract.
* @return The total balance minted by the MintCeloSchedule contract.
*/
function getTotalMintedBySchedule() public view returns (uint256) {
return totalMintedBySchedule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ interface IGoldToken is IERC20 {
function setRegistry(address registryAddress) external;

/**
* @notice Used set the address of the MintGoldSchedule contract.
* @param goldTokenMintingScheduleAddress The address of the MintGoldSchedule contract.
* @notice Used set the address of the MintCeloSchedule contract.
* @param goldTokenMintingScheduleAddress The address of the MintCeloSchedule contract.
*/
function setGoldTokenMintingScheduleAddress(address goldTokenMintingScheduleAddress) external;
pahor167 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.5.13 <0.9.0;

interface IMintGoldScheduleInitializer {
interface IMintCeloScheduleInitializer {
function initialize() external;
}
12 changes: 6 additions & 6 deletions packages/protocol/contracts/common/GoldToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "./CalledByVm.sol";
import "./Initializable.sol";
import "./interfaces/ICeloToken.sol";
import "./interfaces/ICeloVersionedContract.sol";
import "./interfaces/IMintGoldSchedule.sol";
import "./interfaces/IMintCeloSchedule.sol";
import "../../contracts-0.8/common/IsL2Check.sol";

contract GoldToken is
Expand Down Expand Up @@ -37,7 +37,7 @@ contract GoldToken is
// Burn address is 0xdEaD because truffle is having buggy behaviour with the zero address
address constant BURN_ADDRESS = address(0x000000000000000000000000000000000000dEaD);

IMintGoldSchedule public goldTokenMintingSchedule;
IMintCeloSchedule public goldTokenMintingSchedule;
pahor167 marked this conversation as resolved.
Show resolved Hide resolved

event Transfer(address indexed from, address indexed to, uint256 value);

Expand All @@ -49,7 +49,7 @@ contract GoldToken is

modifier onlySchedule() {
if (isL2()) {
require(msg.sender == address(goldTokenMintingSchedule), "Only MintGoldSchedule can call.");
require(msg.sender == address(goldTokenMintingSchedule), "Only MintCeloSchedule can call.");
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
} else {
require(msg.sender == address(0), "Only VM can call.");
}
Expand All @@ -73,8 +73,8 @@ contract GoldToken is
}

/**
* @notice Used set the address of the MintGoldSchedule contract.
* @param goldTokenMintingScheduleAddress The address of the MintGoldSchedule contract.
* @notice Used set the address of the MintCeloSchedule contract.
* @param goldTokenMintingScheduleAddress The address of the MintCeloSchedule contract.
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
*/
function setGoldTokenMintingScheduleAddress(
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
address goldTokenMintingScheduleAddress
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -84,7 +84,7 @@ contract GoldToken is
goldTokenMintingScheduleAddress != address(goldTokenMintingSchedule),
"Invalid address."
);
goldTokenMintingSchedule = IMintGoldSchedule(goldTokenMintingScheduleAddress);
goldTokenMintingSchedule = IMintCeloSchedule(goldTokenMintingScheduleAddress);

emit SetGoldTokenMintingScheduleAddress(goldTokenMintingScheduleAddress);
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-only
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
pragma solidity >=0.5.13 <0.9.0;

interface IMintGoldSchedule {
interface IMintCeloSchedule {
/**
* @notice Mints CELO to the beneficiaries according to the predefined schedule.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pragma solidity ^0.5.13;
import "../Proxy.sol";

/* solhint-disable-next-line no-empty-blocks */
contract MintGoldScheduleProxy is Proxy {}
contract MintCeloScheduleProxy is Proxy {}
2 changes: 1 addition & 1 deletion packages/protocol/lib/registry-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export enum CeloContractName {
GovernanceApproverMultiSig = 'GovernanceApproverMultiSig',
GrandaMento = 'GrandaMento',
LockedGold = 'LockedGold',
MintGoldSchedule = 'MintGoldSchedule',
MintCeloSchedule = 'MintCeloSchedule',
OdisPayments = 'OdisPayments',
Random = 'Random',
Reserve = 'Reserve',
Expand Down
10 changes: 5 additions & 5 deletions packages/protocol/migrations_sol/Migration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import "@celo-contracts/identity/interfaces/IOdisPaymentsInitializer.sol";
import "@celo-contracts/identity/interfaces/IFederatedAttestationsInitializer.sol";
import "@celo-contracts/stability/interfaces/ISortedOracles.sol";
import "@celo-contracts-8/common/interfaces/IGasPriceMinimumInitializer.sol";
import "@celo-contracts-8/common/interfaces/IMintGoldScheduleInitializer.sol";
import "@celo-contracts-8/common/interfaces/IMintCeloScheduleInitializer.sol";

import "@migrations-sol/HelperInterFaces.sol";
import "@openzeppelin/contracts8/utils/math/Math.sol";
Expand Down Expand Up @@ -235,7 +235,7 @@ contract Migration is Script, UsingRegistry, Constants {
migrateUniswapFeeHandlerSeller();
migrateFeeHandler(json);
migrateOdisPayments();
migrateMintGoldSchedule();
migrateMintCeloSchedule();
migrateGovernance(json);

vm.stopBroadcast();
Expand Down Expand Up @@ -907,10 +907,10 @@ contract Migration is Script, UsingRegistry, Constants {
);
}

function migrateMintGoldSchedule() public {
function migrateMintCeloSchedule() public {
deployProxiedContract(
"MintGoldSchedule",
abi.encodeWithSelector(IMintGoldScheduleInitializer.initialize.selector)
"MintCeloSchedule",
abi.encodeWithSelector(IMintCeloScheduleInitializer.initialize.selector)
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/migrations_sol/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract Constants {
"Governance",
"GovernanceSlasher",
"LockedGold",
"MintGoldSchedule",
"MintCeloSchedule",
"OdisPayments",
"Random",
"Registry",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { CeloContractName } from '@celo/protocol/lib/registry-utils'
import { deploymentForCoreContract } from '@celo/protocol/lib/web3-utils'
import { MintGoldScheduleInstance } from 'types/08'
import { MintCeloScheduleInstance } from 'types/08'
import { SOLIDITY_08_PACKAGE } from '../contractPackages'

const initializeArgs = async () => {
return []
}

module.exports = deploymentForCoreContract<MintGoldScheduleInstance>(
module.exports = deploymentForCoreContract<MintCeloScheduleInstance>(
web3,
artifacts,
CeloContractName.MintGoldSchedule,
CeloContractName.MintCeloSchedule,
initializeArgs,
undefined,
SOLIDITY_08_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"FeeCurrencyDirectory": [],
"MintGoldSchedule": []
"MintCeloSchedule": []
}
4 changes: 2 additions & 2 deletions packages/protocol/scripts/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ProxyContracts = [
'RegistryProxy',
'SortedOraclesProxy',
'UniswapFeeHandlerSellerProxy',
'MintGoldScheduleProxy',
'MintCeloScheduleProxy',
]

export const CoreContracts = [
Expand All @@ -51,7 +51,7 @@ export const CoreContracts = [
'MultiSig',
'Registry',
'Freezer',
'MintGoldSchedule',
'MintCeloSchedule',

// governance
'Election',
Expand Down
8 changes: 4 additions & 4 deletions packages/protocol/test-sol/unit/common/GoldToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract GoldTokenTest is Test, IsL2Check {
goldTokenMintingSchedule = actor("goldTokenMintingSchedule");
pahor167 marked this conversation as resolved.
Show resolved Hide resolved
vm.prank(goldTokenOwner);
goldToken = new GoldToken(true);
deployCodeTo("MintGoldSchedule.sol", abi.encode(false), goldTokenMintingSchedule);
deployCodeTo("MintCeloSchedule.sol", abi.encode(false), goldTokenMintingSchedule);
receiver = actor("receiver");
sender = actor("sender");
vm.deal(receiver, ONE_GOLDTOKEN);
Expand Down Expand Up @@ -221,15 +221,15 @@ contract GoldTokenTest_mint_l2 is GoldTokenTest {

function test_Reverts_whenCalledByOtherThanMintingSchedule() public {
vm.prank(address(0));
vm.expectRevert("Only MintGoldSchedule can call.");
vm.expectRevert("Only MintCeloSchedule can call.");
goldToken.mint(receiver, ONE_GOLDTOKEN);

vm.prank(address(9));
vm.expectRevert("Only MintGoldSchedule can call.");
vm.expectRevert("Only MintCeloSchedule can call.");
goldToken.mint(receiver, ONE_GOLDTOKEN);

vm.prank(goldTokenOwner);
vm.expectRevert("Only MintGoldSchedule can call.");
vm.expectRevert("Only MintCeloSchedule can call.");
goldToken.mint(receiver, ONE_GOLDTOKEN);
}

Expand Down
Loading
Loading