Skip to content

Commit

Permalink
Merge branch 'main' of other.github.com:waves-exchange/contracts into…
Browse files Browse the repository at this point in the history
… neo-vesting
  • Loading branch information
bra1nsurfer committed Nov 7, 2024
2 parents 2f7bf02 + 7f8beb8 commit cd33a7a
Show file tree
Hide file tree
Showing 61 changed files with 5,172 additions and 408 deletions.
101 changes: 101 additions & 0 deletions docs/l2mp_leasing/l2mp_leasing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# L2MP Leasing

## Keys
| key | type | value | description |
| :------------------------------------- | --------: | :--------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------- |
| `%s__{nodeAddress}` | `String` | `'%d%d%d%d__{currentPeriodHeight}__{currentLeasingAmount}__{nextPeriodHeight}__{nextLeasingAmount}'` | `nodeAddress` total leasing data |
| `%s%s__{nodeAddress}__{userAddress}` | `String` | `'%d%d%d%d__{currentPeriodHeight}__{currentLeasingAmount}__{nextPeriodHeight}__{nextLeasingAmount}'` | `userAddress` leasing data for `nodeAddress` |
| `%s%s__toClaim__{userAddress}` | `String` | `'%d%d%d%d__{currentPeriodHeight}__{unlockedAmount}__{nextPeriodHeight}__{lockedAmount}'` | `userAddress` claim and unlock balances. `lockedAmount` is locked until `nextPeriodHeight`. `unlockedAmount` currently available for claim |
| `%s%s__userTotalLocked__{userAddress}` | `Integer` | `1012345678` | `userAddress` total leased |
| `%s__assetId` | `String` | `'ABCD...'` | Leasing `AssetId` |
| `%s__periodLength` | `Integer` | `10000` | Period length in blocks (Default: 10000) |
| `%s__offsetHeight` | `Integer` | `1234567` | First period height |
| `%s__adminAddressList` | `String` | `'{address1}__{address2}__...'` | List of Admin Addresses |
| `%s__forceStop` | `Boolean` | `false` | Force stop contract flag |

# Functions

## User Claim Data READONLY
```
# User data
# Return tuple:
# _1 = current period start height
# _2 = current period available to claim
# _3 = next period start height
# _4 = next period available to claim
# _5 = total leased amount
# _6 = current height
@Callable(i)
func getUserDataREADONLY(userAddress: String)
```


## Node Leasing Data READONLY
```
# Node leasing data
# Return tuple:
# _1 = current period start height
# _2 = current period leased amount
# _3 = next period start height
# _4 = next period leased amount
# _5 = current height
@Callable(i)
func getNodeDataREADONLY(nodeAddress: String)
```

## User Leasing to Node Data READONLY
```
# Node leasing data
# Return tuple:
# _1 = current period start height
# _2 = current period leased amount
# _3 = next period start height
# _4 = next period leased amount
# _5 = current height
@Callable(i)
func getUserLeasingDataREADONLY(nodeAddress: String, userAddress: String)
```

## Lease
- Require 1 payment in `assetId`
```
@Callable(i)
func lease(nodeAddress: String)
```


## Lease by Address
- Require 1 payment in `assetId`
```
@Callable(i)
func leaseByAddress(nodeAddress: String, userAddress: String)
```


## Lease from locked
- `amount` should be less or equal (`unlockedAmount` + `lockedAmount` + `paymentAmount`)
```
@Callable(i)
func leaseFromLocked(nodeAddress: String, amount: Int)
```


## Cancel lease
```
@Callable(i)
func cancelLease(nodeAddress: String, amount: Int)
```


## Claim unlocked
```
@Callable(i)
func claimAll()
```


## Claim from unlocked amount
```
@Callable(i)
func claim(amount: Int)
```
35 changes: 35 additions & 0 deletions docs/l2mp_swap/l2mp_swap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# L2MP Swap

## Keys
| key | type | value |
| :----------------------------------- | --------: | :-------------------------------------------------------------- |
| `%s__stakingAddress` | `String` | `'3PAbc...'` |
| `%s__assetInId` | `String` | `'ABC...'` |
| `%s__assetOutId` | `String` | `'ABC...'` |
| `%s__assetOutPrice` | `Integer` | `1000000` |
| `%s%s__stats__totalIn` | `Integer` | `123456` |
| `%s%s__stats__totalOut` | `Integer` | `12345678` |
| `%s%s%s__stats__totalIn__{address}` | `Integer` | `12345` |
| `%s%s%s__stats__totalOut__{address}` | `Integer` | `1234567` |
| `%s%s%s__history__{address}__{txId}` | `String` | `'%d%d%b%s__{AmountIn}__{amountOut}__{isStake}__{nodeAddress}'` |

# Functions

## Swap
- Should be with 1 payment in XTN
```
@Callable(i)
func swap()
```

## Swap and Stake
- Should be with 1 payment in XTN

Arguments:
- `stakingNode` - base58 string of staking node address

_Note: If `stakingNode` is equal to empty string (`""`) it swaps without staking_
```
@Callable(i)
func swapAndStake(stakingNode: String)
```
38 changes: 38 additions & 0 deletions migrations/2024_02_05_l2mp_new_swap/01_l2mp_new_swap_data_tx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"type": 12,
"fee": 500000,
"version": 2,
"senderPublicKey": "EfRKQWb1FWaWmo9fkorRwMA4BrSzUWNAVhXqB9vLmv7g",
"data": [
{
"key": "%s__assetInId",
"type": "string",
"value": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
},
{
"key": "%s__assetOutId",
"type": "string",
"value": "7scqyYoVsNrpWbTAc78eRqNVcYLxMPzZs8EQfX7ruJAg"
},
{
"key": "%s__assetOutPrice",
"type": "integer",
"value": 1000000
},
{
"key": "%s__stakingAddress",
"type": "string",
"value": "3PF1QWiN4A3CCJoKh1kGtqYqMNaBnRZbC6t"
},
{
"key": "%s__allowedAddress",
"type": "string",
"value": "3P87zrU6UmJq7wEZz84Fm9PJXr9tLGfEwPB"
},
{
"key": "%s__adminAddressList",
"type": "string",
"value": "3PBUguU83ccjXz7NBbR3vn67fVHawbxwaTH__3PLU2bd4CDhHC35bf5qsQxYLpkEkpgkrcvc__3PF3AgB3cEE8F9ZUxuA9aLyM2PBjKrrszZQ__3PHdaP2BLUXFacnqZm6WoFjidvzqZZMbb8j__3P33RBZUXcdx5JW918DqFfrscEuEZpAPUPz"
}
]
}
35 changes: 35 additions & 0 deletions migrations/wxdefi-498-release/factory_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"type": 12,
"fee": 500000,
"feeAssetId": null,
"version": 2,
"senderPublicKey": "8Y62huyQ3xnFnUw2FnZPHuWMsUy1c8t343UdWrHMgsq4",
"chainId": 87,
"data": [
{
"key": "%s__assets",
"type": "string",
"value": "Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on"
},
{
"key": "%s%d__startHeight__1",
"type": "integer",
"value": 4029955
},
{
"key": "%s%d__treasuryValue__1",
"type": "integer",
"value": 161759000000
},
{
"key": "%s__currentPeriod",
"type": "integer",
"value": 1
},
{
"key": "%s__calculatorAddress",
"type": "string",
"value": "3PEWpQi3QptntrersmgAgDEgrTSRf4pyXMz"
}
]
}
10 changes: 10 additions & 0 deletions migrations/wxdefi-498-release/treasury_burn_btc_wxg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"senderPublicKey": "5WG53hB4ZK2TWX7UnLeTU4ieDp8Fy4VtaYx6gKFYxGHu",
"fee": 500000,
"type": 6,
"version": 2,
"feeAssetId": null,
"chainId": 87,
"assetId": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
"amount": 197652859
}
10 changes: 10 additions & 0 deletions migrations/wxdefi-498-release/treasury_burn_eth_wxg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"senderPublicKey": "5WG53hB4ZK2TWX7UnLeTU4ieDp8Fy4VtaYx6gKFYxGHu",
"fee": 500000,
"type": 6,
"version": 2,
"feeAssetId": null,
"chainId": 87,
"assetId": "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
"amount": 1782553903
}
10 changes: 10 additions & 0 deletions migrations/wxdefi-498-release/treasury_burn_ltc_wxg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"senderPublicKey": "5WG53hB4ZK2TWX7UnLeTU4ieDp8Fy4VtaYx6gKFYxGHu",
"fee": 500000,
"type": 6,
"version": 2,
"feeAssetId": null,
"chainId": 87,
"assetId": "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
"amount": 19794837528
}
10 changes: 10 additions & 0 deletions migrations/wxdefi-498-release/treasury_burn_usdc_wxg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"senderPublicKey": "5WG53hB4ZK2TWX7UnLeTU4ieDp8Fy4VtaYx6gKFYxGHu",
"fee": 500000,
"type": 6,
"version": 2,
"feeAssetId": null,
"chainId": 87,
"assetId": "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ",
"amount": 86005770817
}
10 changes: 10 additions & 0 deletions migrations/wxdefi-498-release/treasury_burn_usdt_wxg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"senderPublicKey": "5WG53hB4ZK2TWX7UnLeTU4ieDp8Fy4VtaYx6gKFYxGHu",
"fee": 500000,
"type": 6,
"version": 2,
"feeAssetId": null,
"chainId": 87,
"assetId": "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
"amount": 85696397594
}
15 changes: 15 additions & 0 deletions migrations/wxdefi-499-release/calculator_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": 12,
"fee": 500000,
"feeAssetId": null,
"version": 2,
"senderPublicKey": "",
"chainId": 87,
"data": [
{
"key": "%s__factoryAddress",
"type": "string",
"value": "3PEhMFF2mfSWVxWqbW8guXVYcNeoW77ga7T"
}
]
}
25 changes: 25 additions & 0 deletions migrations/wxdefi-499-release/factory_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": 12,
"fee": 500000,
"feeAssetId": null,
"version": 2,
"senderPublicKey": "8Y62huyQ3xnFnUw2FnZPHuWMsUy1c8t343UdWrHMgsq4",
"chainId": 87,
"data": [
{
"key": "%s__calculatorAddress",
"type": "string",
"value": "3PQtGwmFsbKygGi8wPfUxz4bTUNgYodK3je"
},
{
"key": "%s__lockAddress",
"type": "string",
"value": "3PAqCJQC1rmfWsNvqepBG4bhiFAzSHGSQkm"
},
{
"key": "%s__lockDuration",
"type": "integer",
"value": 131487
}
]
}
15 changes: 15 additions & 0 deletions migrations/wxdefi-499-release/lock_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": 12,
"fee": 500000,
"feeAssetId": null,
"version": 2,
"senderPublicKey": "",
"chainId": 87,
"data": [
{
"key": "%s__factoryAddress",
"type": "string",
"value": "3PEhMFF2mfSWVxWqbW8guXVYcNeoW77ga7T"
}
]
}
15 changes: 15 additions & 0 deletions migrations/wxdefi-504-release/voting_emission_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": 12,
"fee": 500000,
"feeAssetId": null,
"version": 2,
"senderPublicKey": "7CCBtvKD4K6UAqDwpQKssA3WsvR2sdh1rq7CEZ5Gp5aL",
"chainId": 87,
"data": [
{
"key": "%s__resumptionFee",
"type": "integer",
"value": 500000000000
}
]
}
11 changes: 11 additions & 0 deletions migrations/wxdefi-504-release/voting_emission_script.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ride/factory_v2.ride
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func activateNewPool(poolAddress: String, amountAssetStr: String, priceAssetStr:
# return:
@Callable(i)
func managePool(poolAddress: String, newStatus: Int) = {
strict checkCaller = i.mustManager()
strict checkCaller = i.mustAdmin()

let poolConfig = getPoolConfig(poolAddress)

Expand Down
Loading

0 comments on commit cd33a7a

Please sign in to comment.