Skip to content

Commit

Permalink
Merge pull request #39 from gateway-fm/feat/cannon
Browse files Browse the repository at this point in the history
Feat/cannon
  • Loading branch information
asolovov authored Dec 13, 2023
2 parents 259b453 + b5107b3 commit 6424068
Show file tree
Hide file tree
Showing 188 changed files with 144,398 additions and 56 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ generate-perps_market-andromeda:
go run ./utils/getAbis/get-abis.go --get-mkdir ./Synthetix-Gitbook-v3/for-developers/abis/84531-andromeda-PerpsMarket.json ./contracts/perpsMarket
abigen --abi=./contracts/84531-andromeda-PerpsMarket.json --pkg=perpsMarket --out=./contracts/perpsMarket/contract.go

# generate go file for PerpsMarket contract on andromeda net from cannon abi
generate-perps_market-andromeda-c:
go run ./utils/getAbis/get-abis.go --get-mkdir ./cannon-synthetix/andromeda/perpsFactory/PerpsMarketProxy.json ./contracts/perpsMarket
abigen --abi=./contracts/PerpsMarketProxy.json --pkg=perpsMarket --out=./contracts/perpsMarket/contract.go

# generate go file for snxUSDT contract on andromeda net
generate-susdt-andromeda:
go run ./utils/getAbis/get-abis.go --get-mkdir ./Synthetix-Gitbook-v3/for-developers/abis/84531-andromeda-snxUSDToken.json ./contracts/sUSDT
Expand All @@ -33,6 +38,10 @@ generate-erc7412-andromeda:
update-subtree:
git subtree pull --prefix Synthetix-Gitbook-v3 [email protected]:Synthetixio/Synthetix-Gitbook-v3.git en --squash

# fetch ABIs from cannon
fetch-cannon-andromeda:
cannon inspect synthetix-omnibus:latest@andromeda --chain-id 84531 -w ./cannon-synthetix/andromeda --sources

# generate mock for service interface for testing
mock-service:
mockgen -source=services/service.go -destination=mocks/service/mockService.go
Expand Down
15 changes: 14 additions & 1 deletion Synthetix-Gitbook-v3/for-developers/smart-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4032,7 +4032,7 @@ There is a synthetix v3 core system supply cap also set. If the current supply b
#### OrderCommitted

```solidity
event OrderCommitted(uint128 marketId, uint128 accountId, enum SettlementStrategy.Type orderType, int128 sizeDelta, uint256 acceptablePrice, uint256 commitmentTime, uint256 settlementTime, uint256 expirationTime, bytes32 trackingCode, address sender)
event OrderCommitted(uint128 marketId, uint128 accountId, enum SettlementStrategy.Type orderType, int128 sizeDelta, uint256 acceptablePrice, uint256 commitmentTime, uint256 expectedPriceTime, uint256 settlementTime, uint256 expirationTime, bytes32 trackingCode, address sender)
```

Gets fired when a new order is committed.
Expand All @@ -4044,6 +4044,7 @@ There is a synthetix v3 core system supply cap also set. If the current supply b
* `sizeDelta` (*int128*) - requested change in size of the order sent by the user.
* `acceptablePrice` (*uint256*) - maximum or minimum, depending on the sizeDelta direction, accepted price to settle the order, set by the user.
* `commitmentTime` (*uint256*) - Time at which the order was committed.
* `expectedPriceTime` (*uint256*) -
* `settlementTime` (*uint256*) - start time of the settlement window.
* `expirationTime` (*uint256*) - Time at which the order expired.
* `trackingCode` (*bytes32*) - Optional code for integrator tracking purposes.
Expand Down Expand Up @@ -7538,6 +7539,18 @@ See {setApprovalForAll}
function div(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data divPrice)
```

#### mulDecimal

```solidity
function mulDecimal(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data mulPrice)
```

#### divDecimal

```solidity
function divDecimal(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data divPrice)
```

#### quickSort

```solidity
Expand Down
199 changes: 199 additions & 0 deletions cannon-synthetix/andromeda/buyback_snx/buyback_snx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
{
"address": "0x9e21Aa824b352856463F8525B805e0776FB96688",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_premium",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_snxFeeShare",
"type": "uint256"
},
{
"internalType": "address",
"name": "_oracleManager",
"type": "address"
},
{
"internalType": "bytes32",
"name": "_snxNodeId",
"type": "bytes32"
},
{
"internalType": "address",
"name": "_snxToken",
"type": "address"
},
{
"internalType": "address",
"name": "_usdToken",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "OverflowInt256ToUint256",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "buyer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "snx",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "usd",
"type": "uint256"
}
],
"name": "BuybackProcessed",
"type": "event"
},
{
"inputs": [],
"name": "DEAD",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getPremium",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getSnxFeeShare",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getSnxNodeId",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "snxAmount",
"type": "uint256"
}
],
"name": "processBuyback",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint128",
"name": "marketId",
"type": "uint128"
},
{
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "quoteFees",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
],
"constructorArgs": [
"10000000000000000",
"500000000000000000",
"0x439e6cbAaF61C63f406687907022960088801EC0",
"0x1b41fbc42103cff8bca2f94cf0650bdd354e65e022b5e30a4c24508b18362028",
"0x6B9db85A008424b1C985FE132D58dDaD80099b91",
"0xa89163A087fe38022690C313b5D4BBF12574637f"
],
"linkedLibraries": {},
"deployTxnHash": "0x481aeb5935644fe4dcca306babc0ca82db9e34675506d8bc6e437c1f70d9ab3e",
"sourceName": "contracts/BuybackSnx.sol",
"contractName": "BuybackSnx",
"deployedOn": "contract.buyback_snx",
"gasUsed": 580519,
"gasCost": "1500000254"
}
Loading

0 comments on commit 6424068

Please sign in to comment.