Skip to content

Commit

Permalink
add fee and deployer source
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Dec 5, 2024
1 parent 78994ef commit cc94b82
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
13 changes: 12 additions & 1 deletion int/api/cmd/deploySC.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,23 @@ func (d *deploySC) Handle(params operations.CmdDeploySCParams) middleware.Respon
})
}

fee, err := strconv.ParseUint(*params.Body.Fee, 10, 64)
if err != nil {
return operations.NewCmdDeploySCInternalServerError().
WithPayload(
&models.Error{
Code: err.Error(),
Message: err.Error(),
})
}

operationResponse, events, err := onchain.DeploySC(
d.networkInfos,
params.Body.Nickname,
sendoperation.MaxGasAllowedExecuteSC, // default
maxCoins, // maxCoins
coins, // smart contract deployment "fee"
coins, // Coins to send for storage
fee, // operation fee
sendoperation.DefaultExpiryInSlot,
parameters,
smartContractByteCode,
Expand Down
5 changes: 5 additions & 0 deletions int/api/cmd/sc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Deployer.wasm source
https://github.com/massalabs/massa-web3/tree/main/scripts/deployerGeneration



5 changes: 3 additions & 2 deletions pkg/onchain/sc.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func DeploySC(
nickname string,
maxGas uint64,
maxCoins uint64,
coins uint64,
fees uint64,
expiry uint64,
parameters []byte,
Expand All @@ -123,7 +124,7 @@ func DeploySC(
contract := ContractDatastore{
Data: smartContractByteCode,
Args: parameters,
Coins: fees,
Coins: coins,
}

dataStore, err := populateDatastore(contract)
Expand All @@ -141,7 +142,7 @@ func DeploySC(
client,
networkInfos.ChainID,
expiry,
fees,
fees + coins,
exeSCOperation,
nickname,
signer,
Expand Down

0 comments on commit cc94b82

Please sign in to comment.