Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
99532fd1
Unverified
Commit
99532fd1
authored
Feb 04, 2022
by
Conner Fromknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add minDepositAmount to TeleportrDeposit.sol
parent
60a04f3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
TeleportrDeposit.sol
...ges/contracts/contracts/L1/teleportr/TeleportrDeposit.sol
+18
-4
No files found.
packages/contracts/contracts/L1/teleportr/TeleportrDeposit.sol
View file @
99532fd1
...
...
@@ -9,11 +9,13 @@ pragma solidity >=0.8.9;
*/
contract TeleportrDeposit {
address public owner;
uint256 public minDepositAmount;
uint256 public maxDepositAmount;
uint256 public maxBalance;
// Events
event OwnerSet(address indexed oldOwner, address indexed newOwner);
event MinDepositAmountSet(uint256 previousAmount, uint256 newAmount);
event MaxDepositAmountSet(uint256 previousAmount, uint256 newAmount);
event MaxBalanceSet(uint256 previousBalance, uint256 newBalance);
event BalanceWithdrawn(address indexed owner, uint256 balance);
...
...
@@ -25,19 +27,26 @@ contract TeleportrDeposit {
_;
}
constructor(uint256 _maxDepositAmount, uint256 _maxBalance) {
constructor(
uint256 _minDepositAmount,
uint256 _maxDepositAmount,
uint256 _maxBalance
) {
owner = msg.sender;
minDepositAmount = _minDepositAmount;
maxDepositAmount = _maxDepositAmount;
maxBalance = _maxBalance;
emit OwnerSet(address(0), msg.sender);
emit MinDepositAmountSet(0, _minDepositAmount);
emit MaxDepositAmountSet(0, _maxDepositAmount);
emit MaxBalanceSet(0, _maxBalance);
}
// Receive function which reverts if the amount is
greater than
//
maxDepositAmount, or the amount would put the contract over its
// maxBalance.
// Receive function which reverts if the amount is
outside the range
//
[minDepositAmount, maxDepositAmount], or the amount would put the
//
contract over its
maxBalance.
receive() external payable {
require(msg.value >= minDepositAmount, "Deposit amount is too small");
require(msg.value <= maxDepositAmount, "Deposit amount is too big");
require(address(this).balance <= maxBalance, "Contract max balance exceeded");
...
...
@@ -52,6 +61,11 @@ contract TeleportrDeposit {
}
// Setters
function setMinAmount(uint256 _minDepositAmount) external isOwner {
emit MinDepositAmountSet(minDepositAmount, _minDepositAmount);
minDepositAmount = _minDepositAmount;
}
function setMaxAmount(uint256 _maxDepositAmount) external isOwner {
emit MaxDepositAmountSet(maxDepositAmount, _maxDepositAmount);
maxDepositAmount = _maxDepositAmount;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment