Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Improvement Proposals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Swipe issues imprevement proposals, which are listed here.
## Proposals
- [SIP-1](https://github.com/SwipeWallet/Swipe-Network/tree/master/Improvement%20Proposals/SIP-1)
- [SIP-2](https://github.com/SwipeWallet/Swipe-Network/tree/master/Improvement%20Proposals/SIP-2)
- [SIP-3](https://github.com/SwipeWallet/Swipe-Network/tree/master/Improvement%20Proposals/SIP-3)
6 changes: 3 additions & 3 deletions Improvement Proposals/SIP-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ calldata - 1800, 400000000000000000000, 604800 // a week
```

## Changes
- [StakingV2.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingV2.sol)
- [StakingStorageV2.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingStorageV3.sol)
- [StakingEventV2.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingEventV2.sol)
- [StakingV2.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingV2.sol)
- [StakingStorageV2.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingStorageV3.sol)
- [StakingEventV2.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingEventV2.sol)

## Tests
- [SIP-1.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/test/SIP-1.js)
Expand Down
6 changes: 3 additions & 3 deletions Improvement Proposals/SIP-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ calldata - 11520 // 2 days
```

## Changes
- [StakingV3.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingV3.sol)
- [StakingStorageV3.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingStorageV3.sol)
- [StakingEventV3.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingEventV3.sol)
- [StakingV3.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingV3.sol)
- [StakingStorageV3.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingStorageV3.sol)
- [StakingEventV3.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/staking/StakingEventV3.sol)

## Tests
- [SIP-2.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/test/SIP-2.js)
Expand Down
97 changes: 97 additions & 0 deletions Improvement Proposals/SIP-3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# SIP-3

## Description

This proposal is to add swipe card list into swipe cards contract.
- Transfer swipe cards contract's ownership and guardianship to governance timelock contract
- Register 4 swipe cards, Swipe Saffron, Swipe Sky, Swipe Steel, Swipe Slate

## Proposal

### Mainnet
```
Action1
address - Swipe Cards Proxy contract address
value - 0
signature - assumeOwnership()
calldata - void

Action2:
address - Swipe Cards Proxy contract address
value - 0
signature - assumeGuardianship()
calldata - void

Action3:
address - Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Saffron, 0, 0, 0, 0

Action4:
address - Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Sky, 300000000000000000000, 15552000, 0, 0

Action5:
address - Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Steel, 3000000000000000000000, 15552000, 0, 0

Action6:
address - Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Slate, 30000000000000000000000, 15552000, 0, 0
```

### Ropsten
```
Action1
address - 0xB23Fa86E875F4276D672f600b1Fe51B24A296c1b // Swipe Cards Proxy contract address
value - 0
signature - assumeOwnership()
calldata - void

Action2:
address - 0xB23Fa86E875F4276D672f600b1Fe51B24A296c1b // Swipe Cards Proxy contract address
value - 0
signature - assumeGuardianship()
calldata - void

Action3:
address - 0xB23Fa86E875F4276D672f600b1Fe51B24A296c1b // Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Saffron, 0, 0, 0, 0

Action4:
address - 0xB23Fa86E875F4276D672f600b1Fe51B24A296c1b // Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Sky, 300000000000000000000, 15552000, 0, 0

Action5:
address - 0xB23Fa86E875F4276D672f600b1Fe51B24A296c1b // Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Steel, 3000000000000000000000, 15552000, 0, 0

Action6:
address - 0xB23Fa86E875F4276D672f600b1Fe51B24A296c1b // Swipe Cards Proxy contract address
value - 0
signature - registerCard(string,uint256,uint256,string,string)
calldata - Swipe Slate, 30000000000000000000000, 15552000, 0, 0
```

## Changes
- [SwipeCardsProxy.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/card/SwipeCardsProxy.sol)
- [SwipeCards.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/card/SwipeCards.sol)
- [SwipeCardsStorage.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/card/SwipeCardsStorage.sol)
- [SwipeCardsEvent.sol](https://github.com/SwipeWallet/Swipe-Network/blob/master/contracts/card/SwipeCardsEvent.sol)

## Tests
- [SIP-3.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/test/SIP-3.js)
- [SwipeCardsTest.js](https://github.com/SwipeWallet/Swipe-Network/blob/master/test/SwipeCardsTest.js)
1 change: 1 addition & 0 deletions Improvement Proposals/SIP-3/SIP-3.js
1 change: 1 addition & 0 deletions Improvement Proposals/SIP-3/SwipeCards.sol
1 change: 1 addition & 0 deletions Improvement Proposals/SIP-3/SwipeCardsEvent.sol
1 change: 1 addition & 0 deletions Improvement Proposals/SIP-3/SwipeCardsProxy.sol
1 change: 1 addition & 0 deletions Improvement Proposals/SIP-3/SwipeCardsStorage.sol
1 change: 1 addition & 0 deletions Improvement Proposals/SIP-3/SwipeCardsTest.js
39 changes: 39 additions & 0 deletions contracts/card/SwipeCards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ contract SwipeCards is NamedContract, SwipeCardsStorage, SwipeCardsEvent {
string calldata fee,
string calldata feeSplitPercentage
) external returns (uint256) {
require(
_cardCount < uint256(-1),
"Card count exceeds maximum"
);
require(
bytes(cardName).length > 0,
"Invalid card name"
Expand Down Expand Up @@ -122,6 +126,41 @@ contract SwipeCards is NamedContract, SwipeCardsStorage, SwipeCardsEvent {
return newCard.cardId;
}

/// @notice Unregisters a existing card
/// @dev Removes a card that card id is the provided id, and rearrange card list with new id
function unregisterCard(
uint256 cardId
) external {
require(
cardId > 0,
"Invalid card id"
);
require(
_cardCount >= cardId && bytes(_cards[cardId].cardName).length > 0,
"Not found card"
);

require(
msg.sender == _guardian,
"Only the guardian can register new card"
);

Card memory unregisteredCard = _cards[cardId];

for (; cardId < _cardCount; cardId++) {
Card storage card = _cards[cardId + 1];
card.cardId = cardId;
_cards[cardId] = card;
}

delete _cards[_cardCount--];

emit CardUnregistration(
unregisteredCard.cardId,
unregisteredCard.cardName
);
}

/// @notice Updates card
/// @dev Updates the card with the provided configurations
function setCard(
Expand Down
5 changes: 5 additions & 0 deletions contracts/card/SwipeCardsEvent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ contract SwipeCardsEvent {
string feeSplitPercentage
);

event CardUnregistration(
uint256 indexed cardId,
string cardName
);

event CardUpdate(
uint256 indexed cardId,
string cardName,
Expand Down
Loading