---
# System prepended metadata

title: Thriftbox contract documentation
tags: [azur-mayors]

---

---
tags: azur-mayors
---
# Thriftbox contract documentation

## Data structures
### ThriftboxConfig
``` solidity
struct ThriftboxConfig {
    address votesAddress;
}
```
### Earning
``` solidity
struct Earning {
    address player;
    uint256 amount;
}
```


## Events
### ConfigUpdated
``` solidity
event ConfigUpdated();
```
### VotesWithdrawnByPlayer
``` solidity
event VotesWithdrawnByPlayer(
    address player,
    uint256 lastWithdraw,
    uint256 amount
);
```
### VotesDepositedByPlayer
``` solidity
event VotesDepositedByPlayer(
    address player,
    uint256 amount
);
```
### VotesDepositedTotal
``` solidity
event VotesDepositedTotal(
    uint256 totalAmount
);
```


## Get functions

### balanceOf
Returns the number of Votes by user.
``` solidity
function balanceOf(
    address player
) external view returns (uint256 votesAmount);
```

### getWithdrawalDate
Returns the date of the last withdrawal by user.
``` solidity
function getWithdrawalDate(
    address player
) external view returns (uint256 withdrawalDate);
```


## Set functions

### [OWNER] depositList
Deposits users' earnings in Votes to the thriftbox.
Requires an allowance for Votes transfer
Emits `VotesDepositedByPlayer` event.
Emits `VotesDepositedTotal` event.
``` solidity
function depositList(
    Earning[] calldata earnings
) external;
```

### withdraw
Users can withdraw accumulated Votes to them wallets. There must be minimum 7 days between two withdrawals.
Emits `VotesWithdrawnByPlayer` event.
``` solidity
function withdraw() external;
```
