Skip to content

Commit

Permalink
Merge branch 'update_mainnet_deployment' into quota_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored May 13, 2024
2 parents 8142909 + ff0fff1 commit 2807d08
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 35 deletions.
1 change: 0 additions & 1 deletion packages/protocol/deployments/mainnet-contract-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
- admin.taiko.eth accepted the ownership @tx`0x0ed114fee6de4e3e2206cea44e6632ec0c4588f73648d98d8df5dc0183b07885`
- upgraded from `0x91d593d34f2E1904cDCe3D5290a74563F87bCF6f` to `0x4A1091c2fb37D9C4a661c2384Ff539d94CCF853D` @commit `b90b932` @tx`0x416560cd96dc75ccffebe889e8d1ab3e08b33f814dc4a2bf7c6f9555071d1f6f`


#### quota_manager

- proxy: `0x91f67118DD47d502B1f0C354D0611997B022f29E`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ contract TokenUnlocking is OwnableUpgradeable, ReentrancyGuardUpgradeable {
external
initializer
{
if (_taikoToken == address(0) || _recipient == address(0) || _tgeTimestamp == 0) {
if (
_owner == _recipient || _owner == address(0) || _recipient == address(0)
|| _taikoToken == address(0) || _tgeTimestamp == 0
) {
revert INVALID_PARAM();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
[
{
"name": "Alice",
"recipient": "0xa48dEBc18D5e63F1FB94DD513f643e412684f8a4",
"proxy": "0x33A270541f383A4A48dB6C5f1f00A161b8F79e2a",
"vestAmount": 35000
},
{
"name": "Bob",
"recipient": "0xa48dEBc18D5e63F1FB94DD513f643e412684f8a4",
"proxy": "0x33A270541f383A4A48dB6C5f1f00A161b8F79e2a",
"vestAmount": 25000
},
{
"name": "Carol",
"recipient": "0xa48dEBc18D5e63F1FB94DD513f643e412684f8a4",
"proxy": "0x33A270541f383A4A48dB6C5f1f00A161b8F79e2a",
"vestAmount": 15000
Expand Down
34 changes: 16 additions & 18 deletions packages/supplementary-contracts/script/tokenVesting/Vest.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@ import "forge-std/src/console2.sol";

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import "../../contracts/tokenUnlocking/TokenUnlocking.sol";

contract VestTokenUnlocking is Script {
using stdJson for string;

struct VestingItem {
bytes32 name; // Conversion from json "string" to bytes32 will take place in foundry,
// cannot use string here, as json parser cannot interpret string from json, everything
// is bytes-chunks. It is more of informational to script executor anyways.
address recipient;
address proxy;
uint256 vestAmount;
}

ERC20 private tko = ERC20(vm.envAddress("TAIKO_TOKEN"));
ERC20 private tko = ERC20(0x10dea67478c5F8C5E2D90e5E9B26dBe60c54d800);

function run() external {
vm.startBroadcast();
Expand All @@ -32,23 +28,25 @@ contract VestTokenUnlocking is Script {
);

for (uint256 i; i < items.length; i++) {
address proxy = items[i].proxy;
console2.logBytes32(items[i].name);
console2.log("Grantee unlocking contract address:", proxy);
console2.log("Vest amount (TKO):", items[i].vestAmount);
if (items[i].vestAmount != 0) {
address proxy = items[i].proxy;
console2.log("Grantee unlocking contract address:", proxy);
console2.log("Vest amount (TKO):", items[i].vestAmount);

require(TokenUnlocking(proxy).owner() == msg.sender, "msg.sender not owner");
require(
TokenUnlocking(proxy).recipient() == items[i].recipient, "inconsistent recipient"
);
require(TokenUnlocking(proxy).owner() == msg.sender, "msg.sender not owner");
require(
TokenUnlocking(proxy).recipient() == items[i].recipient,
"inconsistent recipient"
);

uint128 vestAmount = uint128(items[i].vestAmount * 1e18);
require(tko.balanceOf(msg.sender) >= vestAmount, "insufficient TKO balance");
uint128 vestAmount = uint128(items[i].vestAmount * 1e18);
require(tko.balanceOf(msg.sender) >= vestAmount, "insufficient TKO balance");

tko.approve(proxy, vestAmount);
TokenUnlocking(proxy).vest(vestAmount);
tko.approve(proxy, vestAmount);
TokenUnlocking(proxy).vest(vestAmount);

console2.log("Vested!\n");
console2.log("Vested!\n");
}
}

vm.stopBroadcast();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@ import "../../contracts/tokenUnlocking/TokenUnlocking.sol";
contract DeployTokenUnlocking is Script {
using stdJson for string;

uint256 public PRIVATE_KEY = vm.envUint("PRIVATE_KEY"); // deployer
address public OWNER = vm.envAddress("OWNER");
address public TAIKO_TOKEN = vm.envAddress("TAIKO_TOKEN");
uint256 public TGE = vm.envUint("TGE_TIMESTAMP");
address public IMPL = vm.envAddress("TOKEN_VESTING_IMPL");
address public OWNER = 0x9CBeE534B5D8a6280e01a14844Ee8aF350399C7F; // admin.taiko.eth
address public TAIKO_TOKEN = 0x10dea67478c5F8C5E2D90e5E9B26dBe60c54d800; // token.taiko.eth
uint64 public TGE = 1_716_767_999; // Date and time (GMT): Sunday, May 26, 2024 11:59:59 PM
address public IMPL = 0x244108e321FE03b0E33FE63Ef62285F05d191a62;

function setUp() public { }

function run() external {
address impl = IMPL == address(0) ? address(new TokenUnlocking()) : IMPL;

string memory path = "/script/tokenUnlocking/Deploy.data.json";
address[] memory recipients = abi.decode(
vm.parseJson(vm.readFile(string.concat(vm.projectRoot(), path))), (address[])
Expand All @@ -30,12 +27,10 @@ contract DeployTokenUnlocking is Script {
for (uint256 i; i < recipients.length; i++) {
console2.log("Grantee:", recipients[i]);

vm.startBroadcast(PRIVATE_KEY);
vm.startBroadcast();
deployProxy({
impl: impl,
data: abi.encodeCall(
TokenUnlocking.init, (OWNER, TAIKO_TOKEN, recipients[i], uint64(TGE))
)
impl: IMPL,
data: abi.encodeCall(TokenUnlocking.init, (OWNER, TAIKO_TOKEN, recipients[i], TGE))
});
vm.stopBroadcast();
console2.log("Deployed!\n");
Expand Down

0 comments on commit 2807d08

Please sign in to comment.