Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8cc7f1e
added id ranges to nftGating logic
0xCooki Apr 18, 2023
5a94ab8
idRanges clean up
0xCooki Apr 21, 2023
bed3649
delete punk support
0xCooki Apr 21, 2023
c59276d
comments fix
0xCooki Apr 21, 2023
a2a9b90
comments fix
0xCooki Apr 21, 2023
b1a75db
added rangeAmount support
0xCooki Apr 23, 2023
f9216bd
more tests
0xCooki Apr 23, 2023
773adb3
more tests
0xCooki Apr 23, 2023
f0b54ad
small fixes
0xCooki Apr 23, 2023
ff77154
removed array complexity
0xCooki Apr 24, 2023
e304aed
small fixes
0xCooki Apr 24, 2023
13b3043
removed rangeAmounts
0xCooki Apr 25, 2023
2f095a8
Merge branch 'dev' into pr/150
May 2, 2023
5bb447c
Merge pull request #150 from CookedCookee/bounty#141
May 2, 2023
533182b
solidity version updated
May 2, 2023
d0659fc
Merge pull request #162 from AelinXYZ/solidity-0.8.19
May 2, 2023
a4da31f
new Aelin token + swap contract
May 8, 2023
5c53cab
depositTokens() only once
May 8, 2023
0195fa2
Merge pull request #168 from AelinXYZ/new-aelin-token
May 9, 2023
2d6ddf3
Merge branch 'dev' into release/naur
May 15, 2023
c6c382a
Merge branch 'dev' into release/naur
May 15, 2023
a0247f7
clean up ok
May 15, 2023
819c455
Update package.json
May 15, 2023
d6b84f2
Merge pull request #171 from AelinXYZ/solhint-cleanup
May 15, 2023
02ee234
fixes and tests
0xCooki Jun 1, 2023
baccad5
changed bool name
0xCooki Jun 2, 2023
2f2e44e
Merge pull request #175 from CookedCookee/minor-audit-issues
Jun 2, 2023
4d73f36
audit fixes
Jun 4, 2023
a53b884
Merge branch 'naur-audit-fix' of https://github.com/AelinXYZ/aelin in…
Jun 5, 2023
d77c640
Merge pull request #176 from AelinXYZ/naur-audit-fix
Jun 21, 2023
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
2 changes: 1 addition & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules/
**/contracts/generated
**/contracts/routers
**/typechain-types
contracts/deprecated
contracts.old/
11 changes: 3 additions & 8 deletions contracts.old/IMerkleDistributor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

// Allows anyone to claim a token if they exist in a merkle root.
interface IMerkleDistributor {
Expand All @@ -13,12 +13,7 @@ interface IMerkleDistributor {
function isClaimed(uint256 index) external view returns (bool);

// Claim the given amount of the token to the given address. Reverts if the inputs are invalid.
function claim(
uint256 index,
address account,
uint256 amount,
bytes32[] calldata merkleProof
) external;
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;

// This event is triggered whenever a call to #claim succeeds.
event Claimed(uint256 index, address account, uint256 amount);
Expand Down
47 changes: 33 additions & 14 deletions contracts.old/MerkleDistributor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "./IMerkleDistributor.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
Expand All @@ -15,7 +15,11 @@ contract MerkleDistributor is Owned, Pausable, IMerkleDistributor {
// This is a packed array of booleans.
mapping(uint256 => uint256) private claimedBitMap;

constructor(address owner_, address token_, bytes32 merkleRoot_) Owned(owner_) Pausable() {
constructor(
address owner_,
address token_,
bytes32 merkleRoot_
) Owned(owner_) Pausable() {
token = token_;
merkleRoot = merkleRoot_;
startTime = block.timestamp;
Expand All @@ -32,30 +36,45 @@ contract MerkleDistributor is Owned, Pausable, IMerkleDistributor {
function _setClaimed(uint256 index) private {
uint256 claimedWordIndex = index / 256;
uint256 claimedBitIndex = index % 256;
claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);
claimedBitMap[claimedWordIndex] =
claimedBitMap[claimedWordIndex] |
(1 << claimedBitIndex);
}

function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override {
function claim(
uint256 index,
address account,
uint256 amount,
bytes32[] calldata merkleProof
) external override {
require(!isClaimed(index), "MerkleDistributor: Drop already claimed.");

// Verify the merkle proof.
bytes32 node = keccak256(bytes.concat(keccak256(abi.encode(index, account, amount))));
bytes32 node = keccak256(
bytes.concat(keccak256(abi.encode(index, account, amount)))
);

require(MerkleProof.verify(merkleProof, merkleRoot, node), "MerkleDistributor: Invalid proof.");
require(
MerkleProof.verify(merkleProof, merkleRoot, node),
"MerkleDistributor: Invalid proof."
);

// Mark it claimed and send the token.
_setClaimed(index);
require(IERC20(token).transfer(account, amount), "MerkleDistributor: Transfer failed.");
require(
IERC20(token).transfer(account, amount),
"MerkleDistributor: Transfer failed."
);

emit Claimed(index, account, amount);
}

function _selfDestruct(address payable beneficiary) external onlyOwner {
// only callable a year after end time
require(block.timestamp > (startTime + 365 days), "Contract can only be selfdestruct after a year");
// function _selfDestruct(address payable beneficiary) external onlyOwner {
// // only callable a year after end time
// require(block.timestamp > (startTime + 365 days), "Contract can only be selfdestruct after a year");

IERC20(token).transfer(beneficiary, IERC20(token).balanceOf(address(this)));
// IERC20(token).transfer(beneficiary, IERC20(token).balanceOf(address(this)));

selfdestruct(beneficiary);
}
// selfdestruct(beneficiary);
// }
}
2 changes: 1 addition & 1 deletion contracts.old/OptimismTreasury.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

// Inheritance
import "./Owned.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts.old/Owned.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
Expand Down
2 changes: 1 addition & 1 deletion contracts.old/Pausable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

// Inheritance
import "./Owned.sol";
Expand Down
14 changes: 7 additions & 7 deletions contracts.old/VAelinConverter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

import "./Owned.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
Expand Down Expand Up @@ -34,14 +34,14 @@ contract VAelinConverter is Owned {
emit Converted(msg.sender, aelinAmount);
}

function _selfDestruct(address payable beneficiary) external onlyOwner {
//only callable a year after end time
require(block.timestamp > (startTime + 365 days), "Contract can only be selfdestruct after a year");
// function _selfDestruct(address payable beneficiary) external onlyOwner {
// //only callable a year after end time
// require(block.timestamp > (startTime + 365 days), "Contract can only be selfdestruct after a year");

IERC20(AELIN).transfer(beneficiary, IERC20(AELIN).balanceOf(address(this)));
// IERC20(AELIN).transfer(beneficiary, IERC20(AELIN).balanceOf(address(this)));

selfdestruct(beneficiary);
}
// selfdestruct(beneficiary);
// }

event Converted(address sender, uint256 aelinReceived);
}
2 changes: 1 addition & 1 deletion contracts.old/VirtualAelinToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

Expand Down
36 changes: 36 additions & 0 deletions contracts/Aelin.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

error UnauthorizedMinter();
error InvalidAddress();

contract Aelin is ERC20, Ownable {
// Initial supply set to 10M tokens as stated in AELIP-50
uint256 public constant INITIAL_SUPPLY = 10 * 1e6 * 1e18;

address public authorizedMinter;

constructor(address _initialHolder) ERC20("Aelin", "AELIN") {
_mint(_initialHolder, INITIAL_SUPPLY);
}

function mint(address _receiver, uint256 _amount) external {
if (msg.sender != authorizedMinter) revert UnauthorizedMinter();
_mint(_receiver, _amount);
}

function burn(uint256 _amount) external {
_burn(msg.sender, _amount);
}

function setAuthorizedMinter(address _minter) external onlyOwner {
if (_minter == address(0)) revert InvalidAddress();
authorizedMinter = _minter;
emit MinterAuthorized(_minter);
}

event MinterAuthorized(address indexed minter);
}
18 changes: 6 additions & 12 deletions contracts/AelinDeal.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

import "./AelinVestingToken.sol";
import "./interfaces/IAelinDeal.sol";
import "./MinimalProxyFactory.sol";
import "./AelinFeeEscrow.sol";
import {AelinFeeEscrow} from "./AelinFeeEscrow.sol";
import {AelinVestingToken} from "./AelinVestingToken.sol";
import {MinimalProxyFactory} from "./MinimalProxyFactory.sol";
import {IAelinDeal} from "./interfaces/IAelinDeal.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract AelinDeal is AelinVestingToken, MinimalProxyFactory, IAelinDeal {
using SafeERC20 for IERC20;
Expand Down Expand Up @@ -36,13 +37,6 @@ contract AelinDeal is AelinVestingToken, MinimalProxyFactory, IAelinDeal {
Timeline public openRedemption;
Timeline public proRataRedemption;

/**
* @dev the constructor will always be blank due to the MinimalProxyFactory pattern
* this allows the underlying logic of this contract to only be deployed once
* and each new deal created is simply a storage wrapper
*/
constructor() {}

/**
* @dev the initialize method replaces the constructor setup and can only be called once
* NOTE the deal tokens wrapping the underlying are always 18 decimals
Expand Down
33 changes: 14 additions & 19 deletions contracts/AelinERC20.sol
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

import {ERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

interface IERC20Decimals {
function decimals() external view returns (uint8);
}
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

/**
* @dev a standard ERC20 contract that is extended with a few methods
* described in detail below
*/
contract AelinERC20 is ERC20, ReentrancyGuard {
bool setInfo;
contract AelinERC20 is ERC20 {
bool private setInfo;
/**
* @dev Due to the constructor being empty for the MinimalProxy architecture we need
* to set the name and symbol in the initializer which requires these custom variables
*/
string private _custom_name;
string private _custom_symbol;
uint8 private _custom_decimals;
bool private locked;
string private customName;
string private customSymbol;
uint8 private customDecimals;

uint8 constant DEAL_TOKEN_DECIMALS = 18;

constructor() ERC20("", "") {}
Expand All @@ -37,25 +32,25 @@ contract AelinERC20 is ERC20, ReentrancyGuard {
* custom logic for name(), symbol(), decimals(), and _setNameSymbolAndDecimals()
*/
function name() public view virtual override returns (string memory) {
return _custom_name;
return customName;
}

function symbol() public view virtual override returns (string memory) {
return _custom_symbol;
return customSymbol;
}

function decimals() public view virtual override returns (uint8) {
return _custom_decimals;
return customDecimals;
}

function _setNameSymbolAndDecimals(
string memory _name,
string memory _symbol,
uint8 _decimals
) internal initInfoOnce returns (bool) {
_custom_name = _name;
_custom_symbol = _symbol;
_custom_decimals = _decimals;
customName = _name;
customSymbol = _symbol;
customDecimals = _decimals;
setInfo = true;
emit AelinToken(_name, _symbol, _decimals);
return true;
Expand Down
21 changes: 11 additions & 10 deletions contracts/AelinERC721.sol
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

import {IAelinERC721} from "./interfaces/IAelinERC721.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract AelinERC721 is ERC721, ReentrancyGuard, IAelinERC721 {
contract AelinERC721 is ERC721, ReentrancyGuard {
/**
* @dev Due to the constructor being empty for the MinimalProxy architecture we need
* to set the name and symbol in the initializer which requires these custom variables
*/
string private _custom_name;
string private _custom_symbol;
string private customName;
string private customSymbol;

bool infoSet;
bool private infoSet;

constructor() ERC721("", "") {}

event SetAelinERC721(string name, string symbol);

modifier initInfoOnce() {
require(!infoSet, "can only initialize once");
_;
Expand All @@ -28,16 +29,16 @@ contract AelinERC721 is ERC721, ReentrancyGuard, IAelinERC721 {
* custom logic for name(), symbol(), and _setNameAndSymbol()
*/
function name() public view virtual override returns (string memory) {
return _custom_name;
return customName;
}

function symbol() public view virtual override returns (string memory) {
return _custom_symbol;
return customSymbol;
}

function _setNameAndSymbol(string memory _name, string memory _symbol) internal initInfoOnce returns (bool) {
_custom_name = _name;
_custom_symbol = _symbol;
customName = _name;
customSymbol = _symbol;
infoSet = true;
emit SetAelinERC721(_name, _symbol);
return true;
Expand Down
16 changes: 4 additions & 12 deletions contracts/AelinFeeEscrow.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
pragma solidity 0.8.19;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract AelinFeeEscrow {
using SafeERC20 for IERC20;

uint256 constant VESTING_PERIOD = 0 days;
uint256 constant DELAY_PERIOD = 90 days;
uint256 public constant VESTING_PERIOD = 0 days;
uint256 public constant DELAY_PERIOD = 90 days;

uint256 public vestingExpiry;
address public treasury;
Expand All @@ -17,13 +16,6 @@ contract AelinFeeEscrow {

bool private calledInitialize;

/**
* @dev the constructor will always be blank due to the MinimalProxyFactory pattern
* this allows the underlying logic of this contract to only be deployed once
* and each new escrow created is simply a storage wrapper
*/
constructor() {}

function initialize(address _treasury, address _escrowedToken) external initOnce {
treasury = _treasury;
vestingExpiry = block.timestamp + VESTING_PERIOD;
Expand Down
Loading