Skip to content

Commit

Permalink
Merge pull request #2 from agentcoinorg/nerfzael/forge-fmt
Browse files Browse the repository at this point in the history
Formatting fixes
  • Loading branch information
dOrgJelli authored Nov 4, 2024
2 parents 7cee65d + fe73eb6 commit 041a508
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 302 deletions.
14 changes: 6 additions & 8 deletions script/DeployAgentKey.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ contract DeployAgentKey is Script {
deploy(helper.getConfig());
}

function deploy(
HelperConfig.AgentKeyConfig memory config
) public returns (IAgentKey key, address whitelist) {
function deploy(HelperConfig.AgentKeyConfig memory config) public returns (IAgentKey key, address whitelist) {
{
bytes memory ctorArgs = abi.encode(
0 ether, // initReserve
Expand All @@ -31,17 +29,17 @@ contract DeployAgentKey is Script {
payable(address(0)), // setupFeeRecipient
config.name,
config.symbol
);
);

vm.startBroadcast();

key = IAgentKey(deployCode("AgentKey.sol:AgentKey", ctorArgs));
}

whitelist = address(new AgentKeyWhitelist());

key.updateConfig(
whitelist,
whitelist,
config.beneficiary,
config.control,
config.feeCollector,
Expand Down
6 changes: 3 additions & 3 deletions script/HelperConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ contract HelperConfig is Constants, Script {
string symbol;
uint256 priceIncrease;
uint256 investmentReserveBasisPoints;
uint feeBasisPoints;
uint revenueCommitmentBasisPoints;
uint256 feeBasisPoints;
uint256 revenueCommitmentBasisPoints;
address payable beneficiary;
address control;
address payable feeCollector;
Expand Down Expand Up @@ -62,4 +62,4 @@ contract HelperConfig is Constants, Script {
revenueCommitmentBasisPoints: 9500
});
}
}
}
24 changes: 11 additions & 13 deletions src/AgentKey.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ contract AgentKey is DecentralizedAutonomousTrust {
bool public isStopped;

constructor(
uint _initReserve,
uint256 _initReserve,
address _currencyAddress,
uint _initGoal,
uint _buySlopeNum,
uint _buySlopeDen,
uint _investmentReserveBasisPoints,
uint _setupFee,
uint256 _initGoal,
uint256 _buySlopeNum,
uint256 _buySlopeDen,
uint256 _investmentReserveBasisPoints,
uint256 _setupFee,
address payable _setupFeeRecipient,
string memory _name,
string memory _symbol
Expand All @@ -29,7 +29,7 @@ contract AgentKey is DecentralizedAutonomousTrust {
_setupFee,
_setupFeeRecipient,
_name,
_symbol
_symbol
);
}

Expand All @@ -42,15 +42,13 @@ contract AgentKey is DecentralizedAutonomousTrust {
modifier authorizeTransfer(
address _from,
address _to,
uint _value,
bool _isSell
) // Overrides the modifier in ContinuousOffering
{
uint256 _value,
bool _isSell // Overrides the modifier in ContinuousOffering
) {
if (isStopped) {
revert("Contract is stopped");
}
if(address(whitelist) != address(0))
{
if (address(whitelist) != address(0)) {
// This is not set for the minting of initialReserve
whitelist.authorizeTransfer(_from, _to, _value, _isSell);
}
Expand Down
14 changes: 3 additions & 11 deletions src/AgentKeyWhitelist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
pragma solidity ^0.8.13;

contract AgentKeyWhitelist {
function authorizeTransfer(
address _from,
address _to,
uint,
bool
) external pure {
require(
_from == address(0) || _to == address(0),
"TRANSFERS_DISABLED"
);
function authorizeTransfer(address _from, address _to, uint256, bool) external pure {
require(_from == address(0) || _to == address(0), "TRANSFERS_DISABLED");
}
}
}
32 changes: 10 additions & 22 deletions src/IAgentKey.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,28 @@ pragma solidity ^0.8.13;

interface IAgentKey {
function approve(address spender, uint256 amount) external returns (bool);
function buy(
address _to,
uint256 _currencyValue,
uint256 _minTokensBought
) external payable;
function sell(
address payable _to,
uint _quantityToSell,
uint _minCurrencyReturned
) external;
function estimateBuyValue(
uint256 _currencyValue
) external view returns (uint256);
function estimateSellValue(
uint _quantityToSell
) external view returns(uint256);
function buy(address _to, uint256 _currencyValue, uint256 _minTokensBought) external payable;
function sell(address payable _to, uint256 _quantityToSell, uint256 _minCurrencyReturned) external;
function estimateBuyValue(uint256 _currencyValue) external view returns (uint256);
function estimateSellValue(uint256 _quantityToSell) external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
function state() external view returns (uint256);
function updateConfig(
address _whitelistAddress,
address payable _beneficiary,
address _control,
address payable _feeCollector,
uint _feeBasisPoints,
uint _revenueCommitmentBasisPoints,
uint _minInvestment,
uint _minDuration
uint256 _feeBasisPoints,
uint256 _revenueCommitmentBasisPoints,
uint256 _minInvestment,
uint256 _minDuration
) external;
function pay(uint _currencyValue) external payable;
function pay(uint256 _currencyValue) external payable;
function totalSupply() external view returns (uint256);
function buybackReserve() external view returns (uint256);
function feeBasisPoints() external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function close() external;
function stopAndTransferReserve(address payable _recipient) external;
function isStopped() external view returns (bool);
}
}
Loading

0 comments on commit 041a508

Please sign in to comment.