-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59f5298
commit 2ee1b3f
Showing
6 changed files
with
462 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
contracts/debt-repayer-base-andromeda/src/lib/IAccountProxy.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.21; | ||
|
||
interface IAccountProxy { | ||
error ImplementationIsSterile(address implementation); | ||
error NoChange(); | ||
error NotAContract(address contr); | ||
error NotNominated(address addr); | ||
error Unauthorized(address addr); | ||
error UpgradeSimulationFailed(); | ||
error ZeroAddress(); | ||
|
||
event OwnerChanged(address oldOwner, address newOwner); | ||
event OwnerNominated(address newOwner); | ||
event Upgraded(address indexed self, address implementation); | ||
|
||
function acceptOwnership() external; | ||
function getImplementation() external view returns (address); | ||
function nominateNewOwner(address newNominatedOwner) external; | ||
function nominatedOwner() external view returns (address); | ||
function owner() external view returns (address); | ||
function renounceNomination() external; | ||
function simulateUpgradeTo(address newImplementation) external; | ||
function upgradeTo(address newImplementation) external; | ||
|
||
error AlreadyInitialized(); | ||
error CannotSelfApprove(address addr); | ||
error IndexOverrun(uint256 requestedIndex, uint256 length); | ||
error InvalidOwner(address addr); | ||
error InvalidParameter(string parameter, string reason); | ||
error InvalidTransferRecipient(address addr); | ||
error OverflowUint256ToUint128(); | ||
error TokenAlreadyMinted(uint256 id); | ||
error TokenDoesNotExist(uint256 id); | ||
|
||
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); | ||
event ApprovalForAll(address indexed owner, address indexed operator, bool approved); | ||
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); | ||
|
||
function approve(address to, uint256 tokenId) external; | ||
function balanceOf(address holder) external view returns (uint256 balance); | ||
function burn(uint256 tokenId) external; | ||
function getApproved(uint256 tokenId) external view returns (address operator); | ||
function initialize(string memory tokenName, string memory tokenSymbol, string memory uri) external; | ||
function isApprovedForAll(address holder, address operator) external view returns (bool); | ||
function isInitialized() external view returns (bool); | ||
function mint(address to, uint256 tokenId) external; | ||
function name() external view returns (string memory); | ||
function ownerOf(uint256 tokenId) external view returns (address); | ||
function safeMint(address to, uint256 tokenId, bytes memory data) external; | ||
function safeTransferFrom(address from, address to, uint256 tokenId) external; | ||
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) external; | ||
function setAllowance(uint256 tokenId, address spender) external; | ||
function setApprovalForAll(address operator, bool approved) external; | ||
function setBaseTokenURI(string memory uri) external; | ||
function supportsInterface(bytes4 interfaceId) external view returns (bool); | ||
function symbol() external view returns (string memory); | ||
function tokenByIndex(uint256 index) external view returns (uint256); | ||
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); | ||
function tokenURI(uint256 tokenId) external view returns (string memory); | ||
function totalSupply() external view returns (uint256); | ||
function transferFrom(address from, address to, uint256 tokenId) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity >=0.8.0; | ||
|
||
import "forge-std/src/Test.sol"; | ||
|
||
contract BaseTest is Test { | ||
uint256 private seed; | ||
|
||
function generateAddress(string memory _name, bool _isContract) | ||
internal | ||
returns (address) | ||
{ | ||
return generateAddress(_name, _isContract, 0); | ||
} | ||
|
||
function generateAddress(string memory _name, bool _isContract, uint256 _ethBalance) | ||
internal | ||
returns (address newAddress_) | ||
{ | ||
seed++; | ||
newAddress_ = vm.addr(seed); | ||
|
||
vm.label(newAddress_, _name); | ||
|
||
if (_isContract) { | ||
vm.etch(newAddress_, "Generated Contract Address"); | ||
} | ||
|
||
vm.deal(newAddress_, _ethBalance); | ||
|
||
return newAddress_; | ||
} | ||
|
||
function assertEqTolerance( | ||
uint256 a, | ||
uint256 b, | ||
uint256 tolerancePercentage //4 decimals | ||
) internal { | ||
uint256 diff = b > a ? b - a : a - b; | ||
uint256 maxForgivness = (b * tolerancePercentage) / 100_000; | ||
|
||
if (maxForgivness < diff) { | ||
emit log("Error: a == b not satisfied [with tolerance]"); | ||
emit log_named_uint(" A", a); | ||
emit log_named_uint(" B", b); | ||
emit log_named_uint(" Max tolerance", maxForgivness); | ||
emit log_named_uint(" Actual Difference", diff); | ||
fail(); | ||
} | ||
} | ||
|
||
// Makes expecting a function to not be called more explicit instead of calling same function and passing 0 in count | ||
function expectNoCall(address target, bytes memory data) internal { | ||
vm.expectCall(target, data, 0); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
contracts/debt-repayer-base-andromeda/test/DebtRepayerTest.sol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.